Notre avis
Gère les worktrees Git pour un monorepo : création, liste et nettoyage avec installation automatique des dépendances et validation des issues GitHub.
Points forts
- Automatise la création de worktrees à partir d'issues GitHub avec validation de l'état de l'issue
- Installe automatiquement les dépendances avec pnpm après création
- Fournit un tableau récapitulatif des worktrees actifs avec statut avance/recul
- Nettoie les worktrees dont les branches ont été fusionnées dans main
Limites
- Spécifique à la structure de répertoires du monorepo USOPC
- Nécessite que l'outil en ligne de commande GitHub (`gh`) soit installé et configuré
- Ne gère pas les conflits de fusion lors du nettoyage
Utilisez cette compétence pour créer rapidement un environnement de travail isolé pour une issue GitHub, ou pour nettoyer les worktrees obsolètes après fusion.
Ne l'utilisez pas si vous travaillez en dehors du monorepo USOPC ou si vous préférez gérer les worktrees manuellement avec Git.
Analyse de sécurité
SûrThe skill only executes standard git worktree operations, pnpm install, and gh issue view, all applied locally within the repository. There is no command to fetch or execute external scripts, delete files outside controlled worktree paths, or exfiltrate data. The allowed tools are restricted to safe, legitimate development commands.
Aucun point d'attention détecté
Exemples
/worktree create 42/worktree list/worktree cleanupname: worktree description: Smart worktree management — create, list, and clean up git worktrees with automatic gotcha handling (pnpm install, hook script copy, issue validation). argument-hint: <create|list|cleanup> [issue-number] disable-model-invocation: true allowed-tools: Bash(git *), Bash(cd *), Bash(pnpm *), Bash(gh issue view *), Bash(gh repo view *), Bash(ls *), Glob, Read
Smart Worktree Management
You are managing git worktrees for the USOPC Athlete Support Agent monorepo. The argument is: $ARGUMENTS.
Parse the argument to determine the subcommand:
create <issue-number>— Create a new worktree for an issuelist— List active worktrees with statuscleanup— Remove worktrees whose branches have been merged
If no subcommand is provided or the argument is empty, print the usage:
Usage: /worktree <command> [args]
create <issue-number> — Create worktree for a GitHub issue
list — List active worktrees with branch status
cleanup — Remove merged worktrees and prune refs
Subcommand: create <issue-number>
Step 1: Validate the issue exists
Run gh issue view <issue-number> --json number,title,state to confirm the issue exists and is open. If the issue doesn't exist or is closed, warn the user and stop.
Step 2: Determine paths
- Get the main repo root:
git rev-parse --show-toplevel(if in a worktree, usegit worktree listto find the main repo) - Worktree path:
../usopc-issue-<number>relative to the main repo (i.e., a sibling directory) - Derive a short branch name from the issue title:
feat/<kebab-case-summary>(max 50 chars, lowercase, hyphens only)
Step 3: Fetch latest main
Run git fetch origin main to ensure we branch from the latest main.
Step 4: Create the worktree
git worktree add <worktree-path> -b <branch-name> origin/main
If the worktree path already exists, warn and stop.
Step 5: Install dependencies
cd <worktree-path> && pnpm install
Step 6: Print summary
Worktree created:
Path: <worktree-path>
Branch: <branch-name>
Issue: #<number> — <title>
Dependencies installed.
Navigate with: cd <worktree-path>
Subcommand: list
Step 1: List worktrees
Run git worktree list and parse the output.
Step 2: For each worktree (excluding bare/main)
- Show the path, branch name
- Run
git -C <path> log --oneline -1for latest commit - Run
git -C <path> rev-list --left-right --count origin/main...<branch>for ahead/behind status
Step 3: Print formatted table
Active worktrees:
../usopc-issue-42 feat/add-auth +3 / -0 (latest: abc1234 Add auth middleware)
../usopc-issue-55 fix/query-perf +1 / -2 (latest: def5678 Fix slow query)
Subcommand: cleanup
Step 1: List worktrees
Run git worktree list and identify non-main worktrees.
Step 2: Check each branch
For each worktree branch, check if it has been merged into origin/main:
git branch --merged origin/main | grep <branch-name>
Step 3: Remove merged worktrees
For each merged worktree, remove it:
git worktree remove <path>
Print which worktrees were removed.
Step 4: Prune and clean up
git worktree prune
git fetch --prune origin
Step 5: Print summary
Cleaned up:
Removed: ../usopc-issue-42 (feat/add-auth — merged)
Removed: ../usopc-issue-55 (fix/query-perf — merged)
Pruned stale worktree references.
If no worktrees were eligible for cleanup, say so.
Important notes
- Always use absolute paths when running git commands to avoid confusion between worktree and main repo.
- The main repo root can be found via
git worktree list— it's the first entry (the one without[branch]or with[main]). scripts/update-hours.mjsandscripts/stamp-readme-hours.mjsare tracked in git, so they'll be available in worktrees automatically — no copying needed.
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.