with one click
cleanup-branches
Batch git branch cleanup - generates single approval script
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Batch git branch cleanup - generates single approval script
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Process autonomous task queue from do-work/ folder
Enter plan mode for complex tasks (pour energy into the plan for 1-shot implementation)
Initiate autonomous PR review process with Codex agent
Run comprehensive repo assessment with Codex (every 3 PRs)
Comprehensive security audit covering 10 threat categories
Install all automation for a new repo (git hooks + GitHub Actions)
| name | cleanup-branches |
| description | Batch git branch cleanup - generates single approval script |
Created: 2026-02-09-00-00 Last Updated: 2026-02-09-00-00
This skill analyzes git branches and generates a SINGLE bash script for you to approve and run, eliminating the need for individual permission approvals on each git branch -D command.
Analyze all local branches
Categorize branches for deletion
Safe to delete (merged):
Stale branches:
Pattern-based candidates:
Generate cleanup script
Present summary + script
#!/bin/bash
# Git Branch Cleanup Script
# Generated: [timestamp]
# Review carefully before running!
echo "🔍 Branches to be deleted:"
echo ""
# === MERGED BRANCHES (Safe) ===
echo "Merged branches (safe):"
git branch -D feature/completed-work # Merged to main on 2026-01-15
git branch -D bugfix/old-fix # Merged to main on 2026-01-10
# === STALE BRANCHES (No remote, >14 days) ===
echo ""
echo "Stale branches (no remote, >14 days old):"
git branch -D temp-experiment # Last commit: 2025-12-20
git branch -D wip-abandoned # Last commit: 2025-12-15
# === PATTERN-BASED ===
echo ""
echo "Pattern-based cleanup:"
git branch -D test-something # Matches test-* pattern
echo ""
echo "✅ Cleanup complete! Deleted X branches."
NEVER run git branch -D commands directly - This skill ONLY generates scripts for user approval.
Safety checks before including in script:
# In any git repository
/cleanup-branches
# Review the generated script
# Copy and run if approved
When invoked, perform these steps:
git branch -a to get all branchesgit branch --merged main (or master)git for-each-ref --format='%(refname:short) %(upstream:track)' refs/heads/git log -1 --format=%ci <branch> for last commit dateDo NOT:
Example output:
📊 Branch Analysis Complete
Found 40 total local branches:
- 11 merged to main (safe to delete)
- 8 stale (no remote, >14 days old)
- 3 pattern-based (temp-*, test-*)
- 18 active (keeping)
Generated cleanup script below ↓
Copy and run this script to delete 22 branches:
[script here]
⚠️ Review carefully before running!