When to Use
Use this skill when:- Starting feature work that needs isolation from your current workspace
- Before executing implementation plans
- Working on multiple features that need to coexist
- Wanting to preserve your current workspace state while experimenting
Always announce at start: “I’m using the using-git-worktrees skill to set up an isolated workspace.”
Core Principle
Systematic directory selection + safety verification = reliable isolation Git worktrees share the same repository while providing separate working directories. This allows concurrent work on different branches without the overhead of cloning.Directory Selection Process
The skill follows a strict priority order to determine where to create worktrees:Check for existing directories
First checks if a worktree directory already exists:If found, uses that directory. If both exist,
.worktrees wins.Check CLAUDE.md for preferences
If no directory exists, checks for a preference in CLAUDE.md:If a preference is specified, uses it without asking.
Safety Verification
Project-Local Directories
Before creating a worktree:- Add appropriate line to
.gitignore - Commit the change
- Proceed with worktree creation
Global Directory
For~/.config/superpowers/worktrees, no .gitignore verification is needed - it’s outside the project entirely.
Creation Workflow
Verify clean baseline
Runs tests to ensure the worktree starts clean:If tests fail: Reports failures and asks whether to proceed or investigate.If tests pass: Reports ready.
Quick Reference
| Situation | Action |
|---|---|
.worktrees/ exists | Use it (verify ignored) |
worktrees/ exists | Use it (verify ignored) |
| Both exist | Use .worktrees/ |
| Neither exists | Check CLAUDE.md → Ask user |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |
Common Pitfalls
Skipping ignore verification
Skipping ignore verification
Problem: Worktree contents get tracked, pollute git statusFix: Always use
git check-ignore before creating project-local worktreeAssuming directory location
Assuming directory location
Problem: Creates inconsistency, violates project conventionsFix: Follow priority: existing > CLAUDE.md > ask
Proceeding with failing tests
Proceeding with failing tests
Problem: Can’t distinguish new bugs from pre-existing issuesFix: Report failures, get explicit permission to proceed
Hardcoding setup commands
Hardcoding setup commands
Problem: Breaks on projects using different toolsFix: Auto-detect from project files (package.json, Cargo.toml, etc.)
Example Workflow
Red Flags
Integration with Other Skills
Called by
- brainstorming (Phase 4) - Required when design is approved
- subagent-driven-development - Required before executing tasks
- executing-plans - Required before executing tasks
Pairs with
- finishing-a-development-branch - Required for cleanup after work complete