← ClaudeAtlas

finish-branchlisted

Wrap up a completed development branch by verifying tests pass, detecting the workspace state, then presenting clear merge / PR / keep / discard options and executing the chosen one safely, including correct worktree and branch cleanup. Use when implementation is done, tests should be green, and you need to integrate or put away the work.
KhaledSaeed18/dotclaude · ★ 5 · AI & Automation · score 77
Install: claude install-skill KhaledSaeed18/dotclaude
Bring a finished branch to a clean conclusion: confirm the work actually passes, figure out what kind of workspace you're in, offer the user a small set of concrete options, and carry out their choice without losing anything. The shape is always the same: verify, detect, present, execute, clean up. ## Step 1: Verify tests before offering anything Run the project's full test suite (`npm test` / `cargo test` / `pytest` / `go test ./...` as appropriate). If anything fails, stop here: show the failures and say the work can't be merged or turned into a PR until they pass. Don't present the options menu over a red suite. (The `verify-completion` skill is the standard: run it, read the output, then proceed.) ## Step 2: Detect the workspace state ```bash GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P) GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P) ``` - `GIT_DIR == GIT_COMMON`: a normal repo checkout; no worktree to clean up. - `GIT_DIR != GIT_COMMON`, on a named branch: a linked worktree; cleanup depends on who created it (Step 5). - `GIT_DIR != GIT_COMMON`, detached HEAD, externally managed; offer the reduced menu and don't clean up. Also determine the base branch the work split from: ```bash git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null ``` If it's ambiguous, ask: "This branch came off `main`: correct?" ## Step 3: Present the options For a normal repo or a named-branch worktree, present exactly