git-worktree

git-worktree is a skill for Claude Code from bahayonghang/my-ai-cli-toolkit. It costs 135 tokens per session (1,175 once invoked), scanned A, original, MIT.

A workflow for creating and managing separate Git worktrees, which are extra working folders linked to one repository. It supports new branches, listing worktrees, removing owned worktrees, and identifying possible cleanup candidates after approval.

In plain words
What is it for?
Use it to inspect the repository setup, plan and create a worktree for a new branch, list existing worktrees, remove a worktree it owns, or review worktrees that may be pruned.
Why use it?
It keeps branch work isolated while following one repository folder convention. It also checks that the worktree folder is excluded from Git before creating it.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to inspect the repository setup, plan and create a worktree for a new branch, list existing worktrees, remove a worktree it owns, or review worktrees that may be pruned.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bahayonghang/my-ai-cli-toolkit/git-worktree
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 bahayonghang/my-ai-cli-toolkit --skill git-worktree
Clone the repo
git clone --depth 1 https://github.com/bahayonghang/my-ai-cli-toolkit

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/git-worktree/github.svg)](https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/git-worktree)
Your own site
<a href="https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/git-worktree"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/git-worktree/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 git-worktree

Your own site · 80×15
<a href="https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/git-worktree"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/git-worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 135 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,175 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00135 $0.01175
Opus 5.5 $0.00054 $0.00470
Sonnet 5.5 $0.00027 $0.00235
Haiku 4.5 $0.00014 $0.00118

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

Security

Grade A, and why

git-worktree 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 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/worktree_convention.py, tests/worktree-convention.test.mjs), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/git-github-collaboration/git-worktree/SKILL.md · 92 lines

How it starts

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

In the commands below, <skill-dir> is this skill's base directory, announced when the skill loads. Substitute the literal path. On Windows, py -3 may replace python.

Use this workflow: inspect -> plan-create (ensures ignore) -> authorized execute -> record.

Routing

  • Isolation worktree create / list / owned remove / authorized prune: this skill.
  • Commit, split, checkpoint: git-commit.
  • PR, review, merge, CI, Release, tag-build detached worktree: gh-pr-release.
  • GitHub template bootstrap: gh-bootstrap.
  • Adopt an existing foreign worktree, or add a worktree for an existing branch: refuse. MVP is --mode new-branch only.

If a native harness worktree tool exists, run the helper first. Call the native tool only when inspect/plan JSON already contains worktree_path and ok_to_create=true. Do not let the native tool pick an unchecked path.

1. Inspect

From the repository root:

python "<skill-dir>/scripts/worktree_convention.py" inspect --repo-root <abs-repo> [--explicit-root <rel>] [--branch <name>]

Read resolved_root, resolution_reason, registered_in_repo_roots, already_linked, gitignore_covers, and write_required.

If already_linked is true and the user asked to create: report the current tree and stop. Do not nest worktrees.

This repository may already have a registered root such as .claude/worktrees. Do not invent a second default root.

2. Ignore gate (before any add)

Matching authority is git check-ignore -v -z --stdin. The helper already runs that.

A create request authorizes appending one planned <resolved_root>/ line to the repository .gitignore. plan-create does that when write_required is true. Do not wait for a second confirmation. Do not git add or git commit the ignore line.

  • After plan-create, gitignore_covers must be true before executing argv.
  • If write_required is still true (ignore_gate in refusals), stop.
  • Global excludes or .git/info/exclude alone are not enough.

Read the full file on GitHub · 92 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. 1mo ago First seen · 92 lines · 135 tokens per session scan A bb853ea9f67b

Subscribe to this mod's changes

git-worktree is a skill published in the GitHub repository bahayonghang/my-ai-cli-toolkit (17 stars, last pushed 6d ago), licensed MIT. It adds 135 tokens to every session and 1,175 once invoked, about $0.0005 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-30.

Related

Other skills, from other repositories