Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

cleanup-loose-branches

БесплатноБез исполняемых скриптовНе проверен

Survey every place loose work hides in a git repo — starting with the current checkout's own uncommitted/untracked/unpushed work, then local branches, all…

peteromalletот peteromallet★ 99 звёзд на GitHub

Об этом скилле

cleanup-loose-branches

TL;DR — Survey every loose-work location read-only → fan out DeepSeek subagents to classify each as land / cherry-pick / delete / keep → write a consolidation plan → execute it (useful work onto a branch, everything else staged ready-to-delete). Nothing is deleted without your explicit per-item OK.

The four phases — do this, in order

Run these four phases in order. Lean on DeepSeek subagents in every phase — they are the cheap default for reading wide, understanding nuances, and untangling supersession, not a heavyweight escalation. Flip "should a subagent do this?" into "is there any reason it can't?" Start the survey immediately — don't ask "want me to look around?" or "should I make recommendations?"

  1. Survey (read-only). Sweep every place loose work hides — current working tree, worktrees, branches, stashes, remotes/PRs, interrupted ops, submodules, detached HEADs, sibling repos, other clones, the megaplan-cloud machine, codespaces. Produce the raw map. Subagents: fan the survey sections across DeepSeek agents so the main thread stays lean — one agent per area, read-only.
  2. Investigate & classify (DeepSeek fan-out → go/no-go). For every item with real ambiguity (supersession, "is this useful?", conflict surface, cloud-only work), fan out read-only DeepSeek briefs — one decision area per agent — to convert uncertainty into a verdict. Collapse the whole survey into a decisive table: land / cherry-pick / delete / keep. The goal of investigation is a go/no-go decision, not more notes. Subagents: the most subagent-heavy phase.
  3. Strategy (write the merge plan). Write a durable consolidation plan: where every valuable piece lands, the merge order, how to handle complex/overlapping merges (shared bases, divergent test contracts), and what's junk-ready vs. keep. The plan doc — not the chat — is the source of truth. Subagents: use DeepSeek to map supersession and conflict surfaces, and to draft the plan.
  4. Execute (run the merges). Work the plan, lowest blast-radius first. Land every useful piece onto the consolidation branch (merge/cherry-pick/PR until tests pass). Everything else is staged ready-to-delete — not deleted: deletion waits for explicit per-item approval. Subagents: hand the heavy merge/conflict/test loops to agents in parallel where the work is independent.

Stop and ask the user at two points only: the Phase 2 → Phase 3 handoff (before you commit to a consolidation strategy), and before any destructive action in Phase 4.

Goal: land every loose piece of work on main or drop it. Never delete without explicit per-item approval.

The bias is STRONGLY toward landing on main. The target end-state is: everything valuable is on main, and the only things not on main have a specific, stated, good reason (genuinely abandoned, superseded by better work, or a deliberate not-yet-ready effort the user named). "It would take a lot of work to consolidate" is not a good reason — it is the expected cost of this skill. Be happy to spend lots of time refactoring, untangling, resolving conflicts, rewriting tests, and reconciling divergent work to get it onto main. A clean main that absorbs the loose work is worth hours of careful consolidation. Parking work on a branch "for later" is the lazy outcome and usually the wrong one — prefer to do the integration now. Reach for subagents (subagent-launcher) to parallelize the heavy investigation so the effort is cheap, but do not let the size of a consolidation talk you out of it.

Dirty work is not "preserved" as the outcome — it is merged or dropped. When this skill says to preserve uncommitted work, that means make a temporary safety checkpoint before risky integration, not "park it on a WIP branch and call the cleanup done." The decision you owe the user is: how will this dirty payload land on main, or what exact parts are junk to delete? For every dirty checkout/worktree, classify paths into mergeable units, identify junk with positive evidence, plan the integration order, and run the needed merge/test/fix loop. A checkpoint branch, patch, or scratch worktree is only a seatbelt while merging; it is not a final recommendation.

What "loose work" means — read this first. Loose work is anything that exists in only one place. The name says "branches" but branches are the least of it. Rank by how easily it is lost, highest first:

  1. Uncommitted changes in the current checkout's working tree — committed nowhere, pushed nowhere. One git checkout . away from gone. THE most exposed work in any repo, and the one a "branch survey" skips by construction. Always survey this. It is item zero, not out of scope.
  2. Untracked files (git ls-files --others) — same exposure, plus invisible to git diff.
  3. Uncommitted work in other worktrees — same as #1 but easier to forget because it'
Полный SKILL.md на GitHub

Установить cleanup-loose-branches в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл cleanup-loose-branches?

Survey every place loose work hides in a git repo — starting with the current checkout's own uncommitted/untracked/unpushed work, then local branches, all worktrees (`.megaplan-worktrees`, `.megaplan/bakeoffs/*`, agent-tool worktrees), stashes, detached HEADs, interrupted rebases/merges, submodules, remote branches on origin and other remotes, fork PR refs, sibling repo variants, other clones of this repo elsewhere on disk, the megaplan-cloud machine (Hetzner box) and every workspace on it, and GitHub Codespaces — classify each as land-on-main / delete / parked with reasoning, and act only on explicit per-item approval. Use when the user says "clean up loose branches", "prune branches", "what branches can I delete", "clean up worktrees", "review my stashes", "what's lying around in this repo", or asks for branch / worktree / stash housekeeping.

Как установить скилл cleanup-loose-branches?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл cleanup-loose-branches запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить cleanup-loose-branches с