git-worktrees

git-worktrees is a skill for Claude Code from christopherlouet/claude-base. It costs 33 tokens per session (514 once invoked), scanned A, original, MIT.

A guide for Git worktrees, which let you check out multiple branches in separate directories at the same time.

In plain words
What is it for?
Use it to create, configure, list, remove, and clean up worktrees, including isolated background work and monorepo file selection.
Why use it?
It keeps parallel tasks isolated so different branches or agents can be worked on without constantly switching the main working directory.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is git worktree add ../myapp-feature-auth -b feature/auth.

Good fit Use it to create, configure, list, remove, and clean up worktrees, including isolated background work and monorepo file selection.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/christopherlouet/claude-base
agentmods
npx agentmods add skills/christopherlouet/claude-base/git-worktrees

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-worktrees

README.md
[![agentmods](https://agentmods.dev/badge/skills/christopherlouet/claude-base/git-worktrees/github.svg)](https://agentmods.dev/skills/christopherlouet/claude-base/git-worktrees)
Your own site
<a href="https://agentmods.dev/skills/christopherlouet/claude-base/git-worktrees"><img src="https://agentmods.dev/badge/skills/christopherlouet/claude-base/git-worktrees/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-worktrees

Your own site · 80×15
<a href="https://agentmods.dev/skills/christopherlouet/claude-base/git-worktrees"><img src="https://agentmods.dev/badge/skills/christopherlouet/claude-base/git-worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 514 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00033 $0.00514
Opus 5.5 $0.00013 $0.00206
Sonnet 5.5 $0.00007 $0.00103
Haiku 4.5 $0.00003 $0.00051

Measured 29d ago against content hash d77c1c0a5c9b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

git-worktrees 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 29d ago.

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.

.claude/skills/git-worktrees/SKILL.md · 40 lines

What it actually says

Git Worktrees (pointer)

"The single biggest productivity unlock." — Boris Cherny, creator of Claude Code

Generic worktree mechanics (git worktree add/list/remove/prune, branch isolation, hooks sharing) are canonical at git-scm.com/docs/git-worktree. This skill scopes to Claude-Code-specific worktree integration — what isn't in the git docs.

Claude Code worktree settings (CLI 2.1.76+ / 2.1.141+)

Three settings in .claude/settings.json shape how Claude Code uses worktrees:

Setting Values Purpose
worktree.sparsePaths array of globs Limit which files a worktree includes — speeds up monorepo operations and narrows Claude's exploration context
worktree.bgIsolation "auto" (default) / "none" Background sessions/agents default to writing into .claude/worktrees/; "none" lets them edit the working copy directly
worktree.baseRef "fresh" / "head" "fresh" branches new worktrees from origin/<default>, "head" from local HEAD (inherits in-progress local commits)

Both bgIsolation and baseRef apply to --worktree, the EnterWorktree tool, and agent-isolation worktrees.

Named-session pairing pattern

The foundation-specific workflow is 1 worktree = 1 branch = 1 named Claude session:

git worktree add ../myapp-feature-auth -b feature/auth
cd ../myapp-feature-auth && claude -n "auth"

The --name/-n flag tags the session for logs and terminal identification. Combined with worktrees this lets you run 5+ Claude Code sessions in parallel without state collision — see the "Parallel Sessions" section in CLAUDE.md.

See also

  • /work:work-explore — dedicate an analysis worktree to read-only exploration
  • session-handoff skill — transfer context across worktrees
  • parallel-agents / agent-teams skills — orchestration on top of multi-worktree setups
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. 29d ago Changed · -2 lines d77c1c0a5c9b
  2. 1mo ago Changed · -4 lines 0164dd99a164
  3. 1mo ago Changed · -1 lines 665c00a8382b
  4. 1mo ago First seen · 47 lines · 33 tokens per session scan A b427b014845c

Subscribe to this mod's changes

git-worktrees is a skill published in the GitHub repository christopherlouet/claude-base (5 stars, last pushed yesterday), licensed MIT. It adds 33 tokens to every session and 514 once invoked, about $0.0001 per session on Opus 5.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-09-03.

Related

Other skills, from other repositories

core-workflow

Detailed development workflow patterns, checklists, and standards. Auto-loads for complex tasks, planning, debugging, or when explicit patterns are needed. Contains session protocols, git conventions, security checklists, review-based validation, and communication standards.

travisjneuman/.claude · 52 tokens

debug-systematic

Systematic 4-phase debugging methodology for complex, intermittent, or mysterious issues. Use when investigating bugs, race conditions, or unexplained failures.

travisjneuman/.claude · 33 tokens

auto-claude

Autonomous multi-agent coding with git worktree isolation, QA validation, and memory. Use for complex features requiring autonomous implementation.

travisjneuman/.claude · 30 tokens

changelog-generator

Generate CHANGELOG.md from git history grouped by Conventional Commit types. Triggers on "generate changelog", "write changelog", "release notes".

luqiang-code/claude-code-skills · 33 tokens

git-commit-generator

Generate Conventional Commits from staged git diff. Analyzes changes and produces commit messages following the Conventional Commits spec (feat, fix, refactor, etc.). Triggers on "generate commit", "write commit message", "conventional commit".

luqiang-code/claude-code-skills · 55 tokens

git-advanced-workflows

Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.

wshobson/agents · 54 tokens