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.
git clone --depth 1 https://github.com/sailingnaturali/claude-skillsnpx agentmods add skills/sailingnaturali/claude-skills/git-worktreesWrote 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.
[](https://agentmods.dev/skills/sailingnaturali/claude-skills/git-worktrees)<a href="https://agentmods.dev/skills/sailingnaturali/claude-skills/git-worktrees"><img src="https://agentmods.dev/badge/skills/sailingnaturali/claude-skills/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.
<a href="https://agentmods.dev/skills/sailingnaturali/claude-skills/git-worktrees"><img src="https://agentmods.dev/badge/skills/sailingnaturali/claude-skills/git-worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00124 | $0.01285 |
| Opus 5.5 | $0.00050 | $0.00514 |
| Sonnet 5.5 | $0.00025 | $0.00257 |
| Haiku 4.5 | $0.00012 | $0.00128 |
Grade C, and why
git-worktrees scanned grade C with 1 finding 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 1mo 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
description: Use when multiple sessions work the same repo in parallel — several agent/dev sessions, a long-running review or build that must not be disturbed, or a quick look at another branch or PR. git worktree gives How it starts
The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Parallel branches with git worktrees
One working copy can have one checked-out branch. The moment a second session needs the same
repo — another agent working a second task, a background review or build you must not disturb,
a quick fix while a feature is mid-flight — you either wait, stash-juggle, or silently fight:
a checkout under a running process, node_modules half-rebuilt for the other branch, test
output from a mix of both. git worktree ends that: extra working directories over the same
repository, each with its own branch, files, and installs.
The rules that matter
-
Create a sibling directory, named
<repo>-<topic>:git worktree add ../myrepo-featurex -b featurex origin/mainThe path lives outside the main checkout. Everything git-tracked appears there; the object store, branch and remote-tracking refs, and stashes stay shared — a
git fetchin any worktree is visible in all of them — while each worktree keeps its ownHEADand index. Disk cost is one checkout plus its installs, not a second clone.The last argument is the start point, and it has to be a ref that exists locally. A plain clone has only
origin, soorigin/mainis the safe default; on a fork you also haveupstream, and branching off the true upstream (upstream/main) rather than your fork's stale mirror is usually what you want. Substitute the remote and the default branch to match the repo —git remoteandgit branch -rtell you what exists. A start point that does not resolve fails the command outright withfatal: invalid reference: <remote>/<branch>, so this is a typo you find immediately, not one that silently branches off the wrong base. -
One branch ↔ one worktree, enforced. Checking out a branch that another worktree holds fails:
fatal: '<branch>' is already used by worktree at '<path>'. That refusal is the feature — it turns two-sessions-on-one-branch from a silent fight into a loud error (--forcecan override it; don't, for exactly that reason). To inspect the same commit twice, use a detached worktree instead:
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.
- 1mo ago First seen · 94 lines · 124 tokens per session scan C be9047047d12
git-worktrees is a skill published in the GitHub repository sailingnaturali/claude-skills (3 stars, last pushed 14d ago), licensed MIT. It adds 124 tokens to every session and 1,285 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.
Other skills, from other repositories
prowler-commit
Creates professional git commits following conventional-commits format. Trigger: When creating commits, after completing code changes, when user asks to commit.
gh-auth-isolation
Safely manage multiple GitHub identities (EMU + personal) in agent workflows.
comet-github
A routing guide for Comet-related GitHub work. It directs requests about pull requests, issues, CI failures, ideas, and fixes to the appropriate review or implementation process.
release-helper
Ensures configuration and code changes are released correctly. Use PROACTIVELY whenever you edit config.json, change any setting, or fix a configuration bug in this project, so the change reaches production.
github-skill
Work with GitHub via the gh CLI — clone repositories, create/list/merge pull requests, create/list issues, and run any other gh command (API calls, workflow runs, releases, repo administration). List operations return parsed JSON.
merge-pr
Merge a pull request with status checks, squash merge, and branch cleanup. Handles worktree contexts.