worktree-manager

worktree-manager is a skill for Claude Code from kopp0510/claude-dd. It costs 51 tokens per session (1,403 once invoked), scanned A, original, MIT.

A workflow for creating and removing Git worktrees, which are separate working directories connected to one Git repository. They let development on one branch stay isolated from another.

In plain words
What is it for?
Use it to create an isolated branch environment, install dependencies, copy environment settings, run baseline tests, and clean up the worktree after development.
Why use it?
It checks the repository before setup, records a test baseline, and keeps branch-specific changes separate from the main working directory.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents; names the AskUserQuestion tool; mentions Claude Code.

Good fit Use it to create an isolated branch environment, install dependencies, copy environment settings, run baseline tests, and clean up the worktree after development.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kopp0510/claude-dd/worktree-manager
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 kopp0510/claude-dd --skill worktree-manager
Clone the repo
git clone --depth 1 https://github.com/kopp0510/claude-dd

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 worktree-manager

README.md
[![agentmods](https://agentmods.dev/badge/skills/kopp0510/claude-dd/worktree-manager/github.svg)](https://agentmods.dev/skills/kopp0510/claude-dd/worktree-manager)
Your own site
<a href="https://agentmods.dev/skills/kopp0510/claude-dd/worktree-manager"><img src="https://agentmods.dev/badge/skills/kopp0510/claude-dd/worktree-manager/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 worktree-manager

Your own site · 80×15
<a href="https://agentmods.dev/skills/kopp0510/claude-dd/worktree-manager"><img src="https://agentmods.dev/badge/skills/kopp0510/claude-dd/worktree-manager.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,403 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00051 $0.01403
Opus 5.5 $0.00020 $0.00561
Sonnet 5.5 $0.00010 $0.00281
Haiku 4.5 $0.00005 $0.00140

Measured yesterday against content hash f198d754bd46, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

worktree-manager 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 yesterday.

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/worktree-manager/SKILL.md · 59 lines

How it starts

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

Worktree Manager

原生優先(Claude Code ≥ 2.1.198):原生 EnterWorktree 工具、CLI --worktree 與 subagent isolation: worktree 已涵蓋建立、會話遷移與自動清理 — 先用原生。 本 skill 只處理原生不覆蓋的場景:自訂位置慣例、依賴安裝與基線測試、舊版 Claude Code。

收尾第 1 步借鑑 michael-denyer/pstack-claude 的 worktree-cleanup playbook(被 ignore 的 .env 算「刪了就沒了」)。

建立流程

  1. 前置檢查:確認在 git repo 內、git status --porcelain 乾淨(有未提交變更先提示處理)、 git worktree list 無同名衝突
  2. 確認設定(AskUserQuestion 一次問完):分支名(建議 feature/<name> 前綴)、 位置(慣例:主 repo 平行目錄 ../<project>-worktree-<branch>)、是否裝依賴
  3. 建立:git worktree add -b <branch> <path> <base-branch>
  4. 環境設定:裝依賴(npm/pip 等,依專案)、複製 .env.example → .env(如存在)
  5. 基線測試:跑既有測試記錄基線 — 失敗時警告但不阻止建立(帶著已知紅燈開發, 之後才分得清是誰弄壞的)
  6. 記錄:在 worktree 根寫 WORKTREE_INFO.md(分支、base、路徑、基線結果)

收尾

開發完成後:

  1. 先看 worktree 裡還剩什麼:git -C <path> status --porcelain --ignored,每一行照下面的規則處理過再往下 (git 2.42.0 與 2.54.0 實測,2026-10-19)。!! 那幾行處理完還是會留在輸出裡,這是正常的:
    • M、A 這類(還沒 commit 的變更)與 ??(沒追蹤的檔):git worktree remove 會拒絕 (「包含修改或未追蹤的檔案,使用 --force 刪除」,英文是 contains modified or untracked files, use --force to delete it)。 不要直接加 --force —— 它會把這些連同下一種一起刪掉
    • !!(被 gitignore 的):remove 不會拒絕,會跟著整個目錄直接刪掉、不提示。 node_modules/ 這種裝得回來的不用管;要留意的是只有這裡才有的檔,例如步驟 4 複製出來、之後又改過的 .env (用 cmp -s <path>/.env <path>/.env.example 比,只看結束碼:0 是一樣、1 是改過、2 是比不了(例如 .env.example 不在), 1 和 2 都列進去問。-s 什麼都不印。不要用 diff —— 它會把填進去的金鑰印出來。macOS 與 busybox 的 cmp 實測,2026-10-19)
    • 上面兩種裡要留的、拿不準的:列出來用 AskUserQuestion 一次問完,不要自己選。 M、?? 可選 commit、搬到哪、刪掉; !! 只給搬到哪、刪掉 —— 被 ignore 的檔多半本來就不該進 git(例如 .env)。 步驟 6 寫的 WORKTREE_INFO.md 每次都會出現在 ??;它只記這個 worktree 的分支、路徑與基線結果,問的時候可以建議刪掉
  2. 回主 repo git worktree remove <path> → git worktree prune

merge 與分支刪除由使用者決定,本 skill 不代決。

限制備忘

  • 一個分支只能有一個 worktree;已被 worktree 佔用的分支不能再 checkout
  • 子模組專案需特殊處理,先確認再建
  • worktree 共用主 repo 的 .gitignore,info/exclude 也是共用的 —— 它住在 common dir, 在哪一邊加規則,主 repo 與所有 worktree 都會生效(git 沒有 per-worktree exclude 機制; 實測寫進 .git/worktrees/<name>/info/exclude 根本不被讀取)
  • worktree 內不可寫死 .git/info/exclude:worktree 的 .git 是一個指向 gitdir 的檔案、 不是目錄,照字面路徑寫入必定 not a directory 失敗(已複現,exit 1)。 要取真實路徑用 git rev-parse --path-format=absolute --git-path info/exclude (--path-format 需 git ≥ 2.31,見該版 release notes;更早的版本只有 git rev-parse --git-path info/exclude,回的是相對路徑)

Read the full file on GitHub · 59 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. yesterday Changed · +17 lines f198d754bd46
  2. 1mo ago Changed · +7 lines 88e47556d3cb
  3. 1mo ago First seen · 35 lines · 51 tokens per session scan A 29fc69d73608

Subscribe to this mod's changes

worktree-manager is a skill published in the GitHub repository kopp0510/claude-dd (12 stars, last pushed yesterday), licensed MIT. It adds 51 tokens to every session and 1,403 once invoked, about $0.0002 per session on Opus 5.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

review-implement-phase

Implements triaged review actions, commits focused fixes, and posts Done plus resolves threads. Use when the user wants only the implementation phase of the review-framework workflow.

prisma/orm · 38 tokens

pr

Draft a PR body from OMC's paper trail — the smallest visual that proves the change, evidence consumed from the verify protocol (never re-collected), reversibility from the ADR test on the diff, glossary language throughout.

Yeachan-Heo/oh-my-claudecode · 47 tokens

merge-batch

Prepare and merge an owner-selected PR batch with contributor credit and exact-candidate admission. Use for a pasted PR list; combined focused validation is diagnostic, and every actual landing still requires its applicable checks and authorization.

diegosouzapw/OmniRoute · 46 tokens

otto-pr-review-loop

Run Polly and OCR on a PR until all findings settle.

omnigent-ai/omnigent · 17 tokens

engram-branch-pr

PR creation workflow for Engram following the issue-first enforcement system. Trigger: When creating a pull request, opening a PR, or preparing changes for review.

Gentleman-Programming/engram · 37 tokens

verify-behavior

Verify or reproduce visible product behavior by driving the real UI with pi-computer-use's checked tools, requiring verified expect postconditions and durable state evidence for meaningful UI flows. Use when triage needs visual reproduction, implementation needs behavioral proof, review needs interactive confirmation…

nicknisi/dotfiles · 68 tokens