Branch janitor
Skill rafaelghif/antigravity-agents/.agents/skills/branch-janitor
Scans for and safely deletes stale or merged local and remote branches.From its SKILL.md
npx -y skills add rafaelghif/antigravity-agents --skill branch-janitorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.5 KB, 302 tokens by cl100k_base, as published. Nobody here has run it
Branch Janitor Skill
Objective
Eradicate leftover stale branches in both local and remote repositories to keep the project clean, solving the exact issue where agents or users forget to clean up feature/ and hotfix/ branches after merging.
When to Execute
- When explicitly requested by the user to "clean up branches".
- As a fallback if the
git-workflowskill failed to delete a branch during its PR merge step.
Execution Steps
- Identify Merged Branches:
- Run
git fetch --pruneto synchronize with remote. - Run
git branch --merged main -rto identify all remote branches that have been merged into main. - Run
git branch --merged mainto identify all local branches that have been merged into main.
- Run
- Safe Deletion Filter:
- MUST ignore
main,master,develop, andstagingbranches. Do NOT attempt to delete them.
- MUST ignore
- Execution:
- For every target local branch:
git branch -d <branch_name> - For every target remote branch (e.g.
origin/feature/abc):git push origin --delete feature/abc
- For every target local branch:
- Verification:
- Run
git ls-remote --heads originto verify no target branches remain. - Update
.agents/brain/audit.jsonlwith the branches that were deleted.
- Run