cleanup

cleanup is a skill for Claude Code from mikestankavich/claude-ship-workflow. It costs 0 tokens per session (5,512 once invoked), scanned A, original, MIT.

Instructions for cleaning up after a merged pull request, including returning to the base branch and removing completed Git work.

In plain words
What is it for?
Use them to remove the finished worktree and branch, find stale branches or worktrees, and report the related tracker state.
Why use it?
They prevent leftover branches and worktrees from cluttering the repository, while checking that the changes were truly merged first.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Part of the csw plugin — 5 skills shipped together

Good fit Use them to remove the finished worktree and branch, find stale branches or worktrees, and report the related tracker state.

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

Made for: Claude Code.

Or install csw, the plugin that ships this one along with the rest of its 5 skills.

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 cleanup

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mikestankavich/claude-ship-workflow/cleanup"><img src="https://agentmods.dev/badge/skills/mikestankavich/claude-ship-workflow/cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,512 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.00000 $0.05512
Opus 5 $0.00000 $0.02756
Sonnet 5 $0.00000 $0.01102
Haiku 4.5 $0.00000 $0.00551

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

Security

Grade A, and why

cleanup 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/cleanup/SKILL.md · 392 lines

How it starts

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

Clean up after a merged pull request

Announce at start: "Using csw:cleanup to close out ."

Once the merge is confirmed, branch and worktree cleanup happens without asking. Closing a ticket always asks. Those two rules are not symmetric and the asymmetry is deliberate. Confirming the merge is itself the one precondition cleanup checks before it removes anything — that check is not optional, even though most of the time it passes instantly.

Step 1: Confirm the merge, then note where you are

Before anything is removed, establish that the PR for this branch is actually merged:

gh pr view --json state,mergedAt

If this run was chained straight from csw:merge, the merge is already confirmed there — say so, and this check simply passes; the chained path stays frictionless.

The only thing that authorises deletion is gh pr view reporting state: MERGED. Anything else is a stop-and-ask: a non-merged state, no PR for this branch, or the command failing for any reason — no auth, no configured remote, a network error, or anything else. Command failure is not "no signal, treat it as merged" — it is exactly the same stop as an explicit non-merged state. No substitute may be used to establish the merge instead: not git log --merges, not git branch --merged, not reading the PR page. Only gh pr view reporting state: MERGED counts.

If the check does not clear, stop. Name the branch and what you found — including the raw error if the command itself failed — and ask whether to clean up anyway. This is the one case where branch and worktree cleanup asks: git branch -d refuses an unmerged branch on its own, but nothing stops git worktree remove from deleting the checkout that holds someone's unlanded work, and the worktree carries no such protection of its own.

Once the merge is confirmed:

git rev-parse --show-toplevel     # this worktree's path
git branch --show-current         # the branch about to be deleted
csw-config get baseBranch

Read the full file on GitHub · 392 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 · +82 lines 036ae6c4a28c
  2. 9d ago First seen · 310 lines · 0 tokens per session scan A 3f7806dc6c17

Subscribe to this mod's changes

cleanup is a skill published in the GitHub repository mikestankavich/claude-ship-workflow (3 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 5,512 tokens. 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.