git-worktree-workspaces

A Git feature for creating separate working folders for different branches of the same repository. Each folder lets you work on another task without making another full clone.

In plain words
What is it for?
Use it when working on several branches or tasks at the same time, such as a feature and a bug fix. It helps create, organize, and clean up these parallel workspaces.
Why use it?
It avoids repeatedly switching branches in one folder or downloading multiple copies of the repository. It also includes guidance for safely removing the extra folders afterward.

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/soulcodex/agentic/git-worktree-workspaces
Any agent
npx skills add soulcodex/agentic --skill git-worktree-workspaces
Clone the repo
git clone --depth 1 https://github.com/soulcodex/agentic

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 782 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.00782
Opus 5 $0.00029 $0.00391
Sonnet 5 $0.00012 $0.00156
Haiku 4.5 $0.00006 $0.00078

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

Security

Grade A, and why

git-worktree-workspaces 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 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.

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.

skills/development/git-worktree-workspaces/SKILL.md · 121 lines

How it starts

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

Git Worktree Workspaces Skill

Step 1 — Discover Current Repo State

git rev-parse --show-toplevel
git branch --show-current
git worktree list --porcelain
git remote show origin | sed -n '/HEAD branch/s/.*: //p'

Capture:

  • Current repository root and active branch
  • Existing worktrees and paths
  • Remote default branch (do not assume a fixed branch name)

Step 2 — Pick Naming and Layout

Use a predictable directory pattern outside the main working tree:

REPO_ROOT="$(git rev-parse --show-toplevel)"
REPO_NAME="$(basename "$REPO_ROOT")"
WORKTREE_ROOT="$(dirname "$REPO_ROOT")/${REPO_NAME}-worktrees"
mkdir -p "$WORKTREE_ROOT"

Recommended names:

  • Branch: feat/<topic>, fix/<topic>, docs/<topic>
  • Path: $WORKTREE_ROOT/<branch-slug>

Step 3 — Create a New Worktree

For a new branch:

BASE_BRANCH="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"
NEW_BRANCH="feat/<topic>"
TARGET_PATH="$WORKTREE_ROOT/${NEW_BRANCH//\//-}"

git fetch origin "$BASE_BRANCH"
git worktree add -b "$NEW_BRANCH" "$TARGET_PATH" "origin/$BASE_BRANCH"

For an existing branch:

EXISTING_BRANCH="<branch>"
TARGET_PATH="$WORKTREE_ROOT/${EXISTING_BRANCH//\//-}"

git fetch origin
git worktree add "$TARGET_PATH" "$EXISTING_BRANCH"

Step 4 — Work Independently Per Task

Inside each worktree:

cd "$TARGET_PATH"
git status --short
git add <files>
git commit -m "feat(<scope>): <summary>"

Rules:

  • One task per worktree branch.
  • Keep commits scoped to that task only.
  • Run project quality gates before pushing.

Step 5 — Push and Open PRs

git push -u origin "$(git branch --show-current)"
gh pr create --base "<base-branch>" --head "$(git branch --show-current)"

Use Refs #<issue> for stacked/chained PRs that should not auto-close yet. Use Closes #<issue> only on the final PR intended to close the issue on merge.

Step 6 — Safe Cleanup (Local Only)

After a branch is merged and no longer needed locally:

Read the full file on GitHub · 121 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 · 121 lines · 58 tokens per session scan A 1569acbb9cbd

Subscribe to this mod's changes

git-worktree-workspaces is a skill published in the GitHub repository soulcodex/agentic (10 stars, last pushed 2d ago), licensed MIT. It adds 58 tokens to every session and 782 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-31.

Related

Other skills, from other repositories

research-repository

Build a repository that makes findings findable, reusable, and cumulative across teams. Use when the same research keeps getting redone. For synthesising one study, use affinity-diagram.

Owl-Listener/designer-skills · 43 tokens

survey-design

Design unbiased survey instruments — question wording, scales, and sampling — to measure attitudes at scale. Use when you need quantitative breadth. For behavioural experiments, use a-b-test-design (prototyping-testing).

Owl-Listener/designer-skills · 47 tokens

localization-design

Design for multiple languages, writing directions, and cultural contexts — text expansion, RTL mirroring, and locale formats. Use when shipping beyond one locale. For the words themselves, use ux-writing (designer-toolkit).

Owl-Listener/designer-skills · 49 tokens

design-negotiation

Advocate for design quality, scope, and timeline with partners and leadership using evidence and shared goals. Use in the conversation itself. For the commercial vocabulary behind it, use business-design (ux-strategy).

Owl-Listener/designer-skills · 48 tokens

design-debt-audit

Inventory and prioritise accumulated design inconsistencies across a product. Use when drift has built up over time. For token coverage specifically use design-token-audit (designer-toolkit); for WCAG gaps use accessibility-audit (design-systems).

Owl-Listener/designer-skills · 59 tokens

design-impact-reporting

Communicate design's contribution to business and user outcomes in stakeholder language. Use when reporting results upward. For choosing the metrics in the first place, use metrics-definition (ux-strategy).

Owl-Listener/designer-skills · 44 tokens