← ClaudeAtlas

ss-cleanuplisted

Use after development work is finished to confirm the PR/MR is merged (offering to merge it if not), return to the main checkout on an up-to-date default branch, remove the development branch's worktree, and delete the spent branch — both locally and, optionally, on the remote. Exits immediately with nothing to do if there's no development branch or worktree to clean up.
lbk-open/super-spec · ★ 1 · AI & Automation · score 65
Install: claude install-skill lbk-open/super-spec
# Cleanup After Development Wrap up finished work: confirm the PR/MR is merged (offer to merge it if it's still open), return to the main checkout on the up-to-date default branch, remove the development branch's worktree if it has one, and delete the spent branch locally and, optionally, on the remote. **Core principle:** never delete a branch whose work isn't safely landed. A branch is only safe to delete once its PR/MR is merged, or the user explicitly confirms abandoning unmerged work. The same applies to a dirty worktree — uncommitted changes are only discarded after explicit confirmation. ## Inputs - `--merge`: if the branch's PR/MR is open/draft, merge it without asking first. - `--delete-remote`: also delete the remote branch if it still exists after the merge. - `--force`: skip confirmation before discarding a dirty worktree or deleting an unmerged branch. ## Step 0 — Fast exit: nothing to clean up ```bash git fetch origin --prune CURRENT=$(git branch --show-current) BASE=$(git remote show origin | grep 'HEAD branch' | awk '{print $NF}') ``` - Detached HEAD (`CURRENT` empty) → stop, report the detached state and ask what to do. - `CURRENT` already equals `BASE` → there's no development branch to clean up. This is the common case for **lite**-mode work that never left the default branch. Just run `git pull --ff-only origin $BASE` to refresh, report, and exit — no further steps needed. ## Step 1 — Detect the PR/MR state Use the same remote-detection logic as t