skills/git-worktrees/SKILL.md
Use when starting feature work that needs isolation from the current workspace or before executing implementation plans.
npx skillsauth add sipengxie2024/superpower-planning 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.
Prefer Claude Code's native worktree support. This skill is now a thin safety guide, not a custom worktree orchestration layer.
Core principle: Detect existing isolation first, use Claude Code's native worktree primitive when possible, and avoid manual git worktree management unless the native path is unavailable.
Announce at start: "I'm using the git-worktrees skill to set up or verify isolated workspace state."
Before creating anything, check whether the current checkout is already isolated:
git_dir=$(git rev-parse --git-dir)
git_common=$(git rev-parse --git-common-dir)
superproject=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
Decision rules:
git_dir != git_common and superproject is empty, you are already in a linked worktree. Report the current path and do not create another one.superproject is non-empty, you are inside a submodule. Do not treat git_dir != git_common alone as proof of worktree isolation.Use the native Claude Code worktree flow whenever available:
claude --worktree <name>EnterWorktree toolLet Claude Code own the path, branch naming, copying of gitignored files, and cleanup behavior where possible.
Only use manual git worktree add when the native Claude Code path is unavailable and the user still wants an isolated checkout.
When doing so:
.worktrees/ or worktrees/ directory if present.git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
.gitignore before creating the worktree.git worktree add "<path>" -b "<branch-name>"
| Situation | Action |
|-----------|--------|
| Already in linked worktree | Reuse it; do not create another |
| Inside submodule | Do not infer worktree isolation from git_dir != git_common |
| Native Claude Code worktree available | Use it first |
| Manual project-local worktree | Verify ignored path before creation |
| No git repo | Do not create a worktree |
| Ambiguous location | Ask the user |
Never:
Called by:
superpower-planning:brainstorming when the user wants implementation isolation after design approvalsuperpower-planning:executing-plans when starting from a shared or risky branchsuperpower-planning:subagent-driven-codex when Codex should operate in an isolated checkoutdevelopment
Use when a spec or requirements exist for a multi-step task and an implementation plan needs to be written before touching code
data-ai
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs.
data-ai
Use when executing implementation plans with parallel task groups or individual tasks too heavy for subagent context limits.
development
Use when implementing any feature or bugfix, before writing implementation code