using-git-worktrees
Skill8 starsChanged 6 months agoMITView on GitHub
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
- Installs packages
189 other projects use a version of this, 162 of them edited.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXedited, first seen Nov 9, 2026
- chrysogonus/power-agentsedited, first seen Nov 8, 2026
- roundpilot/superpowers-antigravityedited, first seen Nov 8, 2026
- REPOZY/superpowers-optimizededited, first seen Nov 8, 2026
- lingyired/status-trioedited, first seen Nov 8, 2026
- afawfawffaf/my-skillsedited, first seen Nov 8, 2026
Used with
Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 20 projects that use this
frankxaiSkilldefense-in-depth
Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible
Also in 4 projects that use this
xfstudioSkilltest-fixing
Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.
Also in 3 projects that use this
kntismSkillcondition-based-waiting
Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
Also in 3 projects that use this
- +3 more from Leodorareluctant259
Other versions189 projects use a version of this.
Word for word · 0
None found.
Edited · 162
- obra/superpowers★ 314k24% same
- jnMetaCode/superpowers-zh★ 8.4k18% same
- openai/plugins★ 7.8k24% same
- farm-fe/farm★ 5.6k25% same
- microsoft/FluidFramework★ 4.9k20% same
- lingyired/status-trio★ 1.8k24% same
- pcvelz/superpowers★ 1.3k22% same
- DemonDamon/AgenticX★ 1k73% same
- usewhale/DeepSeek-Code-Whale★ 93325% same
- usewhale/Whale★ 92825% same
152 more not listed
Wrote their own version · 27
- silvertakana/worldwideview★ 1.9ksame name
- GanyuanRan/Aegis★ 1.4ksame name
- Innei/ryugi★ 378same name
- KbWen/agentic-os★ 229same name
- KbWen/agent-virtual-office★ 65same name
- drvoss/everything-copilot-cli★ 48same name
- felvieira/claude-skills-fv★ 27same name
- RBraga01/a-team★ 24same name
- webpro/skills★ 18same name
- osmontero/opencode-skills★ 15same name
17 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- guidance/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- guidance/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- blast-radius-checkSkill
- brainstormingSkill
- branch-flow-gateSkill
- branch-sync-gateSkill
- codebase-reconSkill
- codeowners-drift-auditSkill
- code-review-batterySkill
- cognitive-complexity-refactoringSkill
- debateSkill
- debug-conductorSkill
- dispatching-parallel-agentsSkill
- domain-buildSkill
- evidence-adjudicatorSkill
- executing-plansSkill
- external-cli-auditSkill
- feature-developmentSkill
- field-rename-verificationSkill
- finishing-a-development-branchSkill
- git-branch-conventionsSkill
- gitlab-cliSkill
- hotfix-charterSkill
- implementation-trackerSkill
- incident-revert-reviewSkill
- infra-config-investigatorSkill
- investigation-stateSkill
- kernel-splitSkill
- llm-behavior-investigatorSkill
- llm-skill-reviewSkill
- merge-authorization-gateSkill
- micro-harsh-reviewSkill
- output-verificationSkill
- pre-commit-gateSkill
- progressive-code-review-gateSkill
- progressive-harsh-reviewSkill
- providing-code-reviewSkill
- pr-triage-gateSkill
- push-authorization-gateSkill
- receiving-code-reviewSkill
- reproduction-experiment-investigatorSkill
- requesting-code-reviewSkill
- requirements-validation-pmSkill
- requirements-validationSkill
- scope-tripwireSkill
- session-handoffSkill
- skills-hierarchy-tuningSkill
- sp-bughuntSkill
- state-consistency-investigatorSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- timeline-trace-investigatorSkill
- token-estimationSkill
- unified-commit-gateSkill
- using-superpowersSkill
- verification-before-completionSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 1 is common, 10 are distinctive, and 2 are very specific to this project.
1
Common
Most of the 182 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Do NOT create another; skip to Run Project Setup.
- Very specific: line 61
If you have a native worktree tool (e.g.
- Distinctive: line 68
Follow this priority order:
- Very specific: line 78
If found: Use that directory. If both exist, .worktrees wins.
- Distinctive: line 86
If preference specified: Use it without asking.
- Distinctive: line 90
If no directory exists and no CLAUDE.md preference:
- Distinctive: line 115
Add appropriate line to .gitignore
- Common: line 177
Run tests to ensure worktree starts clean:
- Distinctive: line 223
Create a worktree while already inside one, or beside a native worktree tool
- Distinctive: line 224
Create worktree without verifying it's ignored (project-local)
- Distinctive: line 231
Follow directory priority: existing > CLAUDE.md > ask
- Distinctive: line 232
Verify directory is ignored for project-local
- Distinctive: line 234
Verify clean test baseline
“Common” is measured: kept by at least 6 in 10 of the 182 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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."
When to Use
- Starting feature work that needs isolation from current changes in the working tree
- Executing an implementation plan that spans multiple tasks and branches
- Working on multiple branches of the same repo simultaneously without stash churn
NOT when: the feature is small enough to complete in one session on the current branch.
Step 0: Detect Existing Isolation
Before creating anything:
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)
git rev-parse --show-superproject-working-tree 2>/dev/null # prints a path → submodule, treat as normal repoGIT_DIR != GIT_COMMONand not a submodule → already in a linked worktree. Do NOT create another; skip to Run Project Setup. Report the path and branch, or "detached HEAD, externally managed — branch needed at finish".- Otherwise (normal checkout): honor any declared worktree preference; if none, ask consent first ("Set up an isolated worktree? It protects your current branch."). Declined → work in place, skip to Run Project Setup.
Step 1: Prefer the Harness's Native Tool
If you have a native worktree tool (e.g. EnterWorktree, WorktreeCreate,
a /worktree command, a --worktree flag), use it and skip to Run Project
Setup. git worktree add beside a native tool creates state the harness
cannot see or clean up. Only with no native tool, continue below.
Directory Selection Process
Follow this priority order:
1. Check Existing Directories
# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # AlternativeIf found: Use that directory. If both exist, .worktrees wins.
2. Check CLAUDE.md
grep -i "worktree.*director" CLAUDE.md 2>/dev/nullIf 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:
# Check if directory is ignored (respects local, global, and system gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/nullIf NOT ignored:
Per Jesse's rule "Fix broken things immediately":
- Add appropriate line to .gitignore
- Commit the change
- 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
project=$(basename "$(git rev-parse --show-toplevel)")2. Create Worktree
# Determine full path
global_root="$HOME/.config/superpowers/worktrees"
case "$LOCATION" in
.worktrees|worktrees)
path="$PWD/$LOCATION/$BRANCH_NAME"
;;
"$global_root"|"$global_root"/*|"~/.config/superpowers/worktrees"|"~/.config/superpowers/worktrees/"*)
path="$global_root/$project/$BRANCH_NAME"
;;
*)
printf 'Unsupported worktree location: %s\n' "$LOCATION" >&2
exit 1
;;
esac
# Stop before setup if creation or directory entry fails.
git worktree add "$path" -b "$BRANCH_NAME" || exit
cd "$path" || exit3. Run Project Setup
Auto-detect and run appropriate setup:
# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; fi4. Verify Clean Baseline
Run tests to ensure worktree starts clean:
# Examples - use project-appropriate command
npm test
cargo test
pytest
go 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
| Situation | Action |
.worktrees/ exists | Use it (verify ignored) |
worktrees/ exists | Use it (verify ignored) |
| Both exist | Use .worktrees/ |
| Neither exists | Check CLAUDE.md → Ask user |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |
Common Mistakes
| Mistake | Fix |
| Skipping ignore verification (contents get tracked) | git check-ignore before a project-local worktree |
| Assuming directory location | Priority: existing > CLAUDE.md > ask |
| Proceeding with failing baseline tests | Report failures, get explicit permission |
| Hardcoding setup commands | Auto-detect from project files |
Red Flags
Never:
- Create a worktree while already inside one, or beside a native worktree tool
- 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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

