← ClaudeAtlas

pr-cleanuplisted

Tear down local and remote branch state after a pull request is finished, in one of two modes. Mode A (merged): verify the PR actually merged, remove the branch's worktree, resync the default branch, and delete the local branch. Mode B (closed / abandoned): close the PR(s), then delete every trace — worktree, local and remote branches, planning scratch. Mode B runs ONLY on an explicit user request to abandon the work — the user says "close the PR", "abandon this", "scrap it". Never infer abandon intent from a PR merely being stale, red, or unreviewed. Trigger on "the PR was merged", "clean up the branch", "delete the merged branch", "close those PRs", or "/pr-cleanup".
bostonaholic/team · ★ 11 · AI & Automation · score 75
Install: claude install-skill bostonaholic/team
# pr-cleanup — post-PR teardown > Follow `skills/principle-progress-tracking/SKILL.md`: this procedure has more than two steps — > seed one todo item per step below before starting and mark each complete as you go. Tidy up git state after a feature branch's PR is finished, in either of two modes: - **Mode A — merged.** The work landed upstream: remove the branch's worktree, resync the default branch, and delete the local feature branch. Squash merges create a new commit hash that is not in the branch's history, so `git branch -d` refuses; the merged-PR gate below is what makes `-D` acceptable. - **Mode B — closed / abandoned.** The user is discarding the work: close the PR(s), then delete every trace — worktree, local and remote branches, planning scratch. ## Input `$ARGUMENTS` is one of: - A PR number (digits only) — resolve its head branch via `gh`. - A full PR URL — same resolution. - A branch name. - Nothing — default to the branch checked out in the invoking directory (step 0 captures it as `$INVOKE_BRANCH` before commands are anchored to the primary clone). Refusals, before anything else runs: - **The PR is open and should stay open.** Cleanup is for finished work; tell the user to merge or close first. - **Malformed input.** A PR number that is not digits-only, or a URL that does not parse, is reported — never guessed at. Gate every `$NUMBER` mechanically before it reaches a `gh` command, and terminate the consuming `gh` invocation with