using-git-worktrees — official using-git-worktrees, superpowers, official, ide skills, Claude Code, Cursor, Windsurf

Verified
v1.0.0
GitHub

About this Skill

Perfect for Development Workflow Agents needing isolated Git environments without repository switching. 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

obra obra
[70.9k]
[5444]
Updated: 3/5/2026

Agent Capability Analysis

The using-git-worktrees skill by obra is an open-source official AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Development Workflow Agents needing isolated Git environments without repository switching.

Core Value

Enables agents to create isolated workspaces sharing the same Git repository through systematic directory selection and safety verification processes. Provides reliable branch isolation for concurrent development work while maintaining repository integrity.

Capabilities Granted for using-git-worktrees

Creating isolated feature development environments
Executing implementation plans in separate workspaces
Maintaining multiple concurrent branches without switching
Verifying workspace safety before operations

! Prerequisites & Limits

  • Requires Git repository initialization
  • Depends on proper directory selection priority hierarchy
  • Needs existing worktree directory verification
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

using-git-worktrees

Install using-git-worktrees, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Using Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

Core principle: Systematic directory selection + safety verification = reliable isolation.

Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."

Directory Selection Process

Follow this priority order:

1. Check Existing Directories

bash
1# Check in priority order 2ls -d .worktrees 2>/dev/null # Preferred (hidden) 3ls -d worktrees 2>/dev/null # Alternative

If found: Use that directory. If both exist, .worktrees wins.

2. Check CLAUDE.md

bash
1grep -i "worktree.*director" CLAUDE.md 2>/dev/null

If preference specified: Use it without asking.

3. Ask User

If no directory exists and no CLAUDE.md preference:

No worktree directory found. Where should I create worktrees?

1. .worktrees/ (project-local, hidden)
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)

Which would you prefer?

Safety Verification

For Project-Local Directories (.worktrees or worktrees)

MUST verify directory is ignored before creating worktree:

bash
1# Check if directory is ignored (respects local, global, and system gitignore) 2git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored:

Per Jesse's rule "Fix broken things immediately":

  1. Add appropriate line to .gitignore
  2. Commit the change
  3. Proceed with worktree creation

Why critical: Prevents accidentally committing worktree contents to repository.

For Global Directory (~/.config/superpowers/worktrees)

No .gitignore verification needed - outside project entirely.

Creation Steps

1. Detect Project Name

bash
1project=$(basename "$(git rev-parse --show-toplevel)")

2. Create Worktree

bash
1# Determine full path 2case $LOCATION in 3 .worktrees|worktrees) 4 path="$LOCATION/$BRANCH_NAME" 5 ;; 6 ~/.config/superpowers/worktrees/*) 7 path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME" 8 ;; 9esac 10 11# Create worktree with new branch 12git worktree add "$path" -b "$BRANCH_NAME" 13cd "$path"

3. Run Project Setup

Auto-detect and run appropriate setup:

bash
1# Node.js 2if [ -f package.json ]; then npm install; fi 3 4# Rust 5if [ -f Cargo.toml ]; then cargo build; fi 6 7# Python 8if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 9if [ -f pyproject.toml ]; then poetry install; fi 10 11# Go 12if [ -f go.mod ]; then go mod download; fi

4. Verify Clean Baseline

Run tests to ensure worktree starts clean:

bash
1# Examples - use project-appropriate command 2npm test 3cargo test 4pytest 5go test ./...

If tests fail: Report failures, ask whether to proceed or investigate.

If tests pass: Report ready.

5. Report Location

Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to implement <feature-name>

Quick Reference

SituationAction
.worktrees/ existsUse it (verify ignored)
worktrees/ existsUse it (verify ignored)
Both existUse .worktrees/
Neither existsCheck CLAUDE.md → Ask user
Directory not ignoredAdd to .gitignore + commit
Tests fail during baselineReport failures + ask
No package.json/Cargo.tomlSkip dependency install

Common Mistakes

Skipping ignore verification

  • Problem: Worktree contents get tracked, pollute git status
  • Fix: Always use git check-ignore before creating project-local worktree

Assuming directory location

  • Problem: Creates inconsistency, violates project conventions
  • Fix: Follow priority: existing > CLAUDE.md > ask

Proceeding with failing tests

  • Problem: Can't distinguish new bugs from pre-existing issues
  • Fix: Report failures, get explicit permission to proceed

Hardcoding setup commands

  • Problem: Breaks on projects using different tools
  • Fix: Auto-detect from project files (package.json, etc.)

Example Workflow

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/jesse/myproject/.worktrees/auth
Tests passing (47 tests, 0 failures)
Ready to implement auth feature

Red Flags

Never:

  • Create worktree without verifying it's ignored (project-local)
  • Skip baseline test verification
  • Proceed with failing tests without asking
  • Assume directory location when ambiguous
  • Skip CLAUDE.md check

Always:

  • Follow directory priority: existing > CLAUDE.md > ask
  • Verify directory is ignored for project-local
  • Auto-detect and run project setup
  • Verify clean test baseline

Integration

Called by:

  • brainstorming (Phase 4) - REQUIRED when design is approved and implementation follows
  • subagent-driven-development - REQUIRED before executing any tasks
  • executing-plans - REQUIRED before executing any tasks
  • Any skill needing isolated workspace

Pairs with:

  • finishing-a-development-branch - REQUIRED for cleanup after work complete

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is using-git-worktrees?

Perfect for Development Workflow Agents needing isolated Git environments without repository switching. 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

How do I install using-git-worktrees?

Run the command: npx killer-skills add obra/superpowers/using-git-worktrees. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for using-git-worktrees?

Key use cases include: Creating isolated feature development environments, Executing implementation plans in separate workspaces, Maintaining multiple concurrent branches without switching, Verifying workspace safety before operations.

Which IDEs are compatible with using-git-worktrees?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for using-git-worktrees?

Requires Git repository initialization. Depends on proper directory selection priority hierarchy. Needs existing worktree directory verification.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add obra/superpowers/using-git-worktrees. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use using-git-worktrees immediately in the current project.

Related Skills

Looking for an alternative to using-git-worktrees or another official skill for your workflow? Explore these related open-source skills.

View All

flags

Logo of facebook
facebook

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

243.6k
0
Developer

extract-errors

Logo of facebook
facebook

Use when adding new error messages to React, or seeing unknown error code warnings.

243.6k
0
Developer

fix

Logo of facebook
facebook

Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.

243.6k
0
Developer

flow

Logo of facebook
facebook

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

243.6k
0
Developer