using-git-worktrees

A workflow for using Git worktrees, which are separate working folders for different branches of the same Git repository.

In plain words
What is it for?
Use it when starting a feature or implementation plan that needs its own folder and branch.
Why use it?
It keeps feature work isolated from the current workspace, reducing accidental changes to unrelated files or branches.

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/leei1337/phantom-neural-cortex/using-git-worktrees
Any agent
npx skills add LEEI1337/phantom-neural-cortex --skill using-git-worktrees
Clone the repo
git clone --depth 1 https://github.com/LEEI1337/phantom-neural-cortex

Made for: Claude Code, Codex.

Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,334 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.00035 $0.01334
Opus 5 $0.00017 $0.00667
Sonnet 5 $0.00007 $0.00267
Haiku 4.5 $0.00003 $0.00133

Measured 3d ago against content hash 29571961ff48, 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.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/skills/using-git-worktrees/SKILL.md · 214 lines

How it starts

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

Using Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

Core principle: Systematic directory selection + safety verification = reliable isolation.

Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."

Directory Selection Process

Follow this priority order:

1. Check Existing Directories

# Check in priority order
ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative

If found: Use that directory. If both exist, .worktrees wins.

2. Check CLAUDE.md

grep -i "worktree.*director" CLAUDE.md 2>/dev/null

If preference specified: Use it without asking.

3. Ask User

If no directory exists and no CLAUDE.md preference:

No worktree directory found. Where should I create worktrees?

1. .worktrees/ (project-local, hidden)
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)

Which would you prefer?

Safety Verification

For Project-Local Directories (.worktrees or worktrees)

MUST verify .gitignore before creating worktree:

# Check if directory pattern in .gitignore
grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore

If NOT in .gitignore:

Per Jesse's rule "Fix broken things immediately":

  1. Add appropriate line to .gitignore
  2. Commit the change
  3. Proceed with worktree creation

Why critical: Prevents accidentally committing worktree contents to repository.

For Global Directory (~/.config/superpowers/worktrees)

No .gitignore verification needed - outside project entirely.

Creation Steps

1. Detect Project Name

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

2. Create Worktree

# Determine full path
case $LOCATION in
  .worktrees|worktrees)
    path="$LOCATION/$BRANCH_NAME"
    ;;
  ~/.config/superpowers/worktrees/*)
    path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
    ;;
esac

# Create worktree with new branch
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

Read the full file on GitHub · 214 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 First seen · 214 lines · 35 tokens per session scan A 29571961ff48

Subscribe to this mod's changes

using-git-worktrees is a skill published in the GitHub repository LEEI1337/phantom-neural-cortex (5 stars, last pushed 6mo ago), licensed MIT. It adds 35 tokens to every session and 1,334 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

brain-load

Load project context from the Claude Brain Logseq graph into the current session. Triggers: "load brain", "load ", "resume ", "continue work on ", "what do we know about ". Don't fire for write operations (use brain-save), generic questions about Logseq itself, or "open " / "switch to " requests that mean opening…

jame581/LogseqBrain · 96 tokens

brain-doctor

Lint and repair the Claude Brain Logseq graph — find and fix format violations that create phantom pages or broken macros. Triggers: "brain doctor", "lint brain", "check brain health", "clean up brain", "fix brain", "graph hygiene", "why are there empty pages", "find broken pages", "backfill digests", "rebuild digest…

jame581/LogseqBrain · 114 tokens

brain-save

Save session context, decisions, progress, and plans to the Claude Brain Logseq graph. Triggers: "save to brain", "save this", "remember this", "store this decision", "log this", "save progress", "before I quit", "wrap up". Don't fire for read operations (use brain-load) or status checks (use brain-status).

jame581/LogseqBrain · 77 tokens

brain-status

Show a dashboard of all projects in the Claude Brain graph, or graph analytics. Dashboard triggers: "brain status", "show projects", "show brain", "what's in my brain", "project dashboard", "brain overview", "list projects", "summary". Analytics triggers: "brain stats", "graph analytics", "graph activity over time".…

jame581/LogseqBrain · 89 tokens

brain-init

Set up the Claude Brain Logseq graph (first-time) or add a new project page. Triggers: "init brain", "setup brain", "init brain project ", "add project to brain". Don't fire for loads, saves, or status checks — those are handled by brain-load, brain-save, and brain-status.

jame581/LogseqBrain · 71 tokens

web-app-penetration-testing

Pentest a web app or website end to end — black-box testing of a live URL, staging environment, or local dev server that finds and exploits real vulnerabilities (auth bypass, broken access control, IDOR, injection, XSS, SSRF, business logic) and proves each one with a working proof-of-concept instead of a signature…

usestrix/strix · 129 tokens