Use this skill when starting a new feature, creating an isolated development environment, or when asked to set up a worktree. Provides safe, isolated workspace for development without affecting main branch.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
Create isolated development environments for features without affecting the main branch. Each worktree is a separate working directory with its own branch.
.worktrees/ directory - If project already has one, use it.worktrees/)CRITICAL: Verify .gitignore contains the pattern BEFORE creating worktree.
# Check if .gitignore contains .worktrees/
grep -q "\.worktrees" .gitignore
# If NOT found, add it FIRST
echo ".worktrees/" >> .gitignore
git add .gitignore
git commit -m "chore: add .worktrees to gitignore"
Never proceed without this check. Worktree contents must not be committed.
~/.config/superpowers/worktrees/)No .gitignore verification needed - these are outside the project.
# Option A: Project-local (recommended for most cases)
WORKTREE_DIR=".worktrees"
# Option B: Global (for cross-project work)
WORKTREE_DIR="$HOME/.config/superpowers/worktrees"
# Verify .gitignore
if ! grep -q "\.worktrees" .gitignore; then
echo ".worktrees/" >> .gitignore
git add .gitignore
git commit -m "chore: add .worktrees to gitignore"
fi
# Create directory if needed
mkdir -p "$WORKTREE_DIR"
# Create worktree with new branch
git worktree add "$WORKTREE_DIR/feature-name" -b feature/feature-name
# Or from existing branch
git worktree add "$WORKTREE_DIR/feature-name" feature/feature-name
Auto-detect project type and run setup:
cd "$WORKTREE_DIR/feature-name"
# Node.js
if [ -f "package.json" ]; then
npm install
fi
# Python (Poetry)
if [ -f "pyproject.toml" ]; then
poetry install
fi
# Python (pip)
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
fi
# Go
if [ -f "go.mod" ]; then
go mod download
fi
# Rust
if [ -f "Cargo.toml" ]; then
cargo build
fi
Run tests before declaring ready:
# Run project test suite
npm test # Node.js
pytest # Python
go test ./... # Go
cargo test # Rust
If tests fail:
Worktree ready at: /path/to/worktree
Branch: feature/feature-name
Tests: 47 passing, 0 failing
Ready to implement [feature-name]
git worktree list
# Just cd to the directory
cd .worktrees/feature-name
cd .worktrees/other-feature
# After merging or discarding
git worktree remove .worktrees/feature-name
# Force remove (if unmerged changes)
git worktree remove --force .worktrees/feature-name
# Clean up references to deleted worktrees
git worktree prune
# Setup
git worktree add .worktrees/user-auth -b feature/user-auth
cd .worktrees/user-auth
npm install
npm test # Verify baseline
# Work...
# Complete (after merge)
cd /original/project
git worktree remove .worktrees/user-auth
# Create multiple worktrees
git worktree add .worktrees/feature-a -b feature/feature-a
git worktree add .worktrees/feature-b -b feature/feature-b
# Work on either independently
cd .worktrees/feature-a # Work on A
cd .worktrees/feature-b # Work on B
# They don't interfere with each other
# Already on feature branch in worktree
# Need to do urgent fix on main
git worktree add .worktrees/hotfix -b hotfix/urgent-fix main
cd .worktrees/hotfix
# Fix, test, commit, push
cd ..
git worktree remove .worktrees/hotfix
brainstorming approves a designwriting-plans creates implementation planfinishing-branch for completion workflow