skills/playbooks/worktree-ops/SKILL.md
Manage git worktrees for isolated parallel development sessions. Create, list, switch between, and remove worktrees with safety checks for uncommitted changes and unpushed commits. Use when the user wants to work on multiple branches simultaneously, run parallel sessions, or isolate experimental changes.
npx skillsauth add krzysztofsurdy/code-virtuoso worktree-opsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Git worktrees let you check out multiple branches of the same repository into separate directories simultaneously. Each worktree has its own working directory and index while sharing the same .git object store and history. This is useful for running parallel development sessions, reviewing a PR while mid-feature, or isolating experimental changes without stashing or committing half-finished work.
| Principle | Meaning |
|---|---|
| Isolation without duplication | Worktrees share git history but keep working directories separate - no need to clone the repo again |
| Safety first | Always check for uncommitted changes and unpushed commits before removing a worktree |
| Clean up after yourself | Stale worktree entries and orphaned branches accumulate - prune regularly |
| Convention over configuration | Use a consistent directory layout (.worktrees/<name>/) and branch naming (worktree-<name>) |
| Command | What it does | When to use |
|---|---|---|
| git worktree add <path> -b <branch> | Create a new worktree with a new branch | Starting parallel work on a new task |
| git worktree list | Show all worktrees with their branches and paths | Checking what is active |
| git worktree list --porcelain | Machine-readable worktree listing | Scripting or enriching with status info |
| git worktree remove <path> | Remove a worktree directory and its admin files | Done with a parallel task |
| git worktree remove <path> --force | Force-remove even with uncommitted changes | After explicit user confirmation |
| git worktree prune | Clean up stale worktree entries | After manual directory deletion or errors |
| git branch -D worktree-<name> | Delete the orphaned branch after worktree removal | Keeping branches clean |
Create a new worktree for an isolated parallel development session.
git rev-parse --is-inside-work-tree && git worktree list
If the current working directory is already a worktree (not the main working tree), warn the user and stop.feature-auth, bugfix-123)"git worktree add .worktrees/<name> -b worktree-<name>
Worktree created:
Directory: .worktrees/<name>/
Branch: worktree-<name>
Based on: <current HEAD>
composer install, npm install, pip install -r requirements.txt)list command to see all active worktreesremove command to clean up when doneList all active worktrees with their branches, paths, and status.
git worktree list --porcelain
git -C <worktree-path> status --short 2>/dev/null
Active worktrees:
| # | Name | Branch | Path | Status |
|---|--------------|----------------------|-------------------------------|---------------|
| 1 | (main) | main | /path/to/repo | clean |
| 2 | feature-auth | worktree-feature-auth| .worktrees/feature-auth | 3 uncommitted |
| 3 | bugfix-123 | worktree-bugfix-123 | .worktrees/bugfix-123 | clean |
create command to create one."Switch your working directory to a different existing worktree.
git worktree list
If only the main working tree exists, say: "No worktrees available to switch to. Use the create command to create one." and stop.<name> not found." and show the available list.Switched to worktree:
Directory: <worktree-path>
Branch: <branch-name>
git status --short
Remove one or all worktrees from the current repository.
git worktree list
If no worktrees exist beyond the main working tree, say: "No worktrees to clean up." and stop.all - remove all worktrees (except the main working tree).all to remove everything."git -C <worktree-path> status --short
git -C <worktree-path> log --oneline @{upstream}..HEAD 2>/dev/null
If there are uncommitted changes or unpushed commits, warn the user:
WARNING: Worktree "<name>" has uncommitted changes / unpushed commits:
- 2 modified files
- 1 unpushed commit
These will be permanently lost. Continue? (yes/no)
Wait for explicit confirmation before proceeding.git worktree remove <path> --force
git branch -D worktree-<name> 2>/dev/null
Use --force only after the user has confirmed in step 4.git worktree prune
Removed worktrees:
- feature-auth (branch worktree-feature-auth deleted)
- bugfix-123 (branch worktree-bugfix-123 deleted)
Remaining worktrees: 1 (main working tree only)
| Problem | Cause | Fix |
|---|---|---|
| fatal: '<path>' is a missing but locked worktree | Worktree directory was deleted manually but the lock file remains | Run git worktree unlock <path> then git worktree prune |
| Stale entries in git worktree list | Worktree directory was deleted without using git worktree remove | Run git worktree prune to clean up admin files |
| fatal: '<branch>' is already checked out | Branch is active in another worktree | Switch the other worktree to a different branch first, or remove it |
| Worktree path exists but is empty | Interrupted creation or corrupted state | Run git worktree remove <path> --force then git worktree prune |
| Situation | Recommended Skill |
|---|---|
| When managing branches and commits | git-workflow |
| When executing a TDD implementation in an isolated worktree | test-driven-development |
| When following a full ticket workflow that uses worktrees | ticket-delivery |
development
Spawn and coordinate a pre-composed agent team from a team definition file. Reads team files from teams/, resolves agents and skills, picks the best spawning mode (peer or sequential), and runs the workflow. Use when the user asks to run a team, dispatch a development team, start a feature delivery, or coordinate multiple agents for a multi-phase task.
development
Pre-composed agent team library. Use when the user asks which teams are available, what a team does, when to pick one team over another, or to browse multi-agent compositions. Catalogs ready-to-run teams (development team, review squad, war room) with their purpose, agent roster, workflow type, and when to use each. The actual dispatching is handled by the dispatching-agent-teams skill.
tools
Ecosystem discovery advisor. Use when the user asks 'what skill should I use', 'what agent should I delegate to', 'which team fits this task', or when onboarding to available skills, agents, and teams. Scans ALL installed skills at runtime -- not limited to any single plugin or vendor. Triggers: 'which skill', 'which agent', 'what do I use for', 'orient me', 'what tools do I have'.
tools
Interactive tool to scaffold a complete Claude Code plugin -- plugin.json manifest, skills, agents, hooks, MCP servers, LSP servers, and an optional marketplace.json catalog entry. Use when the user asks to create a plugin, build a Claude Code plugin, scaffold a plugin marketplace, convert an existing .claude/ configuration into a plugin, or package skills and agents for distribution. Runs a guided questionnaire, writes all required files to disk, and prints test instructions.