worktree
Skill4 starsChanged 48 days agoMITView on GitHub
Forge's worktree lifecycle. `forge worktree create <slug>` makes an isolated checkout under `.worktrees/`, creates its branch (feat/<slug>), links a kernel issue (`--issue`), and installs dependencies — all in one step; `forge worktree list`/`remove <slug>` manage them; `forge clean` removes worktrees whose branches already merged (squash-aware) and fast-forwards the default branch. Use when the user says "work on this in an isolated branch/worktree", "spin up a worktree", "parallel work on another PR or issue", "clean up merged worktrees", or "why did my worktree miss its dependencies". Footgun it prevents: raw `git worktree add` only creates a branch — it skips the issue link and dep install — so always use `forge worktree create`; and `forge clean` is cwd-scoped, run it from the primary repo root, never inside a worktree. NOT for opening/pushing a PR or the branch (ship), NOT for planning a feature (plan), NOT the stages that create a worktree as one step — this is the worktree lifecycle itself.
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, resolve-conflicts 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
ralphkraussSkillresolve-conflicts
Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.
Also in 5 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
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 repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/permissions-guidance.mdcCursor rule
- claim-safetySkill
- devSkill
- gatesSkill
- hermes-forgeSkill
- issue-basicsSkill
- kernelSkill
- memorySkill
- parallel-deep-researchSkill
- planSkill
- portabilitySkill
- researchSkill
- reviewSkill
- rollbackSkill
- setupSkill
- shepherdSkill
- shipSkill
- smithSkill
- sonarcloud-analysisSkill
- sonarcloudSkill
- statusSkill
- triage-readySkill
- using-forgeSkill
- validateSkill
- verifySkill
- worktreeSkill
- claim-safetySkill
- devSkill
- gatesSkill
- hermes-forgeSkill
- issue-basicsSkill
- kernelSkill
- memorySkill
- parallel-deep-researchSkill
- planSkill
- portabilitySkill
- researchSkill
- reviewSkill
- rollbackSkill
- setupSkill
- shepherdSkill
- shipSkill
- smithSkill
- sonarcloud-analysisSkill
- sonarcloudSkill
- statusSkill
- triage-readySkill
- using-forgeSkill
- validateSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 47 edited versions we read keep these.
0
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 83
cwd-scoped: Run it from the primary repo root, never from inside a .worktrees/<slug> checkout.
“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
Forge worktrees give a task its own isolated checkout so concurrent work never collides on HEAD or a shared branch. Use forge worktree, not raw git worktree add — the Forge command does the extra setup that a bare branch add skips.
Worktree lifecycle
When to use
- "Work on this in an isolated branch / worktree", "spin up a worktree for this".
- Parallel work: a second PR or issue you want to develop without disturbing the current checkout.
- "Clean up the merged worktrees" — reclaim worktrees whose branches already landed.
- Diagnosing "why did my new worktree miss its dependencies / node_modules".
This skill is the worktree lifecycle itself. The plan/ship stages may create a worktree as one internal step, but managing worktrees directly — create, list, remove, clean — is this skill.
Create
forge worktree create <slug>Creates the worktree at .worktrees/<slug> and, in one step:
- creates its branch (default
feat/<slug>), - links a kernel issue to the worktree when
--issue <id>is given (records issue → worktree), - installs dependencies with the repo's detected package manager (bun/pnpm/yarn/npm).
Flags:
| Flag | Purpose |
--branch <name> | Custom branch name (default feat/<slug>). |
--base <ref> | Base ref the new branch forks from (default the repo default branch, e.g. origin/main). |
--issue <id> | Kernel issue id to link this worktree to. |
--work-folder <path> | Repo-relative work-folder this issue owns (drops a .forge-issue marker). |
The kernel issue store lives in the git common dir that every worktree shares, so a new worktree already sees the same kernel — no per-worktree issue-store bootstrap is needed.
The footgun this skill prevents
Never use raw git worktree add for Forge work. It only creates a branch + checkout — it does not link the kernel issue and does not install dependencies. A worktree made that way is why deps end up missing. Always use forge worktree create.
List / remove
forge worktree list # read the worktree registry from the kernel
forge worktree remove <slug> # git worktree remove for that slugClean merged worktrees
forge clean # remove worktrees whose branches merged; FF the default branch
forge clean --dry-run # show what would be removed, change nothingforge clean is squash-aware — it detects branches that merged via squash, not just fast-forward merges. Removing a merged worktree also closes the kernel issue the branch was linked to, citing the merge as evidence.
Two things it will never touch, because closing an issue is irreversible (done is terminal):
- A branch with no commits of its own. A freshly created worktree points at a default-branch commit, which git alone reads as "merged". That is unstarted work — it is kept, and its issue stays open.
- A worktree it skipped. Uncommitted changes hold a worktree back, and a held-back worktree never has its issue closed.
forge clean footguns
- cwd-scoped. Run it from the primary repo root, never from inside a
.worktrees/<slug>checkout. There is no default-branch guard, so a bare run from the wrong place can remove a clean checkout. - Fast-forward the local default branch first so squash-merge detection sees the merged state.
- Windows long paths.
node_modulesinside a worktree can exceed the Windows path limit; ifgit worktree remove --forcede-registers the worktree but the directory lingers, delete it with a PowerShell extended-path (\\?\) remove.
Adjacent skills
- Opening or pushing a PR / the branch →
ship. - Planning a feature (which may create a worktree as a step) →
plan. - Watching an open PR toward merge →
shepherd. - Everyday issue create/update/close →
issue-basics.
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.

