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
- Clean Worktrees (Automatic) — Automatically remove all worktrees for branches merged into master 25.5k ★
- Container Use — by dagger - Development environments for coding agents 3.6k ★
- CCometixLine — A high-performance Claude Code statusline tool written in Rust with Git integration and real-time usage tracki 2.4k ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Repo Clean Up
Remove failed/canceled GitHub Actions runs and stale remote branches
Create Worktrees
by evmts - Creates git worktrees for all open PRs or specific branches, handling branches with slashes, cleani
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
Bm
Ask basemind anything about the current codebase — outlines, refs, callers, git history, blame, diffs, docs, m
Catalog Add
Research one stack, verify the candidates, and propose the additions as a pull request
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