git-cleanup — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited git-cleanup (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Intelligently identify and remove stale branches, orphaned remotes, and unused worktrees — with confirmation at every step.
Before starting, use the Read tool to read ~/.claude/skills/git-cleanup/preferences.md. If the file does not exist, treat as "no preferences set".
_On startup, use Bash to detect: working directory, git repos in cwd (directories with .git), and current git branch. Skip any that fail._
Check $ARGUMENTS:
~/.claude/skills/git-cleanup/preferences.md, confirm, stopGit Cleanup — Smart cleanup of stale branches, remotes, and worktrees
Usage:
/git-cleanup Auto-detect repos, clean everything
/git-cleanup ai-assemble Clean a specific repo
/git-cleanup just local branches Natural language — local only
/git-cleanup dry run Show what would be deleted
/git-cleanup skip linear Skip Linear issue checks
/git-cleanup ai-assemble remote only Clean only remote branches
/git-cleanup config Set preferences
/git-cleanup reset Clear preferences
/git-cleanup help This help
Smart detection:
- If inside a git repo, uses that repo
- If in a parent directory, scans for git repos and lets you pick
- If one repo found, uses it automatically
Current preferences:
(shown above under Preferences)Use AskUserQuestion to collect:
main, all-demos, develop)AIS-\d+)Save to ~/.claude/skills/git-cleanup/preferences.md.
Delete ~/.claude/skills/git-cleanup/preferences.md and confirm: "Preferences cleared. Using defaults."
If no preferences file exists, show:
First time using /git-cleanup? Run /git-cleanup config to set defaults, or just continue with sensible defaults.Then proceed with defaults:
main, all-demos, developAIS-\d+Parse $ARGUMENTS as natural language. Extract:
Smart repo detection:
$ARGUMENTS contains a path or directory name → use it.git exists) → use current directory.gitFor each repo, collect:
# Protected branches (from prefs or defaults)
PROTECTED="main|all-demos|develop"
# Local branches and their merge status
git branch --format='%(refname:short) %(upstream:track)'
git branch --merged main
git branch --merged all-demos
# Remote branches
git branch -r --format='%(refname:short)'
# Worktrees
git worktree list
# Stale remote tracking
git remote prune origin --dry-runSort every branch into one of these categories:
Safe to delete (green):
[gone] upstream (remote deleted)Probably safe (yellow):
Needs review (red):
For branches matching the ticket pattern (e.g., mostafa/ais-921-... → AIS-921):
mcp__claude_ai_Linear__get_issue to fetch issue statusPresent the Linear context alongside each branch.
Show a categorized summary:
Git Cleanup Plan — ai-assemble
SAFE TO DELETE (merged/gone):
Local:
- feature/old-thing (merged into main)
- fix/typo (remote gone)
Remote:
- origin/feature/old-thing (no local, no PR)
PROBABLY SAFE (closed tickets):
Local:
- mostafa/ais-800-old-task (AIS-800: Done ✓)
Worktrees:
- .pilot-worktree (branch deleted)
NEEDS REVIEW:
- mostafa/ais-922-refactor (AIS-922: In Progress)
PROTECTED (never touched):
- main, all-demos, developIf --dry-run / "dry run" was specified, show this plan and stop.
Use AskUserQuestion to confirm each category:
Q1: "Delete N safe-to-delete branches?" → Yes all / Pick individually / Skip Q2: "Delete N probably-safe branches?" → Yes all / Pick individually / Skip Q3: "Any needs-review branches to delete?" → Pick individually / Skip all
For each confirmed deletion:
git branch -d <branch> (safe delete) or git branch -D <branch> if neededgit push origin --delete <branch>git worktree remove <path>git remote prune originReport each deletion as it happens.
Git Cleanup Complete — ai-assemble
Local branches deleted: 3
Remote branches deleted: 2
Worktrees removed: 1
Stale remotes pruned: yes
Skipped (needs review): 2
Protected: 3The skill is designed to work with any ticketing integration. The core pattern is:
To add a new integration:
allowed-tools~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.