git-worktree

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

A workflow for carrying a development task in an isolated Git worktree, a separate folder tied to its own branch. It covers implementation, verification, integration, and safe cleanup within that folder.

In plain words
What is it for?
It helps develop a feature or fix on a separate branch, run its checks, integrate the result, resolve conflicts, and remove the worktree safely.
Why use it?
It keeps the main checkout untouched and prevents files, commands, or reviews from different tasks being mixed together. This is useful when several coding tasks run in parallel.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps develop a feature or fix on a separate branch, run its checks, integrate the result, resolve conflicts, and remove the worktree safely.

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

Made for: Claude Code, Codex.

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/hamstudy/github.svg)](https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/hamstudy)
Your own site
<a href="https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/hamstudy"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/hamstudy/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/hamstudy"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/hamstudy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,597 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.00118 $0.01597
Opus 5 $0.00059 $0.00798
Sonnet 5 $0.00024 $0.00319
Haiku 4.5 $0.00012 $0.00160

Measured 7d ago against content hash d26a00ce8db9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 7d 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.

.trellis/tasks/archive/2026-08/08-17-git-worktree-skill/research/hamstudy-SKILL.md · 175 lines

How it starts

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

Git Worktree Development

Use a worktree as an ownership and execution boundary, not merely as another directory. Once a task is assigned to a worktree, carry the entire task through that boundary until its work is integrated and the worktree is safely removed.

Core invariants

  1. Make the assigned worktree authoritative. The coordinator's current directory, a worker's inherited directory, and a previous cd do not prove where an operation will run. Record the worktree's canonical absolute path and route every task-related read, edit, command, test, generated artifact, Git operation, review fix, and conflict resolution to it.
  2. Keep one task in one checkout. After isolation begins, do not make part of the task in the main checkout. Assign unrelated discoveries separately.
  3. Give every writing lane a unique branch and worktree. Parallel readers may share a worktree. Prefer one coordinating writer per worktree. Separate independent writers when their changes do not share a commit or integration fate.
  4. Assign one lifecycle owner. The actor that creates or explicitly adopts a worktree owns its removal. Other workers must not move, unlock, prune, delete, or repurpose it.
  5. Preserve unfamiliar state. Treat existing worktrees, branches, staged changes, locks, and in-progress Git operations as belonging to someone else unless ownership is positively established.
  6. Finish with integration. Coding, commits, a pushed branch, or an open review are intermediate states. Unless the user explicitly requests a handoff-only endpoint, do not call the task complete until the work is integrated, verified in its integrated form, and cleaned up.

Decide whether isolation helps

Use a worktree for an implementation task that must leave the current checkout undisturbed, for an independent parallel writing lane, or when the user explicitly requests one.

Do not create worktrees merely to parallelize read-only research, planning, or review. Worktrees add coordination and integration cost; use them when separate mutable state earns that cost.

Read the full file on GitHub · 175 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. 7d ago First seen · 175 lines · 118 tokens per session scan A d26a00ce8db9

Subscribe to this mod's changes

git-worktree is a skill published in the GitHub repository bahayonghang/my-ai-cli-toolkit (16 stars, last pushed today), licensed MIT. It adds 118 tokens to every session and 1,597 once invoked, about $0.0006 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-09-04.

Related

Other skills, from other repositories

prowler-commit

Creates professional git commits following conventional-commits format. Trigger: When creating commits, after completing code changes, when user asks to commit.

prowler-cloud/prowler · 33 tokens

gh-auth-isolation

Safely manage multiple GitHub identities (EMU + personal) in agent workflows.

github/gh-aw · 20 tokens

comet-github

A routing guide for Comet-related GitHub work. It directs requests about pull requests, issues, CI failures, ideas, and fixes to the appropriate review or implementation process.

rpamis/comet · 72 tokens

github-skill

Work with GitHub via the gh CLI — clone repositories, create/list/merge pull requests, create/list issues, and run any other gh command (API calls, workflow runs, releases, repo administration). List operations return parsed JSON.

zeenie-ai/OpenCompany · 51 tokens

re0-merge

Review and land an external contribution the way this suite does: gate it against the thesis, land it with the author's credit intact, complete a new skill rather than merging it raw, then approve, credit, and explain before closing. Use when reviewing a pull request, as any collaborator or maintainer, not only the…

LilMGenius/paperthin · 70 tokens

nvca-chart-release

Release NVCA Operator chart changes from the native monorepo source to the vendored Helm chart. Use when updating the vendored NVCA Operator chart, changing NVCA image refs, publishing helm-nvca-operator, or validating the chart against a self-managed control plane.

NVIDIA/nvcf · 61 tokens