use-worktrees

use-worktrees is a skill for Claude Code from urmzd/dotfiles. It costs 130 tokens per session (1,405 once invoked), scanned B, original, Apache-2.0.

A Git worktree guide for keeping separate working directories for parallel branches inside a repository's .worktrees folder. A worktree is an additional checkout that shares the same Git history with the main checkout.

In plain words
What is it for?
Use it when creating, entering, or cleaning up worktrees for parallel development or isolated agent tasks.
Why use it?
It reduces branch switching and keeps parallel tasks isolated while preserving the main checkout on its default branch. It also defines where these extra directories belong and how to keep them out of version control.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions subagents; mentions Claude Code.

Good fit Use it when creating, entering, or cleaning up worktrees for parallel development or isolated agent tasks.

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

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 use-worktrees

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/urmzd/dotfiles/use-worktrees"><img src="https://agentmods.dev/badge/skills/urmzd/dotfiles/use-worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,405 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00130 $0.01405
Opus 5.5 $0.00052 $0.00562
Sonnet 5.5 $0.00026 $0.00281
Haiku 4.5 $0.00013 $0.00140

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

Security

Grade B, and why

use-worktrees scanned grade B 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 3d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

`~/.claude/settings.json`) makes `claude --worktree` and subagent
dot_agents/skills/use-worktrees/SKILL.md · 108 lines

How it starts

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

Use Worktrees

Worktrees give each parallel task its own working directory while sharing one repository. This skill defines where they live and the invariants that keep the primary checkout safe.

Policy (non-negotiable)

  1. One location: every worktree lives at <repo-root>/.worktrees/<name>, where <repo-root> is the primary checkout of the repo being worked on. Never .claude/worktrees/, never sibling directories (../repo-feature), never temp dirs, never nested inside another worktree.
  2. Per-repo, even cross-project: when a session in project A creates a worktree for project B, it goes in B's own root (<B-root>/.worktrees/), not under A and not in any shared location.
  3. Always ignored: .worktrees/ must be gitignored. Check with git check-ignore -q .worktrees; if not ignored, append .worktrees/ to .git/info/exclude (repo-local, safe in shared repos). Only add it to the tracked .gitignore when the user wants it committed for the whole team.
  4. The default branch never moves: the primary checkout stays on the default branch (main/master) permanently. Never git switch or git checkout a feature branch there, never commit on it directly; update it only with git pull --ff-only. All branch work happens inside worktrees.
  5. Work never lives on one disk: push a worktree's branch with its first commit and open a draft pull request the same turn. Before a turn ends, commit and push what the worktree holds; a work-in-progress commit is fine. Never commit on a detached HEAD: create a branch first. When one branch builds on another, base its pull request on that branch.

Create a worktree

root=$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")
git -C "$root" check-ignore -q .worktrees || printf '.worktrees/\n' >> "$root/.git/info/exclude"
default=$(git -C "$root" symbolic-ref -q --short refs/remotes/origin/HEAD || echo HEAD)
git -C "$root" worktree add -b <branch> "$root/.worktrees/<task>" "$default"

Read the full file on GitHub · 108 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. 3d ago Changed 12dee74f3d9c
  2. 9d ago Changed · +10 lines ffe6b452c3e8
  3. 3mo ago First seen · 98 lines · 130 tokens per session scan B f9620a767f1f

Subscribe to this mod's changes

use-worktrees is a skill published in the GitHub repository urmzd/dotfiles (6 stars, last pushed 4d ago), licensed Apache-2.0. It adds 130 tokens to every session and 1,405 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

use-worktrees compared with skills from other repositories

use-worktrees next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
use-worktreesurmzd/dotfilesSkill64d agoApache-2.0B130Claude Code
create-prmagic3007/dotfilesSkill115d agoMITA34Claude Code, Codex
scan-commitmagic3007/dotfilesSkill115d agoMITA35Claude Code, Codex
smart-commitmagic3007/dotfilesSkill115d agoMITA19Claude Code, Codex
pr-reviewmagic3007/dotfilesSkill115d agoMITA28Claude Code
herdr-coordinatormagic3007/dotfilesSkill115d agoMITA153Claude Code, Codex
analyze-prmagic3007/dotfilesSkill115d agoMITA60Claude Code, Codex