/skills:worktreefrom skills
Manages parallel full-repository Git worktrees from a local feature branch, supporting add, integrate, reuse, and remove operations with branch and commit checks.
Ships in skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
For $worktree --help or $worktree -h (including native Claude forms), return concise help and stop before
any workflow step. State the purpose and invocation policy. Show exact usage
for every public action. Describe each public action, positional
argument, and flag in one concise line, including -h, --help; say "No
additional public flags" when there are no others. Use only the documented
public interface. For internal or coordinator-only skills, state that boundary
and that no standalone public workflow action exists. After the selected
SKILL.md is loaded, help is report-only: do not call any additional tools,
inspect project state, or modify files, private state, Git, or external systems.
Never expose private helper actions or flags or treat help as workflow
authorization.
Before workflow reads, load ../global-context-management/references/agent-hosts.md
for selected-home paths, native identity and required runtime setup.
Use $worktree in Codex, /worktree in Claude Code, or
/skills:worktree in the Claude plugin. Dollar-prefixed skill examples
refer to the same named skill on either host; use the native invocation syntax.
Preserve the declared invocation policy, approvals and workflow ownership.
Use available native tools; an unavailable required capability is a blocker,
never permission to bypass a guard or claim unobserved behavior.
Create parallel full-repository child worktrees from the exact current local feature branch, then serialize their proved commits back into that source branch without publishing child branches.
$worktree, $worktree add,
$worktree integrate, or $worktree remove.add, remove, restart,
and active-attempt recovery require a clean primary checkout; only a fresh
integrate may commit eligible primary dirt.$worktree ... command and stop. A recorded next skill, hook
continuation, or internal phase transition is not the fresh explicit user
invocation required to run this skill.$worktree [add] [<task description>] [--project <repo-relative-directory>] [--reuse <exact-name>]
$worktree integrate <generated-worktree-name> [--restart]
$worktree remove <generated-worktree-name>
skills defaults to task slug skills. An empty
normalized basename falls back to work.--project selects an existing starting directory and descriptive label. It
never creates a partial checkout or restricts changed paths. After successful
creation or reuse, that returned directory becomes the operational directory
for subsequent development commands.--reuse and lifecycle actions require the exact generated name.integrate, load $commit before an eligible automatic commit and load
$align for candidate validation. Load the relevant Implement or
Agentic SDLC handoff when that workflow produced the child head.<repo-name>-worktrees/ parent, one generated child branch,
one full linked worktree, branch-associated Git config, and private atomic
ownership state under .worktree-skill/ outside the repository checkout.$commit transactions. A direct
transaction that acquires it first is revalidated before Worktree proceeds;
an existing preparation or reservation for the source ref blocks the direct
transaction. This serializes ownership without sharing or replacing either
workflow's claim schema.$commit, its private integration-commit action binds the
reviewed staged tree, holds the durable preparation claim, runs the exact
normal-hook commit, and records its direct-child/tree proof. Neither layer
fetches for lifecycle decisions, pushes, creates PRs, deletes remote branches,
or writes private workflow state into the repo.From the primary checkout, run the nonmutating preflight: verify the entire
worktree is clean, no Git operation is active, the branch is named and not
configured origin/HEAD, and the sibling parent/state path is canonical and
non-symlinked. The helper repeats this preflight under its lifecycle lock
before creating state or worktree resources.
Resolve the project directory. Derive and pass a task slug when the user
supplied a task description; otherwise omit --task-slug so the helper
derives it from the resolved directory basename. Then run:
python3 <skill-dir>/scripts/worktree_manager.py add \
[--task-slug <public-safe-slug>] [--project <directory>] [--reuse <exact-name>]
Treat the returned source SHA as immutable creation evidence. Return the resolved task slug, generated name, branch, full worktree path, and selected starting directory.
Adopt the returned scope_cwd as the active operational directory for
subsequent development work. Set each tool call's working-directory field to
that exact path, or run cd -- "$scope_cwd" only inside an interactive shell
whose state the agent owns. From that directory, re-observe pwd, the child
branch, exact HEAD, and cleanliness before reporting readiness.
Keep later lifecycle actions anchored to the clean primary checkout. A helper subprocess cannot change its parent process, the agent workspace, or an editor window, so never claim a persistent shell/editor switch unless it is independently observed. Never launch or reopen an editor unless the user explicitly asks.
Run only from the primary checkout on the recorded source branch. Invoke the
read-only preflight, adding --restart only for an explicit restart:
python3 <skill-dir>/scripts/worktree_manager.py integration-preflight \
--name <exact-name> [--restart]
For a fresh commit-required result, inspect both complete checkout diffs
before staging. Stop on conflicts, active Git operations, suspected secrets
or private endpoints, unclear generated files, incoherent changes, nested
lease participation, any reservation, or orphan candidate resources.
Otherwise use delegated $commit in the returned commit_order:
ordinary child first, primary source second. Set the exact checkout as the
working directory, run repo-root git add -A, validate
and inspect the full staged diff, generate a truthful message, and record
the reviewed staged tree with git write-tree.
Return to the primary checkout and create the exact normal-hook commit through the private helper. The first call omits the preparation token; each later call repeats the token returned by preflight or the prior commit:
python3 <skill-dir>/scripts/worktree_manager.py integration-commit \
--name <exact-name> --target <child-or-source> \
--expected-head <pre-commit-sha> \
--expected-tree <reviewed-staged-tree> \
--message <truthful-message> \
[--preparation-token <exact-token>]
The helper atomically claims the source lifecycle before committing and
rechecks lease/reservation/candidate ownership, branch, head, complete
staging, and the reviewed tree. It records one direct-child commit and
compares HEAD^{tree} with the reviewed tree. If a hook changed the commit
tree, inspect the complete actual commit, then bind that exact head/tree with
integration-commit-review --name <exact-name> --target <target> --preparation-token <exact-token> --commit-head <sha> --commit-tree <tree>.
Retain every successful commit if any later step fails; never reset, revert,
amend, or discard it.
Re-observe the same branches, exact direct-child commit transitions, and
complete cleanliness after each commit. Rerun preflight until it returns
ready-clean; do not create a candidate from a blocked or
commit-required result.
Start or resume the exact integration with the clean heads and optional preparation token returned by the final preflight:
python3 <skill-dir>/scripts/worktree_manager.py integrate \
--name <exact-name> \
--expected-source-head <source-sha> \
--expected-child-head <child-sha> \
[--preparation-token <exact-token>] [--restart]
If the helper reports conflict, preserve the returned recovery worktree.
The developer resolves the conflict there and stages the resolution, then
reruns preflight and repeats the exact integration. Never merge or resolve
in the primary or child.
If the helper reports validation-required, bind all checks to the returned
candidate SHA and worktree. Run changed-surface $align, relevant tests,
and any managed Agentic SDLC combined UAT non-mutatingly. If source changes
are required, make and commit them in the child, then restart; do not repair
the candidate outside conflict resolution.
Promote only the exact validated candidate, repeating the exact expected heads returned by the resume preflight:
python3 <skill-dir>/scripts/worktree_manager.py integrate \
--name <exact-name> \
--expected-source-head <source-sha> \
--expected-child-head <child-sha> \
--validated-head <candidate-sha>
If the source moved, preserve the attempt. After review, explicitly use
--restart to abort and remove only the exact owned candidate and rebuild
from the current clean source and child heads. Restart and any active
attempt never auto-commit. If restart instead finds only a commit-preparation
claim, use its exact private integration-preparation-abort action; this
removes no Git commit and preflight must be repeated from the retained heads.
Run from the clean primary checkout with the exact name:
python3 <skill-dir>/scripts/worktree_manager.py remove --name <exact-name>
Permit removal only when the child is unchanged from its base or its exact recorded merge remains reachable from the source branch. Keep any dirty, advanced, rewritten, leased, or unverifiable resource intact.
--reuse preserves an active child and reports source-head drift; it
never rebases or refreshes the child.--reuse.integrate resumes the same durable (source head, child head, candidate ref/path) attempt. A promoted-but-unrecorded candidate reconciles
from Git proof before cleanup. If an interrupted handoff leaves both the
exact preparation and its reservation, a token-bound retry consumes the
preparation before candidate work resumes.remove resumes from remaining exact local resources. Missing
resources are accepted only when the durable manifest proves their identity.WORKFLOW_UPGRADE_REQUIRED; there is no migration or compatibility path.git worktree remove --force, broad prune/GC, reset, rebase,
cherry-pick, force-push, or direct checked-out-ref updates.commit-push/create-pr; state-backed guards
must route to the owning local promotion and integration workflow.--project as a staging or changed-path boundary. Git operations
see the full linked checkout.cd as proof that the parent shell, agent
workspace, or editor changed directories or selected the child branch.add or --reuse.add: a clean child exists on a generated no-upstream branch at the exact
captured local source SHA, and a read-only command run with scope_cwd as its
working directory confirms that child identity.integrate: the source checkout is clean at the exact validated two-parent
merge SHA, durable proof is recorded, and the private candidate is absent.remove: the child worktree, local child ref, and manifest are absent; remote
state is untouched.Integration records exact tree and message intent before committing; retries adopt only that exact merge. Replayed success revalidates current source ancestry and child identity. Removal verifies physical path, registration and ref absence before deleting ownership. Retain mismatches for owner recovery without force.
When using this skill, capture durable, reusable, public-safe learnings in the narrowest appropriate surface only when the task contract allows source edits. For read-only/report-only work, or when a learning is not public-safe, evidence-backed, in scope, or free of unverified/vendor-specific claims, do not edit skill sources; report that it was skipped. Do not capture secrets, private URLs, customer data, raw logs, or one-off local state.
Return the action, resolved task slug, generated name, child/source branches and exact SHAs, worktree/start-directory paths, adopted operational directory, editor-switch status, preflight classification and commit order, every retained automatic commit SHA, candidate or recovery path when applicable, validation status, retained resources, and precise next action.
README.md (opens in a new tab)agents/openai.yaml (opens in a new tab)assets/worker-result.schema.json (opens in a new tab)evals/process-cases.md (opens in a new tab)evals/trigger-prompts.csv (opens in a new tab)references/document-delivery.md (opens in a new tab)references/issue-resolution.md (opens in a new tab)references/lifecycle.md (opens in a new tab)references/worker-waves.md (opens in a new tab)references/workflow-contract.md (opens in a new tab)scripts/git_promotion.py (opens in a new tab)scripts/test-git-promotion.py (opens in a new tab)scripts/test-worktree-manager.py (opens in a new tab)scripts/test_worker_result_cases.py (opens in a new tab)scripts/test_workflow_contracts.py (opens in a new tab)scripts/test_workflow_delivery.py (opens in a new tab)scripts/test_workflow_design_revision.py (opens in a new tab)scripts/test_workflow_dispatch.py (opens in a new tab)scripts/test_workflow_execution.py (opens in a new tab)scripts/test_workflow_fixture.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub nebius/nebius-ps-services --plugin skills75 skills in this plugin
/agent-nebius-auth-diagnoseRead-only diagnosis for current-session Nebius project discovery, agent authentication, quota reads, profiles, selectors, or auth-hook failures. Use when auth is missing/blocked; never mutate auth or IAM./agent-nebius-auth-setupUse only when explicitly invoked to bootstrap or repair current-project Codex Agent Nebius auth: account/tenant access, credentials/profile, repair lease, or separately requested auth hooks./ai-agent-designDesign provider-neutral production AI agent subsystems: behavior and topology, contracts, tools, context, memory, authority, durability, security, evals, and operations. Use ai-stack when AI technology selection remains, design/app-stack for whole products, and implementation skills for code./ai-stackSelect or review undecided AI components across models, runtimes, training/inference, interoperability, retrieval, evals, safety, and operations. Consume ai-agent-design's frozen agent-subsystem contract; use app-stack for non-AI layers, research for one technology, and design for whole solutions./alignAlign a project after changes across code, wiring, tests, CI, CLI/help, config, docs, workflows, and skills, with focused quality gates. Use align-skill for skill-folder-only work./align-skillAlign existing/scaffolded skills for Agent Skills, Codex, Claude Code, and npx skills installation while preserving functionality, native controls, resources, and evals. Accept local or report-only GitHub sources; use skill-creator for new scaffolds and align for projects.