skills/using-git-worktrees/SKILL.md
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
npx skillsauth add soyio-id/skills 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 plus safety verification equals reliable isolation.
Inside the Soyio multi-repo workspace, prefer create-worktree for one repo at a time. Use this skill as the generic fallback when no repo-specific skill or command applies.
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
ls -d worktrees 2>/dev/null
If found, use that directory. If both exist, .worktrees wins.
grep -i "worktree.*director" AGENTS.md 2>/dev/null
If preference is specified, use it without asking.
If no directory exists and no AGENTS.md preference:
No worktree directory found. Where should I create worktrees?
Which would you prefer?
Verify directory is ignored before creating a worktree:
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
If not ignored:
.gitignoreWhy critical: prevents accidentally committing worktree contents to repository.
No .gitignore verification needed because it is outside the project.
project=$(basename "$(git rev-parse --show-toplevel)")
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/.config/superpowers/worktrees/*)
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
;;
esac
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
Run the repo's standard setup command for the new worktree.
Discovery order:
AGENTS.md in the repoREADME.md or docsMakefile, package.json scripts, language manifests)Use the smallest bootstrap command that makes the workspace runnable. If none is documented, skip and report it.
# Example only. Use repo-specific commands.
# <setup-command>
Run tests to ensure the worktree starts clean:
# Example only. Use repo-specific command.
# <baseline-test-command>
If tests fail, report failures and ask whether to proceed or investigate.
If tests pass, report ready.
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, then ask user |
| Directory not ignored | Add to .gitignore and commit |
| Tests fail during baseline | Report failures and ask |
| No setup instructions found | Skip setup and report |
git check-ignore before creating a project-local worktree.AGENTS.md, then ask.AGENTS.md and repo docs, then run repo-specific setup.You: I'm using the using-git-worktrees skill to set up an isolated workspace.
[Check .worktrees/ - exists] [Verify ignored - git check-ignore confirms .worktrees/ is ignored] [Create worktree: git worktree add .worktrees/auth -b feature/auth] [Run npm install] [Run npm test - 47 passing]
Worktree ready at /Users/username/myproject/.worktrees/auth Tests passing (47 tests, 0 failures) Ready to implement auth feature
Never:
AGENTS.md checksAlways:
AGENTS.md, then ask usertools
Create or reuse a coordinated Soyio parity workspace across soyio, soyio-dashboard, and soyio-embeds, then start the matching local runtimes.
testing
Triage and prepare automated dependency security PRs for merge with minimal risk. Identify bot PRs that need intervention, resolve required issues only, refresh stale branches safely, detect superseded PRs, and keep diffs dependency-focused.
testing
Fix multiple dependency vulnerabilities across multiple repos. Parses Vanta-style vulnerability entries, groups by repo, creates a single fix branch per repo, applies all fixes, verifies compatibility, and creates PRs after user approval. Use when the user says '/fix-vulnerabilities' or asks to fix vulnerabilities across repos.
tools
Create an isolated worktree for a new branch, existing branch, or PR review. Prefer repo-local worktree commands when they exist, and fall back to vanilla git worktrees otherwise.