Agent skill · laurigates

git-merge-hazards

Traps in GitHub's merge machinery. Use when merging a PR, merging a stacked PR chain, auditing whether a branch really landed, or merging over red CI.

What it needs

About 9k tokens when loaded.

What this skill does

Git Merge Hazards Read before merging a PR, merging a stacked PR chain, auditing whether a branch really landed, or merging over red CI. The body below is the verbatim text of the promoted ~/.claude/rules/pr-merge-hazards.md rule. Three notes that are not part of that body: Two gates below — §1's merged-ness authority order and the whole of §4 — are also reproduced verbatim in the pr-merge-hazards.md stub, because they are read while the decision is being made. Edit both copies together. §1 overlaps git-plugin:deadbranch Step 1.5 ("Reclassify squash-merged branches"), which carries the same three signals scoped to branch cleanup. §2 and §3 describe ad-hoc chains — PRs whose base is another PR's branch. A stack registered with GitHub (gh stack) retargets its upper PRs itself on merge, so the auto-close hazard and the manual retarget/rebase ordering do not apply there. See git-plugin:git-stacked-prs. The two encoded recipes cited in §1 and §2 below are the author's own (a just -g recipe in laurigates/dotfiles, and a sweep script in laurigates/claude-plugins), not commands a plugin consumer already has. Read the authority ladder in §1 as the instruction; the recipe is a convenience, and its REVIEW bucket measured ~90% false positives (#2268). Four traps in GitHub's merge machinery, one law: "PR merged" says nothing about content — and a red check is not proof of failure. Each: the trap, the 5-second check, the fix. Sibling: ~/.claude/rules/git-hazards.md (local git). 1. --merged misses squash-merged branches A squash-merge collapses a branch into one fresh-SHA commit on main, so the branch's own commits are never ancestors — git branch --merged (and any ancestry check) reports it unmerged. "Files identical to main" also fails once main drifts the same files. Check, in order of authority: gh pr list --state all --head <branch> --json state → a MERGED PR is authoritative. Reach for this first; the git-side checks below are all one-way. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills laurigates/git-merge-hazards

View the source on GitHub

Browse the @skills marketplace