cleanup-merged-branches — Claude Code skill: how to install
Finds remote branches tied to merged pull requests, runs a dry-run preview, and deletes them only after your direct confirmation. Keeps remote repos clean without accidental data loss.
npx skills add timschoch/skilly --skill cleanup-merged-branches -a claude-codeWhat cleanup-merged-branches does
Branch clutter builds up rapidly when multiple agents work on a repository. This skill inspects remote tracking branches using scripts/plan.sh, selecting branches associated with merged pull requests that lack remaining open PRs. The default branch alongside staging are guarded unconditionally. Before altering remote state, the agent outputs a formatted candidate list and waits for explicit approval.
Task tracking receives a similar cleanup step via scripts/stale-claims.sh. When an agent session crashes or abandons an issue with an in-progress label for over 24 hours without an open PR, the helper strips the tag and assigns ready-for-agent. It also catches issues merged into integration branches that GitHub failed to resolve automatically.
Both bash and the official gh CLI tool must be present in your environment. Without GitHub CLI authorization, inspecting issue states and altering task labels fails immediately.
What it helps with
- prune remote branches after their pull requests are merged
- preview branch candidates via dry-run before deleting remote refs
- reclaim abandoned in-progress issues left behind by aborted agents
- close GitHub issues linked to PRs merged into integration branches
Example prompts for the agent
- Run a dry-run to list remote merged branches ready for cleanup
- Prune merged branches on origin after showing me the plan
- Reap stale in-progress issue claims that have no active pull request
How to install cleanup-merged-branches
1Skills CLI (Vercel)
npx skills add timschoch/skilly --skill cleanup-merged-branches -a claude-code2Manually: put the files in place
~/.claude/skills/cleanup-merged-branches/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cleanup-merged-branches/
1Skills CLI (Vercel)
npx skills add timschoch/skilly --skill cleanup-merged-branches -a codex2Manually: put the files in place
.agents/skills/cleanup-merged-branches/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add timschoch/skilly --skill cleanup-merged-branches -a cursor2Manually: put the files in place
.cursor/skills/cleanup-merged-branches/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install timschoch/skilly cleanup-merged-branches2Manually: put the files in place
.github/skills/cleanup-merged-branches/SKILL.md1Skills CLI (Vercel)
npx skills add timschoch/skilly --skill cleanup-merged-branches -a gemini-cli2Platform CLI
gemini skills install https://github.com/timschoch/skilly --path bundles/workflow/skills/cleanup-merged-branchesManually: put the files in place
.devin/skills/cleanup-merged-branches/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add timschoch/skilly --skill cleanup-merged-branches -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about cleanup-merged-branches
How to install cleanup-merged-branches in Claude Code?
Run npx skills add timschoch/skilly --skill cleanup-merged-branches -a claude-code in your terminal.
What does cleanup-merged-branches do?
It finds remote branches from merged pull requests, shows a dry-run plan, and deletes confirmed branches via git push origin --delete. It also resets abandoned issue labels.
Which branches are protected from deletion?
The default repository branch and staging are guarded against removal. You can register extra protected branches in is_protected() inside scripts/plan.sh.