git-worktrees

A workflow for creating separate Git working folders and branches for feature development. A Git worktree lets several branches from the same repository be checked out in different folders at the same time.

In plain words
What is it for?
Use it before implementing a feature or plan, when you need parallel development, or when you want a separate working environment that cannot easily affect the main branch.
Why use it?
It keeps feature work isolated from the main code and from other tasks, while checking that dependency and build folders such as node_modules, .venv, dist, and target are safely ignored by Git.

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/carbeneai/forge/gitworktrees
Any agent
npx skills add CarbeneAI/Forge --skill gitworktrees
Clone the repo
git clone --depth 1 https://github.com/CarbeneAI/Forge

Made for: Claude Code, Codex.

Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,244 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.00068 $0.03244
Opus 5 $0.00034 $0.01622
Sonnet 5 $0.00014 $0.00649
Haiku 4.5 $0.00007 $0.00324

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

Security

Grade C, and why

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

rm -rf .worktrees/user-auth/
.claude/skills/GitWorktrees/SKILL.md · 598 lines

How it starts

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

Git Worktrees

Creates isolated git worktree directories for feature development with automatic safety verification and project setup.

🎯 Load Full CORE Context

read ${PAI_DIR}/skills/CORE/SKILL.md

When to Activate This Skill

  • "create worktree for feature X" → Isolated feature development
  • "set up feature branch" → Before implementation
  • "isolate this work" → Separate from main codebase
  • Before executing implementation plans → Clean environment
  • Before starting complex feature → Risk isolation

Core Philosophy

Isolation Prevents Accidents

Git worktrees create completely separate working directories that:

  • Share git history (efficient)
  • Have independent branches
  • Can't accidentally commit to main
  • Enable parallel development
  • Simplify cleanup (delete directory = gone)

Safety First: Verify Gitignore

Project-local directories (node_modules/, .venv/, dist/, target/) MUST be gitignored before creating worktrees.

If not ignored, these directories would be tracked by git and shared across worktrees, causing:

  • Dependency conflicts
  • Build artifacts corruption
  • Lock file collisions
  • Massive git repository size

CRITICAL: Always verify and fix .gitignore before creating worktree.

Clean Baseline: Setup and Test

New worktree should start with:

  1. Project dependencies installed
  2. Project built/compiled if needed
  3. Tests passing (clean baseline)

If tests fail in new worktree, something's wrong with setup. Fix before implementation.

The Process

Step 1: Directory Selection

Priority order for worktree location:

  1. Project has .worktrees/ directory → Use it
  2. Project has worktrees/ directory → Use it
  3. CLAUDE.md specifies preference → Follow it
  4. Ask user where to create

Example:

## Worktree Location

Checking for standard worktree directories...

- `.worktrees/`: Not found
- `worktrees/`: Not found
- CLAUDE.md preference: Not specified

Where should I create the worktree?

Options:
1. `.worktrees/feature-name` (recommended - gitignored by default)
2. `../feature-name` (sibling directory)
3. Specify custom path

What's your preference?

Read the full file on GitHub · 598 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 · 598 lines · 68 tokens per session scan C 13a72a6eaf0a

Subscribe to this mod's changes

git-worktrees is a skill published in the GitHub repository CarbeneAI/Forge (9 stars, last pushed 1mo ago), licensed MIT. It adds 68 tokens to every session and 3,244 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-31.

Related

Other skills, from other repositories

pentesting-everything

Guides authorized penetration testing with PentestingEverything as the source-grounded knowledge base. Use when scoping an engagement, building domain checklists, hunting a vulnerability class, choosing tools/commands, or drafting evidence-based findings from this repository's Markdown.

m14r41/PentestingEverything · 56 tokens

implementing-devsecops-security-scanning

Integrates Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), and Software Composition Analysis (SCA) into CI/CD pipelines using open-source tools. Covers Semgrep for SAST, Trivy for SCA and container scanning, OWASP ZAP for DAST, and Gitleaks for secrets detection. Activates for…

xalgorix/xalgorix · 109 tokens

hunt-ato

Hunt account takeover taxonomy — 9 distinct paths to ATO, plus chains. Paths: (1) password reset flaws (host-header injection redirects token, predictable/numeric token, Referer leak, no-expiry/reuse), (2) email change without re-auth, (3) OAuth account-link CSRF, (4) MFA bypass (per hunt-mfa-bypass), (5) session…

Zyrexnn/Cybermes · 241 tokens

aod-orchestrate

Multi-feature orchestration skill that bridges /aod.blueprint output to parallel wave execution. Groups synced GitHub Issues by ICE priority tier (P0/P1/P2) into sequential waves, creates Task records, spawns batch sessions via the orchestrator API, monitors completion, and reports results. Supports --issues…

davidmatousek/tachi · 110 tokens

security

Claude-powered SAST and SCA security scan skill. Invoked automatically as the Security Scan step (Step 7) of /aod.build (after Design Quality Gate, before Code Simplification) or standalone via /security. Analyzes all code files and dependency manifests changed on the feature branch relative to main for OWASP Top 10…

davidmatousek/tachi · 165 tokens

aod-foundation

Guided post-init workshop that helps new AOD Kit adopters establish product vision and design identity. Two-part flow: Part 1 (Vision) asks 5 guided questions to populate product-vision.md; Part 2 (Design) browses archetypes to generate brand files (brand.md, tokens.css, anti-patterns.md). Supports --vision and…

davidmatousek/tachi · 98 tokens