git-cleanup

git-cleanup is a skill for Claude Code, Codex from sutchan/Agent-Skills-Hub. It costs 18 tokens per session (3,058 once invoked), scanned A, a copy of git-cleanup, MIT.

A safety-focused process for reviewing and cleaning up local Git branches and worktrees, which are separate working directories linked to branches.

In plain words
What is it for?
Use it to identify obsolete local branches and worktrees while preserving active work.
Why use it?
It separates merged, related, and active work and requires confirmation before anything is deleted.

Skill for Claude CodeCodex

Written for Claude Code and Codex: allowed-tools in frontmatter, but also agents/openai.yaml present. Also seen: names the AskUserQuestion tool.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is WARNING: ../proj-auth has uncommitted changes:.

Good fit Use it to identify obsolete local branches and worktrees while preserving active work.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sutchan/Agent-Skills-Hub
agentmods
npx agentmods add skills/sutchan/agent-skills-hub/git-cleanup

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/git-cleanup"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/git-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,058 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 97% copy Near-identical to another mod 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.00018 $0.03058
Opus 5 $0.00009 $0.01529
Sonnet 5 $0.00004 $0.00612
Haiku 4.5 $0.00002 $0.00306

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

Security

Grade A, and why

git-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.

Origin

This is a copy

97% identical to git-cleanup — 16 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/git-cleanup/SKILL.md · 364 lines

How it starts

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

Git Cleanup

Safely clean up accumulated git worktrees and local branches by categorizing them into: safely deletable (merged), potentially related (similar themes), and active work (keep).

When to Use

  • When the user has accumulated many local branches and worktrees
  • When branches have been merged but not cleaned up locally
  • When remote branches have been deleted but local tracking branches remain

When NOT to Use

  • Do not use for remote branch management (this is local cleanup only)
  • Do not use for repository maintenance tasks like gc or prune
  • Not designed for headless or non-interactive automation (requires user confirmations at two gates)

Core Principle: SAFETY FIRST

Never delete anything without explicit user confirmation. This skill uses a gated workflow where users must approve each step before any destructive action.

Critical Implementation Notes

Squash-Merged Branches Require Force Delete

IMPORTANT: git branch -d will ALWAYS fail for squash-merged branches because git cannot detect that the work was incorporated. This is expected behavior, not an error.

When you identify a branch as squash-merged:

  • Plan to use git branch -D (force delete) from the start
  • Do NOT try git branch -d first and then ask again for -D - this wastes user confirmations
  • In the confirmation step, show git branch -D for squash-merged branches

Group Related Branches BEFORE Categorization

MANDATORY: Before categorizing individual branches, group them by name prefix:

# Extract common prefixes from branch names
# e.g., feature/auth-*, feature/api-*, fix/login-*

Branches sharing a prefix (e.g., feature/api, feature/api-v2, feature/api-refactor) are almost certainly related iterations. Analyze them as a group:

  1. Find the oldest and newest by commit date
  2. Check if newer branches contain commits from older ones
  3. Check which PRs merged work from each
  4. Determine if older branches are superseded

Present related branches together with a clear recommendation, not scattered across categories.

Read the full file on GitHub · 364 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 364 lines · 18 tokens per session scan A e59537df1a8d

Subscribe to this mod's changes

git-cleanup is a skill published in the GitHub repository sutchan/Agent-Skills-Hub (2 stars, last pushed yesterday), licensed MIT. It adds 18 tokens to every session and 3,058 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to git-cleanup, differing in 16 lines, and is treated as a copy.

Related

Other skills, from other repositories

finishing-a-development-branch

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work.

obra/superpowers · 27 tokens

using-git-worktrees

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback.

obra/superpowers · 36 tokens

skill-upstream-pr

Improve an open-source GitHub skill and open a friendly suggestion PR upstream: fork, run skill-auto-improver, attach asm eval before/after metrics. Don't use for local-only skills, authoring from scratch, bulk repos, or registry publish.

luongnv89/asm · 56 tokens

monorepo-architect

Expert guide for designing and managing scalable monorepos using Turborepo, pnpm workspaces, and shared packages / Panduan ahli untuk merancang dan mengelola monorepo skalabel menggunakan Turborepo dan pnpm workspaces.

roedyrustam/vibes-plug · 57 tokens

git-workflow-and-versioning

Guides git commit discipline, trunk-based branching, and semantic versioning/changelogs for released code, including Go modules' major-version import path rule. Use when committing, branching, resolving conflicts, cutting a release, choosing a semantic version bump, tagging a release, or writing a changelog entry.

shennawardana23/skillme · 68 tokens

incremental-implementation

Builds in thin vertical slices -- implement one piece, test it, verify it, commit, then expand -- instead of writing a whole feature in one pass. Use when implementing any change touching more than one file, when a task feels too large to start, or before writing more than roughly 100 lines without running anything.

shennawardana23/skillme · 70 tokens