git-worktrees
Skill229 starsChanged 10 months agoMITView on GitHub
Create isolated git workspaces for feature development. Smart directory selection, safety verification, and cross-platform support (Windows/Unix).
- Installs packages
12 other projects use a version of this.
Adopted by
Most recently taken up by
- choegyumin/agent-skillstheir own version, first seen Sep 19, 2026
- nafeeur/MaskShifttheir own version, first seen Sep 12, 2026
- KhaledSaeed18/dotclaudetheir own version, first seen Jul 4, 2026
- tomimor/skillstheir own version, first seen Jun 26, 2026
- itallstartedwithaidea/claude-googleadsagenttheir own version, first seen May 21, 2026
- sergeeey/Claude-cod-top-2026their own version, first seen May 13, 2026
Used with
Projects with it also use workflow-orchestration, data-analysis and 9 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.
shyamsridhar123Skillworkflow-orchestration
Build multi-agent workflows and graph-based orchestration using Microsoft Agent Framework. Use this skill when creating agent pipelines, connecting multiple agents, implementing human-in-the-loop patterns, streaming, checkpointing, or time-travel debugging.
Also in 3 projects that use this
shanggqmSkilldata-analysis
数据分析技能,提供结构化的数据查询、统计分析和报告生成工作流。当用户需要查询数据库、进行数据统计分析、生成分析报告时使用。按规范输出原始数据、计算结果、Markdown报告和HTML可视化报告。
Also in 4 projects that use this
mrgoonieSkillcontext-engineering
Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques (compaction, masking, caching), compression strategies, memory architectures, multi-agent patterns, LLM-as-Judge evaluation, tool design, and project development.
Also in 4 projects that use this
OpenAISkillobservability
Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.
Also in 3 projects that use this
OpenAISkillexecuting-plans
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Also in 4 projects that use this
ElasticSkillcreate-skill
Interactively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.
Also in 3 projects that use this
- +4 more from openai
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- NeoLabHQ/context-engineering-kit★ 1.7ksame name
- jamesrochabrun/skills★ 214same name
- itallstartedwithaidea/agent-skills★ 39same name
- CarbeneAI/Forge★ 9same name
- sergeeey/Claude-cod-top-2026★ 9same name
- KhaledSaeed18/dotclaude★ 5same name
- vikisingh23/neuraforge-ai★ 4same name
- itallstartedwithaidea/claude-googleadsagent★ 2same name
- nafeeur/MaskShift★ 2same name
- tomimor/skills★ 2same name
2 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 repository12 other files it gives its agents.
- maestroSkill
- backend-designSkill
- brainstormingSkill
- browser-extensionSkill
- clean-codeSkill
- debug-masterySkill
- frontend-designSkill
- optimization-masterySkill
- planning-masterySkill
- ralph-wiggumSkill
- tdd-masterySkill
- verification-masterySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. 0 are common, 20 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
20
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Test in isolation without affecting main workspace
- Distinctive: line 18
Run long processes without blocking other work
- Distinctive: line 34
Follow this priority order:
- Very specific: line 46
If found: Use that directory. If both exist, .worktrees wins.
- Distinctive: line 51
If preference specified: Use it without asking.
- Distinctive: line 53
If no directory exists and no CLAUDE.md preference:
- Distinctive: line 77
Add appropriate line to .gitignore
- Distinctive: line 152
Run tests to ensure worktree starts clean:
- Distinctive: line 182
When feature work is complete:
- Distinctive: line 202
Fix: Always use git check-ignore before creating project-local worktree
- Distinctive: line 205
Fix: Follow priority: existing > CLAUDE.md > ask
- Distinctive: line 214
Fix: Remove worktree when feature is merged ---
- Distinctive: line 232
Create worktree without verifying it's ignored (project-local)
- Distinctive: line 238
Follow directory priority: existing > CLAUDE.md > ask
- Distinctive: line 239
Verify directory is ignored for project-local
- Distinctive: line 241
Verify clean test baseline
- Distinctive: line 254
When Ralph Wiggum is active:
- Distinctive: line 255
Before first iteration: Create worktree for isolated work
- Distinctive: line 256
During iterations: All work happens in worktree
- Distinctive: line 258
Cleanup: Remove worktree after merge ---
- Distinctive: line 263
@verification-mastery: - Verify before finishing branch </audit_and_reference>
“Common” is measured: kept by at least 6 in 10 of the 12 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
<domain_overview>
🌳 GIT WORKTREES: ISOLATED WORKSPACES
Philosophy: Isolation prevents contamination. Work on features without affecting the main workspace. Systematic directory selection + safety verification = reliable isolation. ISOLATION INTEGRITY MANDATE (CRITICAL): Never create worktrees in directories that are not explicitly ignored by Git. AI-generated workflows often fail by polluting the primary repository with tracked worktree data. You MUST verify that the destination directory is within
.gitignorebefore execution. Furthermore, you MUST ensure a 'Clean Baseline' by running tests before starting any feature work in a new worktree to avoid cross-contamination of artifacts. </domain_overview>
<directory_selection>
🎯 OVERVIEW
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. Benefits:
- Work on feature branch without stashing changes
- Test in isolation without affecting main workspace
- Run long processes without blocking other work
- Easy cleanup when feature is complete
📋 WHEN TO USE
Use before:
- Starting new feature development
- Implementing plans from
@planning-mastery - Making experimental changes
- Working on multiple features in parallel Skip for:
- Quick bug fixes on current branch
- Documentation updates
- Configuration changes
📁 DIRECTORY SELECTION PROCESS
Follow this priority order:
1. Check Existing Directories
Unix/macOS:
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # AlternativeWindows (PowerShell):
if (Test-Path ".worktrees") { ".worktrees" }
elseif (Test-Path "worktrees") { "worktrees" }If 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. %USERPROFILE%\.config\maestro\worktrees\<project>\ (global location)
Which would you prefer?</directory_selection> <safety_verification>
🔒 SAFETY VERIFICATION
For Project-Local Directories
MUST verify directory is ignored before creating worktree: Unix/macOS:
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/nullWindows (PowerShell):
git check-ignore -q .worktrees 2>$null
if ($LASTEXITCODE -ne 0) {
git check-ignore -q worktrees 2>$null
}If NOT ignored:
- Add appropriate line to .gitignore
- Commit the change
- Proceed with worktree creation Why critical: Prevents accidentally committing worktree contents to repository.
For Global Directory
No .gitignore verification needed - outside project entirely. </safety_verification> <creation_and_setup>
🔨 CREATION STEPS
1. Detect Project Name
Unix/macOS:
project=$(basename "$(git rev-parse --show-toplevel)")Windows (PowerShell):
$project = Split-Path -Leaf (git rev-parse --show-toplevel)2. Create Worktree
Unix/macOS:
# Project-local
path=".worktrees/$BRANCH_NAME"
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
# Or global
path="$HOME/.config/maestro/worktrees/$project/$BRANCH_NAME"
mkdir -p "$(dirname "$path")"
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"Windows (PowerShell):
# Project-local
$path = ".worktrees\$BRANCH_NAME"
git worktree add $path -b $BRANCH_NAME
Set-Location $path
# Or global
$path = "$env:USERPROFILE\.config\maestro\worktrees\$project\$BRANCH_NAME"
New-Item -ItemType Directory -Force -Path (Split-Path $path)
git worktree add $path -b $BRANCH_NAME
Set-Location $path3. Run Project Setup
Auto-detect and run appropriate setup: Cross-platform:
# Node.js
if [ -f package.json ]; then npm install; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Go
if [ -f go.mod ]; then go mod download; fiWindows (PowerShell):
# Node.js
if (Test-Path "package.json") { npm install }
# Python
if (Test-Path "requirements.txt") { pip install -r requirements.txt }
if (Test-Path "pyproject.toml") { poetry install }
# Rust
if (Test-Path "Cargo.toml") { cargo build }
# Go
if (Test-Path "go.mod") { go mod download }4. Verify Clean Baseline
Run tests to ensure worktree starts clean:
# Use project-appropriate command
npm test
pytest
cargo test
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></creation_and_setup> <audit_and_reference>
📊 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 |
🧹 CLEANUP
When feature work is complete: List worktrees:
git worktree listRemove worktree:
git worktree remove .worktrees/feature-name
# or force if uncommitted changes
git worktree remove --force .worktrees/feature-namePrune stale entries:
git worktree prune🚫 COMMON MISTAKES
Skipping ignore verification
- Problem: Worktree contents get tracked, pollute git status
- Fix: Always use
git check-ignorebefore creating project-local worktree
- Fix: Always use
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.)
Forgetting to cleanup
- Problem: Disk space consumed, stale branches accumulate
- Fix: Remove worktree when feature is merged
📝 EXAMPLE WORKFLOW
You: I'm using the 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 C:\Users\Dev\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
- Report full path when done
🔗 INTEGRATION
Called by:
@brainstorming- After design approved, before implementation@planning-mastery- When executing plan
Pairs with:
@planning-mastery- Work happens in this worktree@tdd-mastery- Implementation methodology@verification-mastery- Complete development after all tasks
🔗 RALPH WIGGUM INTEGRATION
When Ralph Wiggum is active:
- Before first iteration: Create worktree for isolated work
- During iterations: All work happens in worktree
- After completion: Merge or create PR from worktree
- Cleanup: Remove worktree after merge
🔗 RELATED SKILLS
- @brainstorming - Design before worktree creation
- @planning-mastery - Plan to execute in worktree
- @verification-mastery - Verify before finishing branch </audit_and_reference>
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.

