branch-cleaner
БесплатноБез исполняемых скриптовНе проверенUse when the user asks to list, audit, prune, or delete local or remote Git branches, especially stale, merged, gone-upstream, protected, worktree-bound, or…
Об этом скилле
Branch cleaner
Workflow
- Resolve the repository, current branch, remote, and remote default branch from Git. Ask only when they remain ambiguous.
- Fetch and prune remote-tracking refs, then collect evidence:
git status -sbgit worktree list --porcelaingit branch --merged <remote>/<default>andgit branch --no-merged <remote>/<default>git for-each-ref refs/heads --sort=committerdate --format="%(committerdate:iso8601) %(refname:short) %(upstream:short) %(upstream:track)"
- When GitHub context is available, prefer the GitHub connector for open/merged PR metadata and branch protection context. Use
ghonly as a fallback. - Exclude the current branch, the default branch, branches checked out in any worktree, protected branches or rulesets, and branches with open PRs. If open-PR or protection state cannot be verified, keep the branch report-only.
- Group candidates by evidence:
- merged into the fetched default branch;
- upstream gone;
- old but unmerged, which is report-only unless the user explicitly approves force deletion.
- Present concrete branch names, last commit dates, merge state, and local/remote scope before deleting anything.
- Delete only approved candidates:
- immediately before each deletion, fetch current evidence and recheck the branch tip SHA, worktree use, open PRs, and protection or ruleset state against the reviewed candidate;
- skip the branch if its tip or state changed, or if any safety check is unavailable;
- local merged branch:
git branch -d <branch>; - remote branch:
git push <remote> --delete <branch>only when remote deletion was explicitly requested; - use
git branch -Donly for an individually named unmerged branch explicitly approved by the user.
- Re-run the candidate commands and
git status -sbto verify the result.
Safety
- Treat age as a review signal, never proof that a branch is safe to delete.
- Never delete through an unresolved glob or a generated command string.
- Do not remove a branch used by another worktree.
- Do not delete remote branches or force-delete unmerged branches without explicit approval.
- Preserve unrelated working-tree changes.
Deliverable
Report deleted branches, skipped branches with reasons, commands run, and any candidates still needing a decision.
Установить branch-cleaner в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл branch-cleaner?
Use when the user asks to list, audit, prune, or delete local or remote Git branches, especially stale, merged, gone-upstream, protected, worktree-bound, or open-PR branches. Identifies safe candidates and performs only explicitly authorized cleanup.
Как установить скилл branch-cleaner?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл branch-cleaner запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic