Overview
Git worktrees let multiple working directories share a single.git repository. Each worktree has its own branch, its own files on disk, and its own clean state — without copying the repository or switching branches in your main workspace.
In the Superpowers workflow, worktrees are required before executing any implementation plan. They isolate feature work so subagents don’t interfere with the main workspace, parallel tasks don’t conflict with each other, and failing tests in a new branch can’t be confused with failing tests in the baseline.
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.”
When the skill activates
- After design approval, before writing implementation plans
- Before executing any tasks with subagent-driven development
- Before executing any tasks with executing-plans
- Any time you need an isolated workspace for a new branch
Directory selection
Follow this priority order — do not skip steps or assume a location.Check for an existing worktrees directory
.worktrees/ exists, use it. If worktrees/ exists, use it. If both exist, .worktrees/ wins.Safety verification
For project-local directories (.worktrees/ or worktrees/), you must verify the directory is git-ignored before creating the worktree. If worktree contents are not ignored, they get tracked — accidentally committing worktree contents to the repository is a real risk.
- Add the appropriate line to
.gitignore - Commit the change
- Then proceed with worktree creation
~/.config/superpowers/worktrees/), no .gitignore verification is needed — they’re outside the project entirely.
Creation steps
Run project setup
Auto-detect and run the appropriate setup for the project:If no
package.json, Cargo.toml, or equivalent exists, skip dependency install.Verify a clean test baseline
Run the project’s test suite to confirm the worktree starts clean:If tests fail: Report the failures and ask whether to proceed or investigate. You cannot distinguish new bugs from pre-existing ones if you proceed from a broken baseline.If tests pass: Report ready.
Example workflow
Quick reference
| Situation | Action |
|---|---|
.worktrees/ exists | Use it (verify ignored first) |
worktrees/ exists | Use it (verify ignored first) |
| Both exist | Use .worktrees/ |
| Neither exists | Check CLAUDE.md → ask user |
| Directory not ignored | Add to .gitignore + commit first |
| Tests fail during baseline | Report failures + ask whether to proceed |
No package.json/Cargo.toml | Skip dependency install |
Common mistakes
Skipping ignore verification. Worktree contents get tracked and pollutegit status. Always run git check-ignore before creating a project-local worktree.
Assuming the directory location. Creates inconsistency and violates project conventions. Follow the priority: existing > CLAUDE.md > ask.
Proceeding with failing tests. You won’t be able to distinguish new bugs from pre-existing ones. Report failures and get explicit permission to proceed.
Hardcoding setup commands. Breaks on projects using different tools. Auto-detect from project files.
Red flags
Never:- Create a worktree without verifying it’s ignored (for project-local directories)
- Skip baseline test verification
- Proceed with failing tests without asking
- Assume the directory location when ambiguous
- Skip the CLAUDE.md check
Dispatching parallel agents across worktrees
When you have multiple independent problems — different test files failing with different root causes, multiple subsystems broken independently — you can dispatch one agent per problem domain and let them work concurrently in separate worktrees. Use when:- 3+ test files failing with different root causes
- Multiple subsystems broken independently
- Each problem can be understood without context from the others
- No shared state between investigations
- Failures are related (fixing one might fix others)
- Agents would edit the same files
- You need full system state to understand the issue
Integration
Called by:- Brainstorming (phase 4) — required when design is approved and implementation follows
- Subagent-driven development — required before executing any tasks
- Executing Plans — required before executing any tasks
- Finishing a development branch — required for cleanup after work is complete