← ClaudeAtlas

meta-cleanup-worktreeslisted

Safely clean up DONE git worktrees and branches for this repo — remove only the ones that are provably finished (merged into master, clean, idle, and never the current or main checkout) and tell you which Conductor/Claude sessions you can archive. It lists and CONFIRMS before it deletes anything, never force-deletes, and BLOCKS any worktree with a live session, uncommitted changes, unpushed commits, or an open/unmerged PR. Reuses bin/port-registry.sh + bin/kill-orphan-workers.sh for live-session detection and points to rules/process.md + references/dev-server-hygiene.md for the teardown rules. Use for "clean up merged worktrees", "remove done worktrees and branches", "tidy up my worktrees", "delete merged branches", "which sessions can I archive", or /sk:meta-cleanup-worktrees.
skowalskidev/dotclaude · ★ 2 · Code & Development · score 78
Install: claude install-skill skowalskidev/dotclaude
# Clean up DONE worktrees and branches — safely Sweep the worktrees and branches for THIS repo that are provably finished — merged, clean, and idle — remove them, and name the Conductor sessions for Simon to archive. NEVER touch anything still being worked on. Conservative by construction: it LISTS and CONFIRMS before deleting, and never force-deletes. ## Reuse, don't reimplement - The RULES live in `rules/process.md` §§ "Git worktree discipline" + "Clean up after yourself" (never disturb the main-checkout WIP; tear the worktree down WITH its merged branch in the same step; verify cleanup against on-disk storage, not just `git worktree list`) and `references/dev-server-hygiene.md` (never kill another session's server; storage-vs-listing reconcile). Read them there; do not restate. - For live-worktree detection REUSE `bin/port-registry.sh reap` (exit 5 = workspace gone but its server still listens) and `bin/kill-orphan-workers.sh` (`family_is_serving`). Do not reimplement them. - This GENERALISES `/sk:work-hyperspeed` Step 6 (delete the merged branch local+remote; name the sessions Simon must archive) from hyperspeed's own `hs/<run>/*` branches to any merged worktree/branch. ## Scope This repo only. Conductor worktrees under `~/conductor/workspaces/<project>/*`. Never the main checkout, never the current worktree, never a detached-HEAD or non-Conductor worktree. ## Step 1 — refresh the merge state (one network read) Resolve the default branch (`git symbolic-re