worktree

A Git worktree setup for keeping each feature change in its own checkout of a project. It adds project settings read by a blocking check that stops edits made in the main checkout.

In plain words
What is it for?
Use it to set up and verify worktree-based development, including a test worktree that builds the project and a handoff for restarting and testing the protection.
Why use it?
It prevents multiple coding sessions or people from overwriting each other’s changes. It also avoids copying separate hook files that could become inconsistent.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/vindm/dotclaude/worktree
Any agent
npx skills add vindm/dotclaude --skill worktree
Clone the repo
git clone --depth 1 https://github.com/vindm/dotclaude

Made for: Claude Code, Codex.

Per session 113 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,803 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00113 $0.02803
Opus 5 $0.00056 $0.01401
Sonnet 5 $0.00023 $0.00561
Haiku 4.5 $0.00011 $0.00280

Measured yesterday against content hash ebb6dd004f22, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

worktree scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/core/skills/worktree/SKILL.md · 209 lines

How it starts

The opening of the file, as written. The whole thing — 209 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/dotclaude:worktree — parallel-session isolation kit

You are setting up worktree-per-feature discipline: every substantive edit to the policed repo happens in a dedicated git worktree, enforced by a blocking PreToolUse hook. Read ../../principles/worktree-discipline.md FIRST — it carries the doctrine and the five hard-won lessons this flow encodes; this file is the procedure.

The hook is CONSUMED, not rendered. The plugin ships one debugged check-main-checkout-edit.sh (in hooks/scripts/, wired always-on) that reads a worktree: block from the project's dotclaude.yml and NO-OPs when there is none. So this flow does NOT copy a hook into the project — it writes the config the consumed hook reads. No per-project hook copy, no drift, and a project tunes its policing in one data file.

The deliverable is not files — it is a proven install: the worktree: config the consumed hook reads correctly, a smoke worktree that built the project for real, and an explicit restart + live-fire handoff.

Phase 1 — Read the project's concurrency shape

Before any question:

  1. Repo topology — is the project root the repo, or does the policed repo sit below it?

    git rev-parse --show-toplevel 2>/dev/null
    for d in */; do git -C "$d" rev-parse --show-toplevel 2>/dev/null; done
    git worktree list 2>/dev/null
    

    Multiple sibling repos → ask which one(s) carry the collision risk (usually the one being actively developed, not read-only references/snapshots).

  2. Parallel-session evidence — lock files (.session_lock, *.lock at repo root), CLAUDE.md sections about session coordination, git history mentions of collisions/clobbered work, scheduled/background agents. This calibrates urgency and whether a lease protocol already exists to narrow.

  3. Git-ignored per-machine files (lesson 2 — the fresh-worktree breakers):

    git -C <repo> status --ignored --porcelain | grep '^!!'
    

    Filter to files/dirs the build actually needs: .env*, config/* pointers, node_modules, credential stores. For each, note the likely recipe: copy a committed *.example template / symlink from main / regenerate / skip.

Read the full file on GitHub · 209 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 209 lines · 113 tokens per session scan A ebb6dd004f22

Subscribe to this mod's changes

worktree is a skill published in the GitHub repository vindm/dotclaude (1 stars, last pushed 5d ago), licensed MIT. It adds 113 tokens to every session and 2,803 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

claude-md-review

Audit a CLAUDE.md file for the patterns that actually degrade Claude Code's output — vagueness, unnamed files, stale facts, and bloat. Use when asked to review, audit, improve, shrink, or fix a CLAUDE.md, and when a project's results feel inconsistent or Claude keeps rediscovering the same context.

wesammustafa/Claude-Code-Everything-You-Need-to-Know · 69 tokens

git-commit-helper

Generate conventional commit messages automatically. Use when user runs git commit, stages changes, or asks for commit message help. Analyzes git diff to create clear, descriptive conventional commit messages. Triggers on git commit, staged changes, commit message requests.

alirezarezvani/claude-code-tresor · 55 tokens

code-reviewer

Automatic code quality and best practices analysis. Use proactively when files are modified, saved, or committed. Analyzes code style, patterns, potential bugs, and security basics. Triggers on file changes, git diff, code edits, quality mentions.

alirezarezvani/claude-code-tresor · 54 tokens

test-generator

Automatically suggest tests for new functions and components. Use when new code is written, functions added, or user mentions testing. Creates test scaffolding with Jest, Vitest, Pytest patterns. Triggers on new functions, components, test requests, testing mentions.

alirezarezvani/claude-code-tresor · 55 tokens

api-documenter

Auto-generate API documentation from code and comments. Use when API endpoints change, or user mentions API docs. Creates OpenAPI/Swagger specs from code. Triggers on API file changes, documentation requests, endpoint additions.

alirezarezvani/claude-code-tresor · 48 tokens

readme-updater

Keep README files current with project changes. Use when project structure changes, features added, or setup instructions modified. Suggests README updates based on code changes. Triggers on significant project changes, new features, dependency changes.

alirezarezvani/claude-code-tresor · 49 tokens