git-worktree

A tool for managing Git worktrees, which are separate working folders connected to different branches of the same Git project.

In plain words
What is it for?
It helps create, list, switch between, and remove worktrees for parallel development, bug fixes, and code reviews.
Why use it?
It lets developers work on several branches at once without repeatedly stashing or moving unfinished changes.

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/nikiforovall/claude-code-rules/git-worktree
Any agent
npx skills add NikiforovAll/claude-code-rules --skill git-worktree
Clone the repo
git clone --depth 1 https://github.com/NikiforovAll/claude-code-rules

Made for: Claude Code, Codex.

Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,789 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00057 $0.01789
Opus 5 $0.00028 $0.00894
Sonnet 5 $0.00011 $0.00358
Haiku 4.5 $0.00006 $0.00179

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

Security

Grade C, and why

git-worktree 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 2d 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.

3. Remove worktree: `git worktree remove <path>` or manually `rm -rf <path>`
plugins/handbook-git-worktree/skills/git-worktree/SKILL.md · 261 lines

How it starts

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

Git Worktree Management

Overview

This skill provides comprehensive Git worktree management capabilities, enabling work on multiple branches simultaneously in isolated directories. Worktrees eliminate the need for stashing when switching contexts and are ideal for parallel development, quick bug fixes, and code reviews.

When to Use This Skill

Use this skill when the user wants to:

  • Create a new worktree from a local branch, remote branch, or new branch
  • List all active worktrees with detailed information
  • Delete and clean up worktrees
  • Get navigation commands to switch between worktrees
  • Set up parallel development environments

How It Works

Configuration

Location Strategy: Sibling directory pattern

  • Worktrees are created outside the main repository: ../<project>-<branch>
  • Example: Main repo at ~/dev/myproject, worktree at ~/dev/myproject-feature-x
  • Benefits: Clean separation, no nested repos, IDE-friendly

Naming Convention: <project>-<branch>

  • Project name extracted using: basename "$(git rev-parse --show-toplevel)"
  • Example: myproject-feature-auth, myapp-bugfix-login

Interface

Hybrid Mode: Accepts arguments when provided, prompts when missing

Usage patterns:

# Interactive menu
User: "Manage my worktrees"
User: "Create a worktree"

# Direct with arguments
User: "Create worktree from remote branch feature-x"
User: "List all worktrees"
User: "Delete worktree for branch hotfix-123"

Core Operations

1. List Worktrees

Purpose: Show all active worktrees with detailed information

What to display:

  • Index number for easy reference
  • Worktree path
  • Branch name
  • HEAD commit hash (short)
  • Commit message (first line)
  • Indicator for current worktree

Implementation:

# Get project name
project=$(basename "$(git rev-parse --show-toplevel)")

# List worktrees with details
git worktree list -v

Output format:

Git Worktrees for myproject:

1. /Users/dev/myproject (main)
   abc1234 Initial commit
   [CURRENT]

2. /Users/dev/myproject-feature-x (feature-x)
   def5678 Add authentication logic

3. /Users/dev/myproject-hotfix (hotfix-123)
   789abcd Fix login bug

Read the full file on GitHub · 261 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. 2d ago First seen · 261 lines · 57 tokens per session scan C f8189b91ee1e

Subscribe to this mod's changes

git-worktree is a skill published in the GitHub repository NikiforovAll/claude-code-rules (141 stars, last pushed 4d ago), licensed Apache-2.0. It adds 57 tokens to every session and 1,789 once invoked, about $0.0003 per session on Opus 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-08-30.

Related

Other skills, from other repositories

cohort-analysis

Perform cohort analysis on user engagement data — retention curves, feature adoption trends, and segment-level insights. Use when analyzing user retention by cohort, studying feature adoption over time, investigating churn patterns, or identifying engagement trends.

phuryn/pm-skills · 47 tokens

outcome-roadmap

Transform an output-focused roadmap into an outcome-focused one that communicates strategic intent. Rewrites initiatives as outcome statements reflecting user and business impacts. Use when shifting to outcome roadmaps, making a roadmap more strategic, or rewriting feature lists as outcomes.

phuryn/pm-skills · 53 tokens

pre-mortem

Run a pre-mortem risk analysis on a PRD or launch plan. Categorizes risks as Tigers (real problems), Paper Tigers (overblown concerns), and Elephants (unspoken worries), then classifies as launch-blocking, fast-follow, or track. Use when preparing for launch, stress-testing a product plan, or identifying what could go…

phuryn/pm-skills · 79 tokens

retro

Facilitate a structured sprint retrospective — what went well, what didn't, and prioritized action items with owners and deadlines. Use when running a retrospective, reflecting on a sprint, creating action items from team feedback, or learning how to run effective retros.

phuryn/pm-skills · 52 tokens

summarize-meeting

Summarize a meeting transcript into structured notes with date, participants, topic, key decisions, summary points, and action items. Use when processing meeting recordings, creating meeting notes, writing meeting minutes, or recapping discussions.

phuryn/pm-skills · 51 tokens

release-notes

Generate user-facing release notes from tickets, PRDs, or changelogs. Creates clear, engaging summaries organized by category (new features, improvements, fixes). Use when writing release notes, creating changelogs, announcing product updates, or summarizing what shipped.

phuryn/pm-skills · 57 tokens