git-cleanup

git-cleanup is a skill for Claude Code, Codex from viknesh20-20/claude-code-tool-kit. It costs 32 tokens per session (580 once invoked), scanned A, original, MIT.

A Git repository maintenance assistant. Git is a tool for tracking code changes, while branches are separate lines of work that can be merged or left unused.

In plain words
What is it for?
Use it to find merged or stale branches, prune outdated remote references, review old stashes, and identify large files in repository history.
Why use it?
Old branches, remote references, stashes, and large files can make a repository harder to understand and maintain. It identifies cleanup candidates while requiring confirmation before risky deletions.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/viknesh20-20/claude-code-tool-kit/git-cleanup
Any agent
npx skills add viknesh20-20/claude-code-tool-kit --skill git-cleanup
Clone the repo
git clone --depth 1 https://github.com/viknesh20-20/claude-code-tool-kit

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/viknesh20-20/claude-code-tool-kit/git-cleanup.svg)](https://agentmods.dev/skills/viknesh20-20/claude-code-tool-kit/git-cleanup)
Your own site
<a href="https://agentmods.dev/skills/viknesh20-20/claude-code-tool-kit/git-cleanup"><img src="https://agentmods.dev/badge/skills/viknesh20-20/claude-code-tool-kit/git-cleanup.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 580 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00032 $0.00580
Opus 5 $0.00016 $0.00290
Sonnet 5 $0.00006 $0.00116
Haiku 4.5 $0.00003 $0.00058

Measured 3d ago against content hash 15fbe84b1ca0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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/git-cleanup/SKILL.md · 93 lines

How it starts

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

Git Repository Cleanup

Current State

!git branch -a 2>/dev/null | head -30 !git remote -v 2>/dev/null !git stash list 2>/dev/null


Cleanup Steps

Step 1: Identify Merged Branches

List local branches already merged into main/master:

git branch --merged main 2>/dev/null || git branch --merged master 2>/dev/null

Present the list to the user and ask for confirmation before deleting.

Safe to delete (already merged):

git branch -d <branch-name>

Step 2: Identify Stale Remote Branches

Prune remote tracking refs that no longer exist:

git remote prune origin --dry-run

After confirmation:

git remote prune origin

Step 3: Identify Old Unmerged Branches

List branches with no commits in the last 90 days:

git for-each-ref --sort=committerdate --format='%(committerdate:short) %(refname:short)' refs/heads/ | head -20

Never delete unmerged branches without explicit user approval.

Step 4: Clean Up Stashes

List all stashes:

git stash list

For old stashes (>30 days), suggest review and cleanup.

Step 5: Repository Size Analysis

Check for large files:

git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sort -k3 -n -r | head -20

Step 6: Garbage Collection

git gc --auto

Output

Cleanup Summary

Action Count Status
Merged branches deleted X Done/Pending
Stale remote refs pruned X Done/Pending
Old stashes reviewed X Done/Pending

Branches NOT Deleted (unmerged)

List branches that were skipped with last commit date.

Space Recovered

Before and after repository size (if gc was run).


Rules

  • NEVER force-delete (git branch -D) without explicit user confirmation
  • NEVER delete main, master, develop, or release branches
  • Always show what will be deleted before doing it
  • Prefer --dry-run first, then execute

Read the full file on GitHub · 93 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. 3d ago First seen · 93 lines · 32 tokens per session scan A 15fbe84b1ca0

Subscribe to this mod's changes

git-cleanup is a skill published in the GitHub repository viknesh20-20/claude-code-tool-kit (7 stars, last pushed 4mo ago), licensed MIT. It adds 32 tokens to every session and 580 once invoked, about $0.0002 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.