skills/superpowers/using-git-worktrees/SKILL.md
Use when starting feature work that needs isolation from the current workspace, or before executing an implementation plan.
npx skillsauth add jbro/pi-agent using-git-worktreesInstall 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 create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
Core principle: Systematic directory selection + safety verification = reliable isolation.
Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."
Follow this priority order:
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative
If found: use it. If both exist, .worktrees wins.
grep -i "worktree.*director" AGENTS.md 2>/dev/null
If preference specified: use it without asking.
No worktree directory found. Where should I create worktrees?
1. .worktrees/ (project-local, hidden)
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
Which would you prefer?
MUST verify before creating worktree:
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
If NOT ignored: add to .gitignore, commit, then proceed.
This prevents accidentally committing worktree contents to the repository.
~/.config/superpowers/worktrees)No .gitignore verification needed — outside the project entirely.
project=$(basename "$(git rev-parse --show-toplevel)")
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
if [ -f package.json ]; then npm install; fi
if [ -f Cargo.toml ]; then cargo build; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi
npm test / cargo test / pytest / go test ./...
If tests fail: report failures, ask whether to proceed or investigate.
Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>
| Situation | Action |
|-----------|--------|
| .worktrees/ exists | Use it (verify ignored) |
| worktrees/ exists | Use it (verify ignored) |
| Both exist | Use .worktrees/ |
| Neither exists | Check AGENTS.md → ask user |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail at baseline | Report + ask before proceeding |
| No package.json / Cargo.toml | Skip dependency install |
Never:
git check-ignore verificationAlways:
Called by: executing-plans — REQUIRED before executing any tasks
Pairs with: finishing-a-development-branch — REQUIRED for cleanup after work is complete
testing
Use when writing or editing human-facing prose that needs clearer, more concise wording.
development
Use when you have a spec or requirements for a multi-step task, before touching code
data-ai
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
tools
Use when starting any conversation or task, to determine which skills apply before responding or taking any action.