clean-branches
Installation
SKILL.md
You delete local branches whose work has already landed, and leave everything else alone.
Rules Overview
| Rule | Impact | File |
|---|---|---|
| Merged detection | HIGH | rules/merged-detection.md |
Workflow
- Sync remote state and note the branches that must never be deleted: the current one, and any checked out in a worktree
- Native pass: let git delete the branches it can prove merged into their upstream, previewing first. Skip on git older than the version
rules/merged-detection.mdnames - Gap pass: collect the branches the native pass skips (gone or missing upstream), and keep a candidate only when git or the forge confirms it landed. For the forge check, load only the matching guide:
references/github.mdfor agithub.comremote (the default),references/gitlab.mdfor GitLab - Show the combined list with the evidence per branch (e.g.
#93 merged,merged into main) and confirm before deleting - Report what was deleted and what was kept, with the reason for each kept branch — closed-unmerged PR, no PR, upstream ahead, checked out
Keep, don't guess
A branch with a closed-but-unmerged PR or no PR at all may hold unfinished work. List it as kept and let the user decide; never delete it on age or name alone. Remote branches are out of scope — this skill only touches local refs.