using-git-worktrees
Original:🇺🇸 English
Not Translated
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
1installs
Sourceschlenks/superpowers-bd
Added on
NPX Install
npx skill4agent add schlenks/superpowers-bd using-git-worktreesSKILL.md Content
Using Git Worktrees
Overview
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."
Directory Selection Process
Follow this priority order:
- Check existing directories -- Use or
.worktrees/if present (worktrees/wins if both exist).worktrees/ - Check CLAUDE.md -- Use any worktree directory preference specified there
- Ask user -- Offer (project-local) or
.worktrees/(global)~/.config/superpowers/worktrees/<project>/
See for full bash commands and ask-user flow.
references/directory-selection.mdSafety Verification
For project-local directories only (not needed for global):
- Check gitignore -- to verify directory is ignored
git check-ignore -q .worktrees - Add if needed -- Add to if not ignored
.gitignore - Commit -- Commit the change before proceeding
.gitignore
See for full verification protocol.
references/safety-verification.mdCreation Steps (Task-Tracked)
Create 6 native tasks, each blocked by the previous (non-skippable sequence):
- Select worktree directory location -- Check existing dirs, CLAUDE.md, or ask user
- Verify gitignore for project-local directory -- Run , add to
git check-ignoreif needed.gitignore - Create worktree --
git worktree add <path> -b <branch> - Install dependencies -- Auto-detect project type, run appropriate install command
- Run baseline tests -- Capture output showing pass/fail; ask user if tests fail
- Worktree ready -- Report location and test status; only complete if tests passed
See for full TaskCreate blocks, bash commands, and setup detection.
references/creation-steps.mdQuick Reference
| Situation | Action |
|---|---|
| Use it (verify ignored) |
| Use it (verify ignored) |
| Both exist | Use |
| 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 Mistakes
- Skipping ignore verification -- worktree contents pollute git status. Always first.
git check-ignore - Assuming directory location -- follow priority: existing > CLAUDE.md > ask.
- Proceeding with failing tests -- report failures, get permission first.
- Hardcoding setup commands -- auto-detect from project files instead.
Integration
Called by: brainstorming (after design), any skill needing isolated workspace
Pairs with: finishing-a-development-branch (cleanup), executing-plans / subagent-driven-development (work happens here)
Reference Files
- : full priority order with bash commands and ask-user flow
references/directory-selection.md - : full gitignore verification protocol with commands
references/safety-verification.md - : full TaskCreate blocks, bash commands, and setup detection
references/creation-steps.md - : annotated example of complete worktree setup workflow
references/example-workflow.md - : Never/Always lists for quick self-check
references/red-flags.md