workflow-cleanup-merged

workflow-cleanup-merged is a skill for Claude Code from lugassawan/swe-workbench. It costs 47 tokens per session (7,413 once invoked), scanned A, original, MIT.

A post-merge Git workflow that removes the finished local worktree and branches, deletes the remote branch, and updates local main. It supports pull requests merged with a squash merge.

In plain words
What is it for?
Use it after confirming a GitHub pull request has merged to clean up the local checkout, delete its local and remote branch, and fast-forward main.
Why use it?
It removes leftover branches and worktrees after a pull request is merged, while avoiding deletion when there are uncommitted changes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: names the AskUserQuestion tool; positional $N argument.

Part of the swe-workbench plugin — 62 skills, 26 commands, 23 agents, 5 hooks shipped together

Good fit Use it after confirming a GitHub pull request has merged to clean up the local checkout, delete its local and remote branch, and fast-forward main.

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

Made for: Claude Code.

Or install swe-workbench, the plugin that ships this one along with the rest of its 62 skills, 26 commands, 23 agents, 5 hooks.

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 workflow-cleanup-merged

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/lugassawan/swe-workbench/workflow-cleanup-merged"><img src="https://agentmods.dev/badge/skills/lugassawan/swe-workbench/workflow-cleanup-merged.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,413 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.00047 $0.07413
Opus 5.5 $0.00019 $0.02965
Sonnet 5.5 $0.00009 $0.01483
Haiku 4.5 $0.00005 $0.00741

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

Security

Grade A, and why

workflow-cleanup-merged 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 2d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (scripts/check-rimba-hook.sh, scripts/delete-branches.sh, scripts/probe-worktree.sh, …), 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/workflow-cleanup-merged/SKILL.md · 254 lines

How it starts

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

Workflow: Cleanup Merged Branch

Announce at start: "I'm using the workflow-cleanup-merged skill to clean up after the merged PR."

When to Invoke

  • After the user has confirmed a PR is merged on GitHub.
  • Invoked by /swe-workbench:cleanup-merged (user-triggered, one-off cleanup).
  • Invoked by Mode C orchestration (orchestration.md) at Step 7, after each merge round.

Never auto-trigger. Cleanup is user-initiated or orchestrator-initiated. Do not attach to a Stop hook.

What This Skill Does NOT Do

  • Does not merge PRs — that is the user's action.
  • Does not force-delete branches with uncommitted work — no --force, ever.
  • Does not squash, rebase, or alter commit history.
  • Does not bypass branch protection rules.
  • Does not verify CI status — CI verification happens in Phase 3/4 before the PR is created.

Cleanup Contract

Step 1 — Resolve Target PR

  • If the user passed a PR number → use it directly.
  • Else → derive from current branch:
    gh pr view --json number,state,mergedAt,headRefName,headRepository,body
    
    Extract headRefName as the branch name to clean up.

Step 2 — Verify Merged via gh (Sole Oracle)

gh pr view <number> --json state,mergedAt,headRefName,headRefOid,url,body

Read state == "MERGED" and mergedAt != null. Abort with a clear message if either condition fails. Capture the url-derived owner/repo (the PR record in hand) and headRefOid for Step 5 — swe-workbench-sweep-residuals "$NUMBER" --repo "$OWNER/$REPO" --head-sha "$HEAD_SHA" uses them to scope the backstop sweep by repository and to fingerprint-attribute legacy un-scoped artifacts.

Never use git branch --merged as a merge check. GitHub's default squash-merge strategy creates a new commit SHA on main; the original branch tip is not a merge ancestor of main, so git branch --merged silently lies. gh is the only oracle that does not lie.

Step 3 — Classify the Primary Lease, Free Session, Anchor cwd, Sync Local Main

Read the full file on GitHub · 254 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. 2d ago Changed · +4 lines e7c929c9bb7e
  2. 1mo ago Changed 842089b362e5
  3. 1mo ago Changed · +10 lines 7b3072fca12e
  4. 2mo ago Changed · +2 lines scan C → A fae1bcb7b022
  5. 3mo ago Changed 188fa57a8eb2
  6. 3mo ago First seen · 238 lines · 47 tokens per session scan C 8abfb6774afa

Subscribe to this mod's changes

workflow-cleanup-merged is a skill published in the GitHub repository lugassawan/swe-workbench (3 stars, last pushed 2d ago), licensed MIT. It adds 47 tokens to every session and 7,413 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-09-03.

Related

workflow-cleanup-merged compared with skills from other repositories

workflow-cleanup-merged next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
workflow-cleanup-mergedlugassawan/swe-workbenchSkill32d agoMITA47Claude Code
releasehyhmrright/brooks-lintSkill1.6kyesterdayMITA135Claude Code, Codex
pull-requestzdanovichnick/dotnet-pilotSkill55d agoMITA55Claude Code
branch-finisher10CG/AriaSkill224d agoMITA37Claude Code
branch-manager10CG/AriaSkill224d agoMITC49Claude Code
new-skillhyhmrright/brooks-lintSkill1.6kyesterdayMITA145Claude Code, Codex
architecture-refinertechygarg/latticeSkill219todayMITA114Claude Code