Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add timschoch/skilly --skill cleanup-merged-branches -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/cleanup-merged-branches/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cleanup-merged-branches/

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.

Similar skills

All skills for Git and GitHub →

From the same set16

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor