rig-worktree

rig-worktree is a skill for Claude Code from agent-rig/rig. It costs 103 tokens per session (2,464 once invoked), scanned A, original, MIT.

A worktree manager for Git, where a worktree is a separate working copy of a repository linked to the same history. It creates development-ready worktrees, lists them with pull-request status, and removes merged ones.

In plain words
What is it for?
Use it when starting isolated feature work, experiments, or spikes, checking existing worktrees, or safely cleaning up merged worktrees.
Why use it?
It prevents parallel changes from interfering with each other and handles setup details such as fetching the base branch, sharing environment files, and installing dependencies.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; mentions Codex; mentions Gemini CLI.

Good fit Use it when starting isolated feature work, experiments, or spikes, checking existing worktrees, or safely cleaning up merged worktrees.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agent-rig/rig/rig-worktree
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.

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

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 rig-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/agent-rig/rig/rig-worktree/github.svg)](https://agentmods.dev/skills/agent-rig/rig/rig-worktree)
Your own site
<a href="https://agentmods.dev/skills/agent-rig/rig/rig-worktree"><img src="https://agentmods.dev/badge/skills/agent-rig/rig/rig-worktree/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 rig-worktree

Your own site · 80×15
<a href="https://agentmods.dev/skills/agent-rig/rig/rig-worktree"><img src="https://agentmods.dev/badge/skills/agent-rig/rig/rig-worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,464 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.00103 $0.02464
Opus 5.5 $0.00041 $0.00986
Sonnet 5.5 $0.00021 $0.00493
Haiku 4.5 $0.00010 $0.00246

Measured 1mo ago against content hash 9d292fd08313, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rig-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 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.

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.

skills/rig-worktree/SKILL.md · 190 lines

How it starts

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

Worktree — isolated dev checkout lifecycle

Create / list / remove isolated git worktrees under .claude/worktrees/. Creation produces a worktree that's actually ready to run: fetched from origin, branched from the right base, env files symlinked, dependencies installed. This is a shared bootstrap you can call directly (spikes, ad-hoc branches, parallel experiments) and that implement-style flows and prune/rig-tidy steps can delegate to.

The logic lives in two scripts so the invariants live in one place: <SCRIPTS>/setup-worktree.sh (create) and <SCRIPTS>/remove-worktree.sh (teardown), where <SCRIPTS> is resolved per install (see Configuration). Creation encodes three invariants that bite if skipped — fetch-before-branch (stale local refs silently start you on a pre-merge tip), env symlinks (missing secrets read as flaky/timeout test failures, not "config not found"), and a per-worktree dependency install (installed deps don't carry across worktrees → Cannot find package '...'). Don't reimplement these inline; call the scripts.

Configuration

Script location (<SCRIPTS>). Where the helper scripts live depends on which target installed them, so resolve — don't assume — from the repo root (git rev-parse --show-toplevel), first hit wins:

  1. .claude/scripts/ — the claude-code target (on a dual-target install this is a symlink at .rig/scripts/, so either entry finds the same file).
  2. .rig/scripts/ — the agents-md target (Codex, Cursor, Gemini CLI, …), where there is no .claude/ at all.

If neither holds setup-worktree.sh, say so and stop rather than reimplementing the script inline — its invariants are the whole point.

Reads .rig/config.json (missing keys → defaults):

Key Default Used for
vcs.baseRef origin/main Default --base the worktree branches from.
vcs.branchConvention {user}/{ticket}-{slug} Template when inferring a branch name from a ticket ID.
vcs.defaultBranch main The trunk (informational; the main worktree).
runtime.installCommand derived from packageManager Passed to the setup script as --install-cmd.
runtime.packageManager npm Derives the install command when installCommand is unset (bun→bun install, pnpm→pnpm install, yarn→yarn, npm→npm install, none→skip install).
tracker.ticketPrefix — Recognizing a ticket ID (e.g. ABC-521) to slot into the branch template.

Read the full file on GitHub · 190 lines

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. 1mo ago Changed · +21 lines 9d292fd08313
  2. 1mo ago First seen · 169 lines · 103 tokens per session scan A 8ba3ac18b499

Subscribe to this mod's changes

rig-worktree is a skill published in the GitHub repository agent-rig/rig (3 stars, last pushed 1mo ago), licensed MIT. It adds 103 tokens to every session and 2,464 once invoked, about $0.0004 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-08-31.

Related

Other skills, from other repositories

cloudron-app-publishing

Distribute Cloudron apps via CloudronVersions.json version catalogs.

marcusquinn/aidevops · 18 tokens

worktree-pr

Decide whether a task deserves its own git worktree and, if chosen, run it end to end: branch from the integration branch rather than the current tree, keep the main working copy untouched while the task runs, compare the result against the untouched baseline before declaring it done, and prepare it for a pull request…

scarletkc/agents · 148 tokens

infrastructure-publishing

Skill for the publishing infrastructure module providing academic publishing workflows including BibTeX CLI citation generation, APA/MLA citation helper functions, DOI management, Zenodo publication, arXiv submission preparation, GitHub releases, PyPI and TestPyPI package distribution, static-site deployment to GitHub…

docxology/template · 127 tokens

template-publish

Publishing scripts for DOI-bearing project releases, optional mirror uploads, PyPI release validation, post-publish verification, and publication export. Use with docs/guides/publication-runbook.md for standalone GitHub + Zenodo release workflows.

docxology/template · 52 tokens

cut-release

Cut a new agnostic-ai release end to end. Use when the user wants to ship a new version (tag + GitHub Release).

Chemaclass/agnostic-ai · 31 tokens

pr-sweep

Review every open PR with the code-reviewer agent and an adversarial review, apply the findings, and merge each one once CI is green. Use when asked to ship, sweep, or merge open PRs.

Chemaclass/agnostic-ai · 47 tokens