merge-pr
Skill4 starsChanged 59 days agoMITView on GitHub
Land an open GitHub pull request. Use whenever the user wants to MERGE, land, ship, or close out an open PR: waits for CI, applies corrections until mergeable (red checks, conflicts with the latest `main`, unresolved review), squash-merges, triages follow-ups, and tears down the branch and worktree. Triggers: "merge PR 279", "land #281", "ship this PR", "get that PR merged once CI's green", "wrap up 279 and open follow-ups", « merge la PR 279 », « fais atterrir la 281 », a bare PR link with "merge it". Does NOT apply to opening or implementing a PR, to syncing one STILL BEING BUILT (implement-issue), to reviewing without merging (code-review), or to filing an issue (create-issue).
17 other projects use a version of this.
Adopted by
Most recently taken up by
- mihai-dinculescu/tapotheir own version, first seen Nov 9, 2026
- ddnexus/pagytheir own version, first seen Nov 9, 2026
- ShareX/ShareXtheir own version, first seen Nov 8, 2026
- kdy1/kdy1-scriptstheir own version, first seen Nov 1, 2026
- r3bl-org/r3bl-open-coretheir own version, first seen Oct 17, 2026
- jsirish/workflow-skillstheir own version, first seen Oct 13, 2026
Used with
Projects with it also use commit.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
Other versions17 projects use a version of this.
Word for word · 1
- phmatray/tagout★ 4100% same
Edited · 0
None found.
Wrote their own version · 16
- ShareX/ShareX★ 41ksame name
- cube-js/cube★ 21ksame name
- ddnexus/pagy★ 5ksame name
- mihai-dinculescu/tapo★ 870same name
- bazel-contrib/rules_python★ 692same name
- kkokosa/dotLLM★ 528same name
- r3bl-org/r3bl-open-core★ 486same name
- tbhb/vale-ai-tells★ 118same name
- TermiX-official/cryptoclaw★ 100same name
- kdy1/kdy1-scripts★ 33same name
6 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/tagout.mdcCursor rule
- auto-devSkill
- create-issueSkill
- create-prSkill
- debug-issueSkill
- deliver-issueSkill
- implement-issueSkill
- initSkill
- migrate-legacySkill
- review-followupsSkill
- review-sessionsSkill
- triage-backlogSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 38
Run hands-off once started — the user points at a PR and walks away.
- Very specific: line 45
CI stays red after a real fix attempt: Don't merge over a red bar, don't disable a failing test, don't --admin-override a required check.
- Distinctive: line 63
Create a task per item and work them in order.
- Distinctive: line 111
Stay resumable: Every step keys off live GitHub/git state, so a re-run won't double-merge, double-file, or fail because a branch is already …
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merge a pull request
What this does
implement-issue builds a PR and flips it to ready. This skill is the final step: it lands that PR
cleanly and cleans up after itself. The job isn't just gh pr merge — a PR that's ready isn't
necessarily mergeable minutes later, because main moves, CI runs, and reviewers leave comments. So
this skill closes the gap: waits for CI, fixes whatever is actually blocking the merge, squashes the PR
in, turns deferred work into tracked issues, and removes the throwaway branch and worktree.
The shape mirrors implement-issue's tail (sync-with-main, the profile's conflict hot-spots, the
commit identity) — reuse that machinery. The one new piece is the corrections loop: keep clearing
blockers and re-waiting until GitHub reports the PR CLEAN, then merge.
Autonomy contract
Run hands-off once started — the user points at a PR and walks away. See ADR 0005 for the decision scope. Whenever a step could stop for a question, pick the reasonable default, state the assumption, keep going. Stop only for a genuine blocker:
ghnot authenticated, or no merge/push rights.- The PR doesn't exist, is already merged/closed, or the number is ambiguous.
- CI stays red after a real fix attempt. Don't merge over a red bar, don't disable a failing test, don't
--admin-override a required check. Fix it for real or stop and show the failing output. - A merge conflict you can't resolve with confidence — both
mainand the branch rewrote the same logic. The mechanical conflicts (version, changelog, snapshots, lockfiles) have known-correct fixes (Step 4) — handle those; stop only for genuinely ambiguous ones, showing both sides. - A reviewer requested changes you can't satisfy without guessing intent, or a branch-protection rule you can't legitimately clear (required approvals you can't self-give).
- The branch has no writable checkout — not the transient sandbox push failure Step 2/§8 already covers — and GitHub reports
mergeStateStatus == DIRTYor literalBEHIND. The can't-push fallback (Step 4) only substitutes for the self-imposed staleness check (behind_by > 0whilemergeStateStatusstill reportsCLEAN) — it never pushes anything to the PR's real branch, and only a push clears a real conflict or a GitHub-enforced up-to-date gate. That combination is a genuine blocker: stop and report it.
The merge is the irreversible act — earn it. Merge only when CI is green on the just-corrected
branch and GitHub reports the PR mergeable; a textual merge of main is not a semantic one, so
re-build/re-test after resolving conflicts. Filing a follow-up and deleting a local branch are
reversible — but a follow-up is cheap to file and expensive to carry, which is why Step 6 triages
before it files.
Inputs
- PR identifier (required) — a number (
279), an issue/PR URL, or aghPR link. Resolve to a number (Step 1). --follow-up "<idea>"(optional, repeatable) — follow-up work to file as issues after the merge, e.g./merge-pr 279 --follow-up "add Rust snapshot tests" --follow-up "document minimap config". Added to whatever Step 6 discovers in the PR itself.
Checklist
Create a task per item and work them in order. Step 4 is a loop — repeat until the PR is mergeable.
- Preconditions & resolve the PR —
ghworks, you're in the target repo, normalize the PR number, confirm it's open, capture its head branch + merge state. - Locate (or create) the branch's worktree — find the local worktree/branch for the PR's head so corrections land in the right checkout; create one tracking the remote branch if none exists.
- Wait for CI — let the checks finish; read the rollup.
- Apply corrections (loop) — clear each blocker the merge state reports (red CI · behind/dirty vs
main· unresolved review · draft), push, re-wait until the PR isCLEAN. - Merge (squash) —
<kit>/skills/merge-pr/scripts/guarded-pr-merge.shonce green and mergeable; it runs the merge and decides the outcome from GitHub'sstate, never from the rawgh pr mergeexit code. If that call is refused (an agent confined to its worktree, the path resolving outside it), see the fallback in_shared/guard-invocation.md. 5b. Read the base's CI run — the merge just triggered one onmain; resolve it by the squash sha, wait (bounded), and carry the answer into Step 8. Green, red, or an honest non-verdict — never silence. 5c. Note a decomposed child's landing on its tracking parent — when the merge closed an issue that is itself a child of a decomposed tracking parent (#315), append one line to the parent's## Decisions so farsection; a silent no-op for every merge that isn't part of a decomposition. - Triage follow-ups — gather inline
--follow-upargs + ones discovered in the PR, cluster them by root cause, fold instances into the issue that already owns them, and file at most 3 new issues viacreate-issue. - Delete the local branch & worktree — from the main checkout, remove the PR's worktree and local branch.
- Recap — the shared closing shape (
../_shared/recap.md, with its Boundary findings block): merged PR URL, corrections applied, follow-ups filed, cleanup done.
Resume-safe: re-running mid-flight is fine. If the PR is already merged, skip to Step 5b (recover
the sha from gh pr view --json mergeCommit) and then Step 5c and Steps 6–7 — call Step 5c
unconditionally on a resume too, the same way Step 5b's own base-CI read does; its script is
idempotent per PR number, so a second call on an already-noted parent is a no-op, not a duplicate
line. If the
local worktree/branch is already gone, skip Step 7's local cleanup — but still run its remote
check (remote-branch-teardown.sh): the local branch being gone says nothing about whether
origin/<headRefName> survived (#185), and skipping Step 7 outright on a resume is exactly how
that branch leaks unnoticed.
How to read this skill
One step file at a time, when you reach it — never all up front. Every token loaded here is
re-read on every later turn (skills/auto-dev/references/token-economics.md: ~83% of a run's
spend is context re-read), so the step bodies live under references/steps/ and the checklist
above is the whole of what loads with the skill. Open a step when its checklist item starts; the
shared references it names load the same way, from inside that step.
- Step 1 —
references/steps/01-preconditions.md· reads_shared/preconditions.md - Step 2 —
references/steps/02-worktree.md· reads_shared/guard-invocation.md,_shared/worktree-ignore-check.md - Step 3 —
references/steps/03-wait-for-ci.md - Step 4 —
references/steps/04-corrections-loop.md· reads_shared/sync-with-main.md,_shared/untrusted-input-boundary.md,_shared/worktree-ignore-check.md - Step 5 —
references/steps/05-merge.md - Step 5b —
references/steps/05b-base-run.md - Step 5c —
references/steps/05c-parent-note.md - Step 6 —
references/steps/06-follow-ups.md· reads_shared/filing-bar.md,_shared/prior-rejections.md,_shared/untrusted-input-boundary.md - Step 7 —
references/steps/07-teardown.md - Step 8 —
references/steps/08-recap.md· reads_shared/recap.md
Notes on quality
- The merge is the one irreversible act — gate it hard. Everything else (follow-up issues, branch deletion) is recoverable. Merge only on green CI and a
CLEANmerge state, never by overriding a failing or required check. - Correct, don't paper over. Fix the red test, resolve the real conflict, address the real review note. Skipping a test, forcing past a check, or hand-stitching a snapshot to clear a conflict all look like progress and are worse than stopping.
- Stay resumable. Every step keys off live GitHub/git state, so a re-run won't double-merge, double-file, or fail because a branch is already gone.
- Follow-ups are tracked, not narrated — deferred work belongs in an issue (via
create-issue), not buried in the merge report. - …but tracked at the root, and rationed. The failure mode this skill is most likely to cause is not a bad merge, it's a backlog nobody can read: one merge that files a dozen leaf issues, each a symptom of one defect, is a net loss even though every issue is individually accurate. Step 6's triage is the corrective — cluster first, fold into the root second, file last.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

