.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/superpowers/using-git-worktrees
home/skills/obra/superpowers/using-git-worktrees
obra avatar

using-git-worktrees

byobra· 95 skills

Installs

149k

Stars

261k

Forks

23k

Category

DevOps & CI/CD

View on GitHub

TL;DR

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback

How to install using-git-worktrees?

obra/superpowers/using-git-worktrees
$npx -y skills add obra/superpowers --skill using-git-worktrees

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Use this skill

Run `npx skills use "https://github.com/obra/superpowers" --skill "obra/superpowers/using-git-worktrees"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.

Use the whole pack

Use the skills in "https://github.com/obra/superpowers" that are relevant to the current task. Run `npx skills add "https://github.com/obra/superpowers"` and select the relevant skills, then follow their instructions.

Files · 1

View on GitHub
SKILL.md
1# Using Git Worktrees
2 
3## Overview
4 
5Ensure 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.
6 
7**Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
8 
9**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
10 
11## Step 0: Detect Existing Isolation
12 
13**Before creating anything, check if you are already in an isolated workspace.**
14 
15```bash
16GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
17GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
18BRANCH=$(git branch --show-current)
19```
20 
21**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:
22 
23```bash
24# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
25git rev-parse --show-superproject-working-tree 2>/dev/null
26```
27 
28**If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.
29 
30Report with branch state:
31- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
32- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
33 
34**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
35 
36Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
37 
38> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
39 
40Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 2.
41 
42## Step 1: Create Isolated Workspace
43 
44**You have two mechanisms. Try them in this order.**
45 
46### 1a. Native Worktree Tools (preferred)
47 
48The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 2.
49 
50Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
51 
52Only proceed to Step 1b if you have no native worktree tool available.
53 
54### 1b. Git Worktree Fallback
55 
56**Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
57 
58#### Directory Selection
59 
60Follow this priority order. Explicit user preference always beats observed filesystem state.
61 
621. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
63 
642. **Check for an existing project-local worktree directory:**
65 ```bash
66 ls -d .worktrees 2>/dev/null # Preferred (hidden)
67 ls -d worktrees 2>/dev/null # Alternative
68 ```
69 If found, use it. If both exist, `.worktrees` wins.
70 
713. **If there is no other guidance available**, default to `.worktrees/` at the project root.
72 
73#### Safety Verification (project-local directories only)
74 
75**MUST verify directory is ignored before creating worktree:**
76 
77```bash
78git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
79```
80 
81**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
82 
83**Why critical:** Prevents accidentally committing worktree contents to repository.
84 
85#### Create the Worktree
86 
87```bash
88# Determine path based on chosen location
89path="$LOCATION/$BRANCH_NAME"
90 
91git worktree add "$path" -b "$BRANCH_NAME"
92cd "$path"
93```
94 
95**Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
96 
97## Step 2: Project Setup
98 
99Auto-detect and run appropriate setup:
100 
101```bash
102# Node.js
103if [ -f package.json ]; then npm install; fi
104 
105# Rust
106if [ -f Cargo.toml ]; then cargo build; fi
107 
108# Python
109if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
110if [ -f pyproject.toml ]; then poetry install; fi
111 
112# Go
113if [ -f go.mod ]; then go mod download; fi
114```
115 
116## Step 3: Verify Clean Baseline
117 
118Run tests to ensure workspace starts clean:
119 
120```bash
121# Use project-appropriate command
122npm test / cargo test / pytest / go test ./...
123```
124 
125**If tests fail:** Report failures, ask whether to proceed or investigate.
126 
127**If tests pass:** Report ready.
128 
129### Report
130 
131```
132Worktree ready at <full-path>
133Tests passing (<N> tests, 0 failures)
134Ready to implement <feature-name>
135```
136 
137## Quick Reference
138 
139| Situation | Action |
140|-----------|--------|
141| Already in linked worktree | Skip creation (Step 0) |
142| In a submodule | Treat as normal repo (Step 0 guard) |
143| Native worktree tool available | Use it (Step 1a) |
144| No native tool | Git worktree fallback (Step 1b) |
145| `.worktrees/` exists | Use it (verify ignored) |
146| `worktrees/` exists | Use it (verify ignored) |
147| Both exist | Use `.worktrees/` |
148| Neither exists | Check instruction file, then default `.worktrees/` |
149| Directory not ignored | Add to .gitignore + commit |
150| Permission error on create | Sandbox fallback, work in place |
151| Tests fail during baseline | Report failures + ask |
152| No package.json/Cargo.toml | Skip dependency install |
153 
154## Common Rationalizations
155 
156| Excuse | Reality |
157|--------|---------|
158| "I'm obviously not in a worktree — no need to check" | Run Step 0. Harness-created isolation and submodules both fool eyeballing; the detection commands settle it. |
159| "`git worktree add` is quicker than hunting for a native tool" | A native tool (e.g. `EnterWorktree`) owns placement, branching, and cleanup. Bypassing it is the #1 mistake — it creates phantom state your harness can't see or manage. |
160| "The worktree directory is surely ignored already" | Run `git check-ignore`. An unignored worktree directory commits the whole tree into the repo. |
161| "Any directory name works" | Explicit instructions beat an existing project-local directory, which beats the `.worktrees/` default. |
162| "The workspace is fresh — baseline tests can wait" | A dirty baseline makes every later failure ambiguous. Run the tests now; proceeding past failures is your human partner's call. |

Security

Review

  • Gen Agent Trust Hubpass
  • Socketpass
  • Snykwarn
  • Runlayerpass
  • ZeroLeakspass

Preview

obra/superpowersobra/superpowers

$ npx -y skills add obra/superpowers --skill using-git-worktrees

▸ installing to .claude/skills…

✓ using-git-worktrees ready

Repoobra/superpowers
TypeSkills
CategoryDevOps & CI/CD
ForDeveloperOps
UpdatedJul 2026
License—
First seenJul 26, 2026

Tags

Skill

Related

6 picks
Type
  1. mattpocock avatarsetup-matt-pocock-skillsConfigure this repo for the engineering skills — set up its issue tracker, triage label vocabulary, and domain doc layout.SkillsJul 2026495k189k
  2. microsoft avatarmicrosoft-foundryDeploy, evaluate, fine-tune, and manage Foundry agents end-to-end with azd: hosted agent scaffold/run/deploy, prompt agent create, batch eval, continuous eval,…SkillsJul 2026490k1.3k
  3. microsoft avatarazure-deployExecute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files.SkillsJul 2026485k1.3k
  4. microsoft avatarazure-preparePrepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd)…SkillsJul 2026485k1.3k
  5. microsoft avatarazure-validatePre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity…SkillsJul 2026484k1.3k
  6. microsoft avatarazure-aigatewayConfigure Azure API Management as an AI Gateway for AI models, MCP tools, and agents.SkillsJul 2026484k1.3k