worktree-merge-cleanuplisted
Install: claude install-skill devseunggwan/praxis
# worktree-merge-cleanup
## Overview
`gh pr merge --squash --delete-branch` does a local checkout of the base branch
(main / dev / prod) in the post-squash stage, and it deletes the local head
branch by reachability against the local base HEAD. Both facts make the command
sensitive to *which worktree* it runs from and *whether the base is synced* —
get either wrong and the merge fails at the git layer or silently skips the
local-branch delete, forcing manual recovery.
This skill is the on-demand home for that procedure. The always-loaded rule set
keeps only a pointer here; the deterministic `--delete-branch` failure mode is
additionally enforced structurally by the `gh-merge-worktree-precondition`
PreToolUse hook (see [Relationship to enforcement](#relationship-to-enforcement)).
**Core principle:** run the post-merge cleanup steps as *separate* Bash calls,
never collapsed into one `&&`-chain — a git hard error mid-sequence
short-circuits the chain and its trailing output is easily misread as success.
## When to Use
- About to merge a PR with `gh pr merge --squash --delete-branch` from an
issue-branch worktree.
- The merge just failed with `fatal: '<base>' is already used by worktree at ...`
or `cannot delete branch 'X' used by worktree at ...`.
- After a squash-merge the local feature branch was not deleted
(`warning: deleting branch 'X' ... not yet merged to HEAD`).
- Cleaning up a worktree that contains a submodule.
## Pre-call checklist
`gh pr merge --squash