Clean Branches — Git skill for Claude Code
Safely prune merged and stale Git branches: drop dead remote-tracking refs, list merged candidates for review, then delete with the safe -d variant.
How to install Clean Branches
Installs to ~/.claude/skills/imtiazrayhan-agentscamp-library-clean-branches/SKILL.md
mkdir -p ~/.claude/skills/imtiazrayhan-agentscamp-library-clean-branches && curl -fsSL https://raw.githubusercontent.com/imtiazrayhan/agentscamp-library/HEAD/commands/clean-branches.md -o ~/.claude/skills/imtiazrayhan-agentscamp-library-clean-branches/SKILL.md Restart Claude Code, or start a new session, for it to be picked up.
What Clean Branches does
description: "Safely prune merged and stale Git branches: drop dead remote-tracking refs, list merged candidates for review, then delete with the safe -d variant." allowed-tools: "Bash, Read"
This command takes no arguments. It prunes branches that are demonstrably safe to remove and hands everything else back for a human decision. The default posture is to delete nothing you cannot prove is merged.
Scope
Ignore `$ARGUMENTS` — this command takes no input. Operate on the current rep
Alternatives in Git
- Container Use — by dagger - Development environments for coding agents 3.6k ★
- Create Worktrees — by evmts - Creates git worktrees for all open PRs or specific branches, handling branches with slashes, cleani 440 ★
- Worktree Rm — Remove a git worktree and optionally delete its branch 387 ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Prune Stale Branches And Worktrees
Prune stale git branches (merged, abandoned, or older than 30 days with no open PR) and stale git worktrees. S
Mise Clean
Sweep the project for hygiene cruft — junk tracked in git, backup/scratch files, stale branches and orphaned w
Branch Cleanup
Clean up merged, stale, and orphaned git branches. Protects main/develop/release/ automatically. Supports --dr
Git Timelog
Task and time tracking for agentic coding. Claude Code, Codex, Gemini CLI and Cursor sessions and git branches
Repo Insights
Generate a grounded, on-command repo insights report for Legion Wallpaper - the actualized variant of /insight
Harness Drift
Continuous-drift sweep — arch warnings, dead code, and Sonar drift outside the PR lifecycle
Related Agents
Branch Janitor
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes
Light Md PruneClaudeMD
Use this agent to prune and tighten a CLAUDE.md (or any agent/skill instruction markdown): cut bloat and dupli
Refactor Cleaner
Dead code cleanup and consolidation specialist. Use PROACTIVELY for removing unused code, duplicates, and refa