add-worktree

add-worktree is a skill for Claude Code, Codex from niki914/zafiro. It costs 76 tokens per session (717 once invoked), scanned A, original, MIT.

A workflow for creating a separate Git worktree and branch for a piece of work. A Git worktree is another working directory connected to the same repository, so branches can be worked on side by side.

In plain words
What is it for?
Use it to start isolated work on a feature, bug fix, refactor, performance change, tooling task, test, or documentation change.
Why use it?
It avoids switching the main working directory between tasks and gives each branch its own directory and name.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to start isolated work on a feature, bug fix, refactor, performance change, tooling task, test, or documentation change.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/niki914/zafiro/add-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 niki914/zafiro --skill add-worktree
Clone the repo
git clone --depth 1 https://github.com/niki914/zafiro

Made for: Claude Code, Codex.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/niki914/zafiro/add-worktree"><img src="https://agentmods.dev/badge/skills/niki914/zafiro/add-worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 717 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.00076 $0.00717
Opus 5.5 $0.00030 $0.00287
Sonnet 5.5 $0.00015 $0.00143
Haiku 4.5 $0.00008 $0.00072

Measured yesterday against content hash 0245867a8776, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/add-worktree.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.agents/skills/add-worktree/SKILL.md · 66 lines

How it starts

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

Add Worktree

Worktrees live in reusable slot directories in a sibling directory of the primary repo:

<parent of primary repo>/worktrees/zafiro/slot-${index}

Fixed slots (slot-1, slot-2, ...) allow Android Studio and Gradle to preserve and reuse build caches, project indexing, and window configurations across branches, while keeping Git branch names meaningful.

1 — Name the branch from the requirement

<type>/<kebab-case summary>, following the repo's branch convention (feat/agent-status, refactor/aidl-state-sync).

Type For
feat new capability
fix bug fix
refactor behaviour-preserving restructure
perf speed / memory
chore build, deps, tooling
test tests only
docs docs only

Rules: lowercase ASCII, hyphens only, summary describes the change (fix/latex-blank-render, not fix/niki-work); ≤ 40 characters total; no ticket numbers, no dates.

The summary comes from what the user asked for. If the user asked for a worktree without specifying the task, ask before naming.

2 — Run the allocation script

Run the bundled script in this skill:

# Locate script relative to primary repo or execute directly
SCRIPT_PATH="$(git rev-parse --show-toplevel)/.agents/skills/add-worktree/scripts/add-worktree.sh"
# Or resolve from common dir if already inside a worktree:
GIT_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)"
PRIMARY_REPO="$(cd "$GIT_COMMON_DIR/.." && pwd -P)"
SCRIPT_PATH="$PRIMARY_REPO/.agents/skills/add-worktree/scripts/add-worktree.sh"

"$SCRIPT_PATH" <branch-name> [base-ref]

What the script handles automatically:

  1. Primary repo & path resolution: Dynamically locates the repo root via --git-common-dir and calculates <repo parent>/worktrees/zafiro/ without hardcoding absolute paths.
  2. Branch validation & duplicate check: Verifies branch format and rejects collisions with existing local or remote branches.
  3. Lowest slot allocation: Scans from slot-1 upward:
    • Skips slots registered in git worktree list.
    • If an unregistered directory exists on disk, logs a warning and skips to the next slot without modifying it.
    • Allocates the lowest clean slot.
  4. Base ref: Defaults to origin/main (after a non-fatal fetch), unless another base ref is passed.

Read the full file on GitHub · 66 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 Changed · +1 lines · +3 tokens per session 0245867a8776
  2. 19d ago Changed b443dfdb901b
  3. 25d ago First seen · 65 lines · 73 tokens per session scan A ae46c6b1da34

Subscribe to this mod's changes

add-worktree is a skill published in the GitHub repository niki914/zafiro (288 stars, last pushed yesterday), licensed MIT. It adds 76 tokens to every session and 717 once invoked, about $0.0003 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-28.

Related

Other skills, from other repositories

baby-sit

Monitor a GitHub pull request until CI is green, diagnose failures, and rerun only evidence-backed flaky GitHub Actions jobs.

langchain-ai/open-swe · 30 tokens

code-task

PREFERRED way to change code in a REAL repository: fix a GitHub issue, fix a bug, add/implement a function or feature, or make any edit to a project the user names by a filesystem path (e.g. /tmp/foo, /code/bar) or a git URL. Clones the repo, runs an OpenSquilla agent on the host to make the change on a task branch…

opensquilla/opensquilla · 322 tokens

github

GitHub operations via gh CLI: issues, PRs, CI runs, code review, API queries. Use when: (1) checking PR status or CI, (2) creating/commenting on issues, (3) listing/filtering PRs or issues, (4) viewing run logs. NOT for: complex web UI interactions requiring manual browser flows (use browser tooling when available)…

opensquilla/opensquilla · 101 tokens

apply-patch

Apply multi-file or tricky edits atomically with git apply instead of many fragile editfile calls. Use when changing several files at once or when editfile fails to match.

agentscope-ai/agentscope-java · 38 tokens

git-checkpoint

Use git as a safety net - create a checkpoint commit before risky or large changes and roll back cleanly if a change makes things worse. Use before multi-file refactors.

agentscope-ai/agentscope-java · 39 tokens

meta-codereview-current-diff

Read the current uncommitted diff, run three independent reviewers (safety + tests-coverage + style) in parallel, then arbitrate a single BLOCK / BLOCKWITHOVERRIDE / PASSWITHNOTES verdict. Use before commit when you want a multi-perspective second-opinion instead of a single-reviewer agent loop.

opensquilla/opensquilla · 73 tokens