prune-branches

prune-branches is a skill for Claude Code from ostin-pil/aboard. It costs 22 tokens per session (984 once invoked), scanned A, original, Apache-2.0.

A cleanup tool for deleting local Git branches that have already been merged into the main branch. Local branches are separate lines of work stored in your copy of a repository.

In plain words
What is it for?
Use it after merged pull requests, while on an up-to-date main branch, to safely identify and remove merged local branches.
Why use it?
It removes stale branches that clutter Git commands and can make the repository status confusing.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Good fit Use it after merged pull requests, while on an up-to-date main branch, to safely identify and remove merged local branches.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ostin-pil/aboard/prune-branches
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 ostin-pil/aboard --skill prune-branches
Clone the repo
git clone --depth 1 https://github.com/ostin-pil/aboard

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 prune-branches

README.md
[![agentmods](https://agentmods.dev/badge/skills/ostin-pil/aboard/prune-branches.svg)](https://agentmods.dev/skills/ostin-pil/aboard/prune-branches)
Your own site
<a href="https://agentmods.dev/skills/ostin-pil/aboard/prune-branches"><img src="https://agentmods.dev/badge/skills/ostin-pil/aboard/prune-branches.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 984 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.00022 $0.00984
Opus 5 $0.00011 $0.00492
Sonnet 5 $0.00004 $0.00197
Haiku 4.5 $0.00002 $0.00098

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

Security

Grade A, and why

prune-branches 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.

.claude/skills/prune-branches/SKILL.md · 44 lines

How it starts

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

Post-merge hygiene. This repo's workflow (work on feature/session-N-* / track-* branches → PR from the ostin-pil fork → merge commit on GitHub → pull main) leaves stale local branches every cycle. They clog git branch and produce confusing git status "ahead N" lines because they still track the now-merged PR head.

The non-obvious trap this skill exists to encode: git branch -d will refuse a fully-merged branch ("not fully merged") when that branch's upstream is the stale/merged PR head — even though the branch is merged into main (HEAD). git branch --merged main is the truth; for branches it lists, -D is safe even when -d balks.

Argument

$ARGUMENTS — optional --yes to skip the force-delete confirmation (non-interactive use). Anything else is ignored.

Preconditions — all must hold; abort (delete nothing) otherwise

  1. On main. git branch --show-current is main. Else abort: "switch to main first — pruning runs from main".
  2. main == origin/main. git fetch origin main then git rev-list --left-right --count origin/main...main is 0 0.
    • Behind → abort: "local main is behind origin/main; pull first — 'merged into main' would be measured against a stale main".
    • Ahead → abort: "local main has unpushed commits; resolve first".
  3. Clean tree. git status --porcelain is empty. Else abort.

Abort = print the reason and stop. No deletions on a stale or dirty main.

Steps

  1. Compute the merged set (source of truth). git branch --merged main | grep -vE '^\*| main$' (trim whitespace). This is the only set eligible for deletion. Empty → print "no merged local branches to prune" and stop.
  2. Record recovery SHAs. For each candidate, git rev-parse --short <branch>. Print the name→SHA table and note: recoverable for ~90 days via git branch <name> <sha> / git reflog.
  3. Safe pass (batch). Run git branch -d on all candidates in one command. Capture which were Deleted and which were refused ("not fully merged").
  4. Reconcile refusals. Every refused branch must still be in the step-1 merged set — -d refused only because the upstream is the stale PR head, not because of unmerged work. Compute refused ∖ merged-set: it must be empty. If any refused branch is not in the merged set, that is an anomaly — do not delete it; report it and keep it.
  5. Force pass (verified subset only). If the refused-but-merged subset is non-empty, confirm via AskUserQuestion (skip the prompt if --yes was passed). The confirm option's description must explain why it is safe — e.g. "Refused by -d only because their upstream is the stale pre-merge PR head, not because they hold unmerged work; git branch --merged main confirms they are in main; local-only; recoverable via reflog." On confirm: git branch -D <subset>. On decline: keep them, report.
  6. Report. Deleted (with SHAs), force-deleted (with SHAs), kept and why. Confirm git branch -r is unchanged — origin is never touched.

Read the full file on GitHub · 44 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 · 44 lines · 22 tokens per session scan A e74eed2e9027

Subscribe to this mod's changes

prune-branches is a skill published in the GitHub repository ostin-pil/aboard (0 stars, last pushed 9d ago), licensed Apache-2.0. It adds 22 tokens to every session and 984 once invoked, about $0.0001 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-08-31.

Related

Other skills, from other repositories

git-wrapup

Land working-tree changes as logical commits — the work grouped by concern, topped by a release commit (version bump, changelog, regenerated artifacts) and an annotated tag. Verify, commit, tag. Stops at "committed and tagged locally" — no push, no publish. The release-and-publish skill picks up from here. Distilled…

cyanheads/reliefweb-mcp-server · 82 tokens

release-and-publish

Ship a release end-to-end across every registry the project targets (npm, MCP Registry, GitHub Releases for .mcpb bundles, GHCR). Runs the final verification gate, pushes commits and tags, then publishes to each applicable destination. Assumes git wrapup (version bumps, changelog, commit, annotated tag) is already…

cyanheads/reliefweb-mcp-server · 112 tokens

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