Agent skill
worktree-switch
Switch between git worktrees for parallel development. Use when working on multiple issues simultaneously.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/worktree-switch
SKILL.md
Worktree Switch
Navigate between isolated worktree directories quickly.
When to Use
- Working on multiple issues
- Need to context switch without stashing
- Testing different branches side-by-side
- Comparing implementations
Quick Reference
# List all worktrees
git worktree list
# Switch worktree (simple cd)
cd ../ProjectOdyssey-42-feature
# Verify current worktree
git worktree list | grep "*"
# Switch by issue number (script)
./scripts/switch_worktree.sh 42
Workflow
- List worktrees - See all available worktrees and their paths
- Navigate -
cdto desired worktree directory - Verify - Check
git branchto confirm you're on right branch - Work - Make changes, commit normally
- Switch - Move to different worktree with simple
cd
Common Patterns
Terminal Aliases
# Add to ~/.bashrc or ~/.zshrc
alias wt='git worktree list'
alias wtcd='cd $(git worktree list | fzf | awk "{print \$1}")'
Tmux Sessions
# Create persistent session per worktree
tmux new -s issue-42 -c ../ProjectOdyssey-42-feature
# Switch sessions
tmux attach -t issue-42
# List sessions
tmux list-sessions
Best Practices
- One worktree per issue (don't share branches)
- Use clear naming:
<issue-number>-<description> - Keep worktrees organized in parent directory
- Use terminal multiplexer (tmux/screen) for persistent sessions
- Clean up completed worktrees (see
worktree-cleanupskill)
Limitations
- Each branch can only be checked out in ONE worktree
- Cannot be in worktree while removing it
- All worktrees share the same
.gitdirectory (some operations affect all)
References
- See
worktree-createskill for creating worktrees - See
worktree-cleanupskill for removing worktrees - worktree-strategy.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?