Notre avis
Synchronise la branche par défaut locale avec la distante pour garantir une base à jour avant de créer des worktrees.
Points forts
- Automatise le fetch et le fast-forward de la branche par défaut
- Fournit une sortie structurée (KEY=VALUE) facile à interpréter
- Gère les erreurs avec des suggestions claires (stash, reset, branche de récupération)
- Permet de spécifier une branche alternative si la détection automatique échoue
Limites
- Ne supporte que le fast-forward, pas le rebase ou le merge
- Nécessite une intervention humaine en cas de divergences ou de modifications non commitées
- Ne gère que la branche par défaut, pas les branches de fonctionnalité
Utilisez cette compétence avant de créer un nouveau worktree ou lorsque vous avez besoin d'une branche de base à jour pour commencer le travail.
Évitez de l'utiliser si vous avez des commits locaux sur la branche par défaut que vous souhaitez conserver sans les déplacer vers une autre branche.
Analyse de sécurité
PrudenceThe skill uses a bash script to synchronize Git branches, involving network fetch and potentially destructive local operations. These are controlled and require explicit user choices, but the risk of data loss exists if mishandled.
- •Executes a bash script that performs network operations (git fetch) and local file modifications.
- •Error handling suggests commands like 'git reset --hard' and 'git stash' which could discard local changes if misused, though user consent is required.
Exemples
Run the git sync skill to bring my default branch up to date with the remote.Use the git sync skill but force it to sync the 'develop' branch instead of the auto-detected default.The git sync script failed with uncommitted changes. Ask me if I want to stash, discard, or abort.name: git-sync description: Synchronize local default branch with remote, ensuring up-to-date base for worktrees. allowed-tools:
- Bash(~/.claude/skills/git-sync/scripts/sync.sh:*)
- Bash(git stash :*)
- Bash(git restore :*)
- Bash(git checkout :*)
- Bash(git remote -v)
Git Sync
Instructions
Invocation
Run the sync script. The script path is relative to this skill's directory:
~/.claude/skills/git-sync/scripts/sync.sh
To override the default branch (e.g. if auto-detection fails):
~/.claude/skills/git-sync/scripts/sync.sh --branch main
Reading the Output
The script emits structured KEY=VALUE pairs on stdout. Key fields:
| Field | Meaning |
|---|---|
| GIT_SYNC_STATUS | success or error |
| DEFAULT_BRANCH | Detected default branch name |
| ORIGINAL_BRANCH | Branch before sync started |
| COMMITS_PULLED | Number of new commits pulled (on success) |
| LATEST_COMMIT | Latest commit after sync (on success) |
| ERROR_CODE | Error type (on failure) |
| DETAILS | Error details (on failure) |
On Success (exit code 0)
Report to the user:
Sync complete
- Default branch: <DEFAULT_BRANCH>
- Pulled <COMMITS_PULLED> new commit(s)
- Latest: <LATEST_COMMIT>
- Ready to create new worktrees
If COMMITS_PULLED=0, simply say the branch is already up to date.
Error Handling
Exit 1 — Uncommitted changes (ERROR_CODE=uncommitted_changes)
The default branch has uncommitted changes, which is unexpected. Show the user the DETAILS field (modified files) and ask them to choose:
- Stash changes — run
git stash push -m "Temp stash before sync", then re-run the sync script - Discard changes — run
git restore ., then re-run the sync script - Abort — stop and let the user handle it manually
Exit 2 — Cannot detect default branch (ERROR_CODE=no_default_branch)
The script could not determine the default branch automatically. Ask the user which branch to sync (typically main or master), then re-run with:
~/.claude/skills/git-sync/scripts/sync.sh --branch <user-specified-branch>
Exit 3 — Fast-forward failed (ERROR_CODE=ff_failed)
The local default branch has diverged from remote. The output includes LOCAL_COMMITS and REMOTE_COMMITS showing what diverged. Present these to the user and ask them to choose:
- Reset to remote — run
git checkout <DEFAULT_BRANCH> && git reset --hard origin/<DEFAULT_BRANCH>, warn this discards local commits - Move local commits to a branch — run
git checkout -b recover/<DEFAULT_BRANCH>-commits && git checkout <DEFAULT_BRANCH> && git reset --hard origin/<DEFAULT_BRANCH> - Manual resolution — stop and let the user handle it
After resolving, re-run the sync script to verify.
Exit 4 — Fetch failed (ERROR_CODE=fetch_failed)
Network or remote issue. Report the error and suggest:
- Check network connectivity
- Verify remote with
git remote -v - Retry later
Expert Next.js App Router
Developpement
Un skill qui transforme Claude en expert Next.js App Router.
Générateur de README
Developpement
Crée des README.md professionnels et complets pour vos projets.
Rédacteur de Documentation API
Developpement
Génère de la documentation API complète au format OpenAPI/Swagger.