worktree
Skill2 starsChanged 10 days agoMITView on GitHub
Make, provision or remove the linked worktree for a branch, with its databases. Use before code work starts on a branch, before you add a migration, and to tear a worktree down after its merge.
- Reads credentials
59 other projects use a version of this.
Adopted by
Most recently taken up by
- venhdev/skillstheir own version, first seen Nov 8, 2026
- domengabrovsek/agent-configtheir own version, first seen Nov 8, 2026
- domengabrovsek/claudetheir own version, first seen Nov 8, 2026
- kortix-ai/sunatheir own version, first seen Nov 8, 2026
- tardigrde/obsidian-agentic-chattheir own version, first seen Nov 8, 2026
- kortix-ai/CompanyOStheir own version, first seen Nov 8, 2026
Used with
Projects with it also use worktree-merge, e2e 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.
leessjuSkillworktree-merge
Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message.
Also in 3 projects that use this
SentrySkille2e
Run E2E tests for Sentry JavaScript SDK test applications
Also in 5 projects that use this
hdcolaSkillpr-comments
Fetch unresolved review comments from a GitHub PR or mark comments as resolved. Use this when managing PR review feedback, checking pending comments, or marking review threads as resolved. Supports GitHub URLs or explicit owner/repo/PR-number from anywhere, or PR number auto-detection from within a git repository.
Also in 3 projects that use this
Google CloudSkillcontributing
Guides the developer workflow for contributing to Race Condition. Use when setting up pre-commit hooks, running tests before a PR, understanding code style requirements, or preparing a contribution.
Also in 3 projects that use this
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
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
Other versions59 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 59
- Significant-Gravitas/AutoGPT★ 188ksame name
- kortix-ai/suna★ 21ksame name
- kortix-ai/CompanyOS★ 21ksame name
- gitkraken/vscode-gitlens★ 10ksame name
- Zipstack/unstract★ 7.4ksame name
- mistralai/mistral-vibe★ 5.3ksame name
- nubjs/nub★ 4.4ksame name
- raine/workmux★ 3ksame name
- astashov/liftosaur★ 775same name
- nudgebee/nudgebee★ 520same name
49 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 repository22 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 47 edited versions we read keep these.
1
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
- Very specific: line 24
Locate: Read git worktree list --porcelain.
- Distinctive: line 35
Run this from the primary checkout after the branch is merged into the trunk.
“Common” is measured: kept by at least 6 in 10 of the 47 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
A linked worktree gives a branch its own folder and databases. /build uses one when the primary checkout is busy or the plan has a migration. This skill reads git facts only, so a worktree made by this skill, by git worktree add or by another tool resolves the same way.
Branches
| Branch | Made from | Dev database |
fix/<n>-<slug> | the trunk | its own fork |
/build and /diagnose make fix/ branches.
Each worktree also has its own test database. scripts/provision.sh applies these rules.
The trunk is the branch that PRs merge into: the default branch from git symbolic-ref refs/remotes/origin/HEAD, or develop when the repo has both main and develop. When origin/HEAD is missing, use gh repo view --json defaultBranchRef. Do not run git remote set-head, because it changes the repo config.
Make
- Locate. Read
git worktree list --porcelain. When you know only the issue number, match any<type>/<n>-branch in it and ingit branch -abefore you make a new one. Take the case that matches:- A worktree has the branch: use its path, and go on to steps 2 to 4.
- No worktree has it:
git fetch origin, thengit worktree add -b <branch> <primary>/.claude/worktrees/<branch with / as -> <base>.<primary>is the path on the firstworktreeline ofgit worktree list --porcelain. A relative path resolves from the current directory, so a session in another worktree puts the new worktree inside it. Useorigin/<trunk>as the base. When the branch is only on the remote, rungit branch --track <branch> origin/<branch>first. Leave out-bwhen the branch exists. - The primary checkout has the branch: stop and say so. A branch is checked out in one place only.
- Enter.
EnterWorktreeon the worktree path. OnlyEnterWorktreeputs the guard on the session, so never enter withcd. After this, the harness refuses commands that it cannot prove stay in the worktree. This covers every shell command, not only git. Run one plain command per call, from the worktree root, on paths in the worktree. For a subfolder, use a flag such aspnpm --diroruv --directory, because acdstays in effect for the rest of the session. Change a file with the Edit tool, and make a new file with the Write tool. Quote each argument that holds*,[or]. The guard refuses only some other forms, such as a&&chain,$(...)or a heredoc, so a command that ran is no proof that its form is safe. Pass a commit message with one-mflag per paragraph. A message file in the worktree can get committed. - Provision. When
scripts/provision.shexists, run it in the worktree. When it fails, show the end of its output and stop. When it does not exist and the repo has gitignored.envfiles, a lockfile or a database URL, the worktree is not ready. Copy no.envfile by hand. Tell the user to run/setup-skills, and stop.
Completion: the session is in the worktree, and the end of the provision.sh output names the expected dev and test databases, or the repo needs no provisioning. Otherwise the report says blocked: run /setup-skills.
Remove
Run this from the primary checkout after the branch is merged into the trunk.
- Call
EnterWorktreewith the worktree path, and skip the call when the session is already there. Runscripts/provision.sh drop. The script drops the test database and the dev fork. Then callExitWorktreewithkeepto go back to the primary checkout. When the drop fails, show the end of its output and stop. When the user drops the databases by hand, list the databases to confirm that each is gone, and remove any container that the failed drop created. git worktree remove <path>. When it refuses because of uncommitted or untracked files, stop and show them. Keep the files: no--force. The exception is anxcuserdata/folder, which holds only Xcode's window state: delete it, and remove the worktree again.git branch -D <branch>.git worktree prune, for the records of worktrees whose folder is gone.- In a repo with a
.xcodeprojor a.xcworkspace, delete each folder of~/Library/Developer/Xcode/DerivedDatathat belongs to the worktree, because Xcode keeps one for each path. Read its path withplutil -extract WorkspacePath raw <folder>/info.plist.
Completion: git worktree list does not show the path, the branch is gone, and no DerivedData folder names the path.
Report
<path> · <branch> · made | found | removed · dev <db> · test <db>
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.

