worktree-end

worktree-end is a skill for Claude Code from nirecom/agents. It costs 20 tokens per session (2,041 once invoked), scanned C, original, MIT.

A workflow for finishing a Git worktree task, including checking ignored files, merging the work, and removing the worktree.

In plain words
What is it for?
Completing worktree-based tasks, merging changes, and cleaning up the finished worktree.
Why use it?
It provides a consistent way to close parallel development work without losing required local state.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions subagents.

Good fit Completing worktree-based tasks, merging changes, and cleaning up the finished worktree.

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

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-end

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/nirecom/agents/worktree-end"><img src="https://agentmods.dev/badge/skills/nirecom/agents/worktree-end.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00020 $0.02041
Opus 5.5 $0.00008 $0.00816
Sonnet 5.5 $0.00004 $0.00408
Haiku 4.5 $0.00002 $0.00204

Measured 7d ago against content hash 8622e0c6978b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

worktree-end scanned grade C with 1 finding 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.

The scan reads SKILL.md. This mod also ships 7 executable files (scripts/capture-env.sh, scripts/detect-restart.sh, scripts/extract-pr-fields.js, …), 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Use `hooks/cleanup-orphan-dir.js` for orphan directory cleanup — never `rm -rf`.
skills/worktree-end/SKILL.md · 94 lines

How it starts

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

Inventory gitignored state, then remove the worktree safely once /merge-to-main has delivered the change.

Procedure

When a hook blocks a sanctioned command, a fallback path is taken, or any unexpected outcome occurs, report via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).

Read rules/github-issues.md before WE-4 — on-demand-only, never auto-injected; WE-4 and WE-7 depend on it. Read rules/mid-workflow-findings.md before WE-6 — on-demand-only, never auto-injected; WE-6 depends on its append CLI and severity tagging. Read rules/coding.md before WE-4 — on-demand-only, never auto-injected; its Public GitHub Rules govern the issue comments and history entries written from here on.

Precondition — delivery settled

Run node "$AGENTS_MAIN_ROOT/bin/workflow/next-step" --session "<session-id>". REASON= other than cleanup (merge_to_main not settled) → stop and follow its ACTION; never merge or push from this skill.

WE-1 — Resolve <PLANS_DIR>

Run bash "$AGENTS_MAIN_ROOT/bin/workflow-plans-dir" once as one bare command and reuse its printed path — never assign it to a shell variable, which does not survive to the next Bash call. Canonical: skills/_shared/resolve-plans-dir.md.

WE-2 — Pre-flight

  • gh --version — abort with installation guidance if not found; for a gitlab remote (node "$AGENTS_MAIN_ROOT/bin/detect-forge-type" --repo-dir . --field type = gitlab) check glab --version instead.
  • Verify linked worktree: git rev-parse --git-common-dir must differ from git rev-parse --git-dir; if equal, abort.

WE-3 — Unstaged tracked-file check

Run bash "$AGENTS_MAIN_ROOT/bin/check-unstaged-tracked.sh" "$WORKTREE_PATH". rc=0 → continue. rc=1 → display stdout and abort (git add / git stash push -u / <<WORKFLOW_ENFORCE_WORKFLOW_OFF: {reason}>> to bypass). rc=2/3 → surface stderr and abort. Skip when WORKFLOW_OFF or WORKTREE_OFF session marker is active.

WE-4 — PR number resolution

Run node "$AGENTS_MAIN_ROOT/bin/workflow/pr-state" (read-only, any forge); read PR_STATE= and <PR_NUMBER> from PR_NUMBER=. PR_STATE=NONE → bootstrap delivery (/merge-to-main MM-3b pushed the branch as the default branch): set BOOTSTRAP_MODE=1 and BOOTSTRAP_COMMIT_SHA from git rev-parse HEAD for WE-8. PR_STATE=UNKNOWN (lookup failed) → stop and surface its stderr; never treat it as bootstrap. Never push or create a PR here.

Read the full file on GitHub · 94 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 Changed · -18 lines · -2 tokens per session 8622e0c6978b
  2. 9d ago Changed 3b58aed5cb63
  3. 11d ago Changed eb1e52b2f224
  4. 17d ago Changed 12c04b706c6f
  5. 21d ago Changed 0509cfcb4fa3
  6. 25d ago Changed · +2 lines 96bff747e989
  7. 29d ago Changed · +1 lines 94a03febef56
  8. 1mo ago Changed 1e6a340c8f90
  9. 1mo ago Changed d13a58188d80
  10. 1mo ago First seen · 109 lines · 22 tokens per session scan C f7991099065d

Subscribe to this mod's changes

worktree-end is a skill published in the GitHub repository nirecom/agents (3 stars, last pushed today), licensed MIT. It adds 20 tokens to every session and 2,041 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.