Skip to content

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

— (0 ratings) 248.9K downloads obra
$ npx skills add https://github.com/obra/superpowers --skill using-git-worktrees

Skills can run code on your computer. Review the source before installing. This listing is community-made and isn't affiliated with Anthropic.

About this skill

Summary

Isolated git worktrees with smart directory selection and safety verification.

  • Automatically detects worktree directory location by checking existing directories, CLAUDE.md preferences, or asking the user; supports both project-local (.worktrees) and global (~/.config/superpowers/worktrees) storage
  • Verifies project-local directories are git-ignored before creation to prevent accidentally committing worktree contents
  • Auto-detects and runs project setup (npm install, cargo build, pip install, go mod download) based on detected project files
  • Runs baseline tests to ensure a clean starting state before proceeding with feature work
  • Integrates with brainstorming, subagent-driven-development, and plan execution workflows to provide isolated workspaces

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)

Installs: 248.9K | GitHub stars: 329.1K | First seen: Jan 19, 2026

Related skills

New

Agent workflows

find-skills

Helps users discover and install agent skills.

New • 4.6M
New

Agent workflows

agent-browser

Fast, persistent browser automation with session continuity across sequential agent commands.

New • 1.8M
New

Agent workflows

handoff

Summarize conversations into handoff documents for seamless agent-to-agent transitions.

New • 1.2M