git-branch-cleanup

git-branch-cleanup is a skill for Claude Code, Codex from gotalab/skillport. It costs 66 tokens per session (2,079 once invoked), scanned A, original, MIT.

A tool for reviewing and safely removing local Git branches. Git branches are separate lines of work in a code repository.

In plain words
What is it for?
Use it to categorize branches, review which ones are safe to remove, select branches interactively, and delete them after confirmation.
Why use it?
It helps identify branches that are merged, old, or no longer linked to a remote repository before deletion.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to categorize branches, review which ones are safe to remove, select branches interactively, and delete them after confirmation.

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

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-branch-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/gotalab/skillport/git-branch-cleanup.svg)](https://agentmods.dev/skills/gotalab/skillport/git-branch-cleanup)
Your own site
<a href="https://agentmods.dev/skills/gotalab/skillport/git-branch-cleanup"><img src="https://agentmods.dev/badge/skills/gotalab/skillport/git-branch-cleanup.svg" alt="Measured on agentmods" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,079 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 197
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
How audits are shown
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.00066 $0.02079
Opus 5 $0.00033 $0.01040
Sonnet 5 $0.00013 $0.00416
Haiku 4.5 $0.00007 $0.00208

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

Security

Grade A, and why

git-branch-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 8d 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.

.skills/experimental/git-branch-cleanup/SKILL.md · 249 lines

How it starts

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

Git Branch Cleanup

Safely organize and clean up local Git branches. Categorizes branches by merge status, staleness, and remote tracking, then guides users through safe deletion.

Contents

  • Quick Start
  • Workflow (Steps 1-5)
  • Commands Reference
  • Dry Run Mode
  • Safety Checklist

Quick Start

  1. Analyze branches (Step 1)
  2. Categorize by safety level (Step 2)
  3. Display results and ask user which to delete (Step 3)
  4. Verify against safety guards (Step 4)
  5. Execute deletion after confirmation (Step 5)

Workflow

Step 1: Branch Analysis

Collect information with these commands:

# Decide base branch (prefer auto-detect; fallback to main)
BASE_BRANCH="$(
  git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@'
)"
[ -n "$BASE_BRANCH" ] || BASE_BRANCH=main

# List all branches with last commit date
git for-each-ref --sort=-committerdate refs/heads/ \
  --format='%(refname:short)|%(committerdate:relative)|%(upstream:trackshort)|%(contents:subject)'

# Merged branches (against base)
git branch --merged "$BASE_BRANCH"

# Unmerged branches
git branch --no-merged "$BASE_BRANCH"

# Branches whose upstream is gone (remote deleted)
git branch -vv | grep -F ': gone]' || true

# List worktrees (branches with '+' prefix in git branch -v have worktrees)
git worktree list

# Branches with worktrees ('+' prefix indicates worktree association)
git branch -v | grep '^+' || true

# Branches ahead of upstream (have unpushed commits)
git for-each-ref refs/heads \
  --format='%(refname:short) %(upstream:trackshort)' \
  | grep '>' || true

Step 2: Categorization

Categorize branches by safety level:

Category Description Safety
Merged (Safe) Already merged to base branch Safe to delete
Gone Remote Remote branch deleted Review recommended
Stale No commits for 30+ days Needs review
Has Worktree Branch checked out in a worktree (+ prefix in git branch -v) Remove worktree first
Ahead of Upstream Has unpushed commits ⚠️ Do not delete
Unmerged Active work in progress Use caution

Read the full file on GitHub · 249 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. 8d ago First seen · 249 lines · 66 tokens per session scan A f1401002fcb1

Subscribe to this mod's changes

git-branch-cleanup is a skill published in the GitHub repository gotalab/skillport (409 stars, last pushed 2mo ago), licensed MIT. It adds 66 tokens to every session and 2,079 once invoked, about $0.0003 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-30.