using-git-worktrees

using-git-worktrees is a skill for Claude Code, Codex from alexei-led/cc-thingz. It costs 58 tokens per session (852 once invoked), scanned A, original, MIT.

A workflow for creating separate folders from one Git project, each tied to a different branch. These Git worktrees let you work on several branches at the same time.

In plain words
What is it for?
Use it to start isolated feature, bug-fix, or experimental work, especially when the current folder has uncommitted changes or multiple branches must be active at once.
Why use it?
It keeps unfinished changes in one branch from interfering with feature work, fixes, or experiments in another. It also avoids repeatedly switching branches when tasks need to stay open together.

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/alexei-led/cc-thingz/using-git-worktrees
Any agent
npx skills add alexei-led/cc-thingz --skill using-git-worktrees
Clone the repo
git clone --depth 1 https://github.com/alexei-led/cc-thingz

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 using-git-worktrees

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexei-led/cc-thingz/using-git-worktrees.svg)](https://agentmods.dev/skills/alexei-led/cc-thingz/using-git-worktrees)
Your own site
<a href="https://agentmods.dev/skills/alexei-led/cc-thingz/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/alexei-led/cc-thingz/using-git-worktrees.svg" alt="Measured on agentmods" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 852 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.00058 $0.00852
Opus 5 $0.00029 $0.00426
Sonnet 5 $0.00012 $0.00170
Haiku 4.5 $0.00006 $0.00085

Measured 3d ago against content hash 695fa96c973a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

using-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 3d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/cleanup-worktree.sh, scripts/setup-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.

src/skills/using-git-worktrees/SKILL.md · 101 lines

How it starts

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

Git Worktrees

Use one sibling worktree root per project: <project>.worktrees/<branch-slug>. Keep the main worktree clean on the integration branch by default. Trivial solo one-liners may stay in the main worktree when a worktree would add pointless ceremony.

Treat a worktree as a disposable branch folder. Remove it and its branch after the PR merges.

Scope

Use this skill when:

  • starting a feature, fix, or experiment that should not disturb current work
  • working on multiple branches at once
  • trying competing approaches
  • the current worktree has uncommitted changes and the user wants to start something else

Do not use this skill for:

  • simple branch switching with no parallel work
  • bulk branch or stale worktree cleanup — use cleanup-git
  • git hook, Gitleaks, .gitignore, or config setup — use configuring-git-hygiene

Create Workflow

Check state before any git worktree add:

git status --short
git branch --show-current
git worktree list

If the current worktree is dirty, ask whether to commit, stash, or proceed anyway. Do not stash silently.

Use the helper when available:

scripts/setup-worktree.sh <branch> [--base <ref>]

The helper creates <project>.worktrees/<branch-slug> from the main worktree root, handles existing local/remote branches, refuses path conflicts, and refuses dirty state unless --allow-dirty is passed after user approval.

Manual fallback lives in workflow.md.

Naming

  • Root: sibling <project>.worktrees/ directory.
  • Directory: branch slug only; replace / with -.
  • Examples: fix-cron, feature-auth, bugfix-issue-123.

Cleanup Workflow

For one named worktree after PR merge:

scripts/cleanup-worktree.sh [branch]

The helper refuses unless gh confirms the PR is MERGED. Pass --force only after the user confirms the merge without gh or confirms the branch should be abandoned.

For bulk cleanup, stale worktrees, gone upstreams, or merged local branches, use cleanup-git.

Read the full file on GitHub · 101 lines

Files

What ships with it

4 files 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. 3d ago First seen · 101 lines · 58 tokens per session scan A 695fa96c973a

Subscribe to this mod's changes

using-git-worktrees is a skill published in the GitHub repository alexei-led/cc-thingz (35 stars, last pushed 1mo ago), licensed MIT. It adds 58 tokens to every session and 852 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories

peekaboo

Provides runtime observation and interaction for native macOS interfaces through accessibility state and screenshots. Use when the task depends on visible or interactive state in a running SwiftUI/AppKit app: what is rendered, focused, selected, enabled, reachable through menus/windows/dialogs, or experienced across a…

johnkozaris/jko-claude-plugins · 104 tokens

seam-probe

This skill should be used when testing or debugging an embedded-runtime boundary exposed through a dynamically loaded C-ABI library or Unix-domain socket, including requests to inspect exports, exercise FFI callbacks, send framed messages, reproduce seam crashes or hangs, fuzz a boundary, or correlate probe output…

johnkozaris/jko-claude-plugins · 82 tokens

electron-playwright-validator

This skill should be used when a user asks to launch, inspect, automate, test, validate, or debug an Electron desktop UI through Playwright/CDP, including blank renderers, runtime import failures, accessibility snapshots, layout defects, click-through flows, or post-change checks. Not for native macOS or mobile apps…

johnkozaris/jko-claude-plugins · 90 tokens

mobile-flows-maestro

This skill should be used when Maestro is explicitly requested or already present and the task is to author, run, or debug iOS/Android Maestro flows; use Maestro MCP; or handle Maestro selectors, system UI, permissions, Keychain, JavaScript, waits, device state, flakiness, or CI. Evidence includes a .maestro directory…

johnkozaris/jko-claude-plugins · 102 tokens

validate-mobile

Run a Maestro flow on an explicitly selected iOS or Android device and report behavioral evidence.

johnkozaris/jko-claude-plugins · 20 tokens

validate-api

Run the project's Hurl scenarios with an OIDC access token passed as a secret variable.

johnkozaris/jko-claude-plugins · 20 tokens