worktree
Skill1 starsChanged 8 months agoMITView on GitHub
Isolate parallel, independent tasks in separate git worktrees so they never overwrite each other — each task gets its own working directory and branch. Use when juggling multiple unrelated changes at once, or when the user says 'work on this in parallel', 'spin up a worktree', 'isolate this task'. Usage: /worktree [create <task> | list | remove <task> | clean]
40 other projects use a version of this.
Adopted by
Most recently taken up by
- Significant-Gravitas/AutoGPTtheir own version, first seen Nov 18, 2026
- kortix-ai/sunatheir own version, first seen Oct 5, 2026
- ShalomPrinz/go2-dispatchertheir own version, first seen Oct 4, 2026
- jantichy/claudetheir own version, first seen Oct 2, 2026
- domengabrovsek/agent-configtheir own version, first seen Oct 2, 2026
- craigcossairt/trellistheir own version, first seen Oct 1, 2026
Used with
Projects with it also use coverage, backlog 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.
PydanticSkillcoverage
Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.
Also in 3 projects that use this
vertz-devSkillbacklog
Manages deferred/blocked work items as GitHub Issues with labels and blocker tracking
Also in 3 projects that use this
johnlindquistSkilldiagram
Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.
Also in 4 projects that use this
SentrySkille2e
Run E2E tests for Sentry JavaScript SDK test applications
Also in 3 projects that use this
nicolasestremSkillcleanup
Clean up code, remove dead code, and optimize project structure
Also in 3 projects that use this
MongoDBSkilljira
Use this skill for any Jira operation in the DOCSP project — creating, viewing, searching, updating, transitioning, commenting on, or linking tickets. Also handles follow-up ticket creation to manage scope creep. TRIGGER when: user mentions a DOCSP-XXXXX ticket number or any Jira ticket URL; user asks to view, open, check, update, transition, close, comment on, link, or search tickets; user references \"the ticket\", \"the Jira\", or \"open a ticket\". SKIP: GitHub issues; non-Jira platforms; questions unrelated to ticket operations.
Also in 3 projects that use this
Other versions40 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 40
- Significant-Gravitas/AutoGPT★ 188ksame name
- kortix-ai/suna★ 20ksame name
- Zipstack/unstract★ 7.3ksame name
- mistralai/mistral-vibe★ 5ksame name
- nudgebee/nudgebee★ 398same name
- microsoft/service-fabric-dotnet★ 277same name
- murray17/rovai-ai★ 122same name
- forrestchang/worktree-workflow★ 108same name
- Rune-kit/rune★ 88same name
- oprogramadorreal/optimus-claude★ 75same name
30 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 repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- commit-push-prSkill
- decideSkill
- discussSkill
- learnSkill
- mediocreSkill
- researchSkill
- sidetrackSkill
- tidy-permissionsSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 35 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this when you have multiple unrelated changes in flight (feature A, bugfix B, experiment C) and they must stay isolated.
- Distinctive: line 28
Create the worktree on a fresh branch off the up-to-date base:
- Very specific: line 33
If the branch already exists, drop -b and check it out instead.
- Very specific: line 37
Run git worktree list and present each worktree with its branch and a one-line status (clean / N uncommitted files via git -C <path> status …
- Very specific: line 40
Check the worktree is clean (git -C <path> status --short).
- Very specific: line 45
Run git worktree prune to clear stale administrative entries (worktrees whose directories were deleted manually), then list the survivors.
- Very specific: line 53
Never overwrite uncommitted work: Before any remove or --force, surface dirty state and get a decision.
- Distinctive: line 55
One task = one branch = one worktree: Don't reuse a branch across worktrees.
“Common” is measured: kept by at least 6 in 10 of the 35 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
Worktree — Isolate Parallel Tasks
Git worktrees let one repository have multiple working directories checked out at once, each on its own branch. This is the clean way to work on several independent tasks in parallel: changes in one never touch another, no stashing, no branch-switching churn, no half-finished edits bleeding across tasks.
Use this when you have multiple unrelated changes in flight (feature A, bugfix B, experiment C) and they must stay isolated.
Conventions
- Location: worktrees live in a sibling directory
../<repo>-worktrees/<task-slug>— outside the main checkout so they never nest inside it, never get caught by its.gitignore, and never confuse tooling. - Branch per task: each worktree is on its own branch named
<task-slug>, created off the repo's base branch (read it from CLAUDE.md; fall back to the default branch fromgit symbolic-ref refs/remotes/origin/HEAD). - Task slug: short kebab-case derived from the task (e.g. "fix login redirect" →
fix-login-redirect). - One branch, one worktree: git refuses to check out the same branch in two worktrees — lean on that as the anti-overwrite guarantee.
Process
First read the target project's CLAUDE.md for the base/PR branch convention. Then dispatch on the argument:
create <task> (default action)
- Resolve the repo root:
git rev-parse --show-topleveland its name. - Resolve the base branch (CLAUDE.md convention → else
git remote show origindefault). - Slugify
<task>→<task-slug>. - Create the worktree on a fresh branch off the up-to-date base:
If the branch already exists, dropgit fetch origin <base> --quiet git worktree add ../<repo>-worktrees/<task-slug> -b <task-slug> origin/<base>-band check it out instead. - Report the absolute path and tell the user how to enter it:
cd <path>— and that they can open a separate Claude Code session there so each task has its own isolated context.
list
Run git worktree list and present each worktree with its branch and a one-line status (clean / N uncommitted files via git -C <path> status --short). Flag any whose branch is already merged into base as safe to remove.
remove <task>
- Check the worktree is clean (
git -C <path> status --short). If dirty, stop and warn — show the uncommitted changes, ask whether to commit, stash, or discard before removing. Never silently throw away work. git worktree remove ../<repo>-worktrees/<task-slug>(add--forceonly after explicit user confirmation).- Offer to delete the branch if it's fully merged:
git branch -d <task-slug>.
clean
Run git worktree prune to clear stale administrative entries (worktrees whose directories were deleted manually), then list the survivors. Identify merged-branch worktrees and offer to remove them in a batch after confirmation.
Parallel agents
For parallel work driven by Claude itself rather than separate human sessions, the Agent tool's isolation: "worktree" option runs each subagent in its own throwaway worktree — same isolation guarantee, auto-cleaned. Mention this when the user wants Claude to fan out edits across tasks concurrently rather than manage long-lived worktrees by hand.
Rules
- Never overwrite uncommitted work. Before any
removeor--force, surface dirty state and get a decision. This is the whole point of the skill. - Keep worktrees outside the main checkout — always the sibling
../<repo>-worktrees/dir, never a subdir of the repo. - One task = one branch = one worktree. Don't reuse a branch across worktrees; don't pile unrelated changes into one worktree.
- Branch off an up-to-date base — fetch before creating so parallel tasks don't diverge from a stale point.
- Be project-agnostic — detect repo name, root, and base branch dynamically; never hardcode paths.
- Show before destroying — list what will be removed and confirm before deleting worktrees or branches.
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.

