
Using Git Worktrees
Creates isolated git worktrees with systematic safety checks and project setup automation. Follows a clear directory priority (existing .worktrees, then worktrees, then CLAUDE.md preferences, finally asks), automatically verifies directories are gitignored to prevent accidentally committing worktree contents, and runs appropriate dependency installation (npm install, cargo build, etc.) based on project files. Always establishes a clean test baseline before reporting ready. The safety verification is the real value here since worktree pollution is a common gotcha that breaks git status output. Designed to be called by other skills like brainstorming and executing-plans when they need workspace isolation.
- skills.sh installs
- 230.2K
- GitHub stars
- 315.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add obra/superpowers --skill using-git-worktrees --agent claude-codeInstalls into .claude/skills of the current project.
Files
Using Git Worktrees
Overview
Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
Core principle: Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."
Step 0: Detect Existing Isolation
Before creating anything, check if you are already in an isolated workspace.
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
BRANCH=$(git branch --show-current)
Submodule guard: GIT_DIR != GIT_COMMON is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
git rev-parse --show-superproject-working-tree 2>/dev/null
Sponsors
Details
- Repository
- github.com/obra/superpowers
- Category
- Git & Pull Requests
More from obra/superpowers
All 14- Finishing A Development Branch227.7K
- Brainstorming423.3K
- Systematic Debugging326.7K
- Writing Plans298.6K
- Using Superpowers283.7K
- Requesting Code Review276.5K
- Test Driven Development274.8K
- Verification Before Completion270.3K
- Executing Plans257.5K
- Subagent Driven Development252K
- Receiving Code Review235.1K
- Dispatching Parallel Agents231.3K
- Writing Skills231.3K