Merge pr multiple
Skill tony/ai-workflow-plugins/.agents/skills/merge-pr-multiple
Claude Code Plugins, Commands, and Skills
npx -y skills add tony/ai-workflow-plugins --skill merge-pr-multipleAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Merge a set of PRs one at a time — detect stack vs independent set, rebase and resolve conflicts between merges, watch CI, merge each via gh
SKILL.md
5.0 KB, as published. Nobody here has run it
Merge Multiple PRs
Land a set of pull requests one at a time: merge one, refresh trunk, bring the next PR up to date (rebase, resolve conflicts, force-push, wait on CI), then merge it — repeating until the set is landed or a gate halts the run.
Read references/merge-readiness.md first; it
defines the readiness gate, the rebase procedure, the merge-message
derivation, flag passthrough, the --admin policy, and the rule that
merging is not releasing.
User arguments: $ARGUMENTS
Context
Trunk — run this command and read the output:
git rev-parse --verify origin/main >/dev/null 2>&1 && echo main || echo master
Open PRs — run this command and read the output:
gh pr list --json number,title,headRefName,baseRefName,isDraft 2>/dev/null || echo "(gh unavailable)"
Procedure
1. Assemble the roster
Take the PR set from the arguments, or from the PRs this
conversation has been working on. If the set is ambiguous — the
conversation touched more PRs than the user likely means, or an
argument doesn't match an open PR — present the candidates via
ask-user-choice and let the user pick. Show the final roster
before merging anything.
2. Detect the topology
Fetch baseRefName and headRefName for each PR. If any PR's base
branch is another PR's head branch, the set is a stack: order
bottom-up, each PR merging only after its parent. Otherwise the set
is independent: honor the order the user gave, falling back to
ascending PR number.
For a stack, plan the retarget: merging a parent with
--delete-branch lets GitHub retarget the child to trunk
automatically; when the branch is kept, retarget explicitly with
gh pr edit <child> --base <trunk> before rebasing the child.
3. Land each PR
For each PR in order:
- Readiness gate — apply the gate from the reference. Failing
CI, draft state, or
CHANGES_REQUESTEDhalts the run with a report of what landed and what remains. - Bring up to date — when the PR is
BEHINDorDIRTY, or an earlier merge in this run moved trunk: follow the reference's rebase procedure (for a stacked child,git rebase --ontothe new trunk so the parent's merged commits drop out), resolve conflicts — asking on any conflict that forces a choice between behaviors — verify content did not drift, thengit push --force-with-lease. - Wait on CI —
gh pr checks <n> --watchon the rebased head. - Merge — compose the merge commit message per the reference
(match
git log --merges, stay provincial, no release claims) and merge viagh pr merge <n> --merge -t ... -b ..., passing the user's flags through verbatim.--adminonly within the reference's policy, asked-for if the user didn't supply it. - Sync — checkout trunk, pull, confirm the PR reports merged.
4. Halt conditions
Stop and report — never push past — when a rebase produces an unexpected content diff, CI fails on a rebased head, a PR turned closed or draft mid-run, or a conflict needs a product decision. Everything already merged stays merged; the report says exactly where the run stopped and why.
Rules
- One PR at a time; never merge two PRs between trunk syncs.
- Merges go through
gh pr merge, never a localgit mergepushed to trunk. - Never merge over failing or pending CI, with or without
--admin. - Force-pushes use
--force-with-leaseand only ever target PR branches. - When in doubt at any step, ask — do no harm.
Output
Open with a one-line hero (✓ Merged N of M PRs or
⚠ Halted at #N: <reason>), then exactly these sections:
## Roster— the PRs, detected topology (stack or independent), and merge order.## Merges— per PR: gate result, rebase/conflicts if any, CI outcome, merge commit subject.## Trunk— the post-run trunk state.
End with an ask-user-choice panel offering next steps (for
example: continue with a halted PR after a fix, merge another set,
stop here) — skip the panel only in plan mode.
Portability notes
ask-user-choice— present the listed options and wait for the user to pick one. Hosts with a structured multiple-choice tool (Claude Code'sAskUserQuestion) should use it; otherwise print a numbered list and wait for a numbered reply. Never proceed on an assumed answer.$ARGUMENTS— the text the user passed when invoking this skill. If your host does not substitute it, read it as the user's request in the current turn, and ask when there is none.- Bundled files — every relative path in this skill points at a file shipped inside this skill directory. Read them from here, not from the host's plugin tree.