Establish or reuse an isolated Git worktree for new work or a named branch, PR, tag, or commit. Use whenever the user asks to create or enter a worktree or separate Git checkout, wants parallel work without disturbing the current checkout, or another workflow requires Git checkout isolation.
70
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Keep work isolated without disturbing the user's primary checkout. Isolation often already exists because a coding harness created it before the session began, so detect before creating anything.
This file owns the common workflow: choose the mode -> detect existing isolation -> either reuse and finish here, or route once and finish in the selected environment document.
Every terminal path reports:
Workspace: <absolute-path | not created>
Mode: <new work | existing ref>
State: <branch-name | detached HEAD at commit | unavailable>
Source: <existing isolation | Claude Code | native harness | git>
Status: <ready | blocked: concise reason>When blocked, quote the shortest decisive error and state the exact user decision needed. Do not claim readiness or silently continue in a different checkout.
Choose from the caller's request:
Mode changes what gets checked out. Detection, routing, and reporting stay the same.
Resolve both Git directories to absolute paths before comparing them. Raw git rev-parse output may mix absolute and relative forms when invoked from a subdirectory.
git rev-parse --absolute-git-dir
(cd "$(git rev-parse --git-common-dir)" && pwd -P)git rev-parse --show-superproject-working-treeWhen reusing existing isolation, record its path and state. In new-work mode, continue there. In existing-ref mode, align this worktree to the requested ref unless it is already aligned. If another worktree owns the requested branch, report blocked with that path, request the caller's choice, and stop.
Verify the reused workspace:
git rev-parse --show-toplevel
git branch --show-current
git rev-parse HEADReport with source existing isolation and stop. Do not continue to Step 2.
Route only when Step 1 found a normal checkout. Read one document fully and follow it through its terminal report:
EnterWorktree: read claude-code.md.harness-native.md.git-only.md.Do not load the other documents or return to this file.
a6a5aba
Also appears in
since Sep 6, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.