npx skills add ...
npx skills add jssblck/agents --skill merge-open-prs
Use when asked to merge all open PRs or land a specified set of PRs together.
npx skills add jssblck/agents --skill merge-open-prs
Snapshot the open PRs. That list is the work set. Merge each PR through the forge, one at a time, in an order that keeps later PRs updateable onto the default branch. Do not assemble independent PRs into a stack or replace the work set with one combined PR.
Standing rules:
Read every page. If the user named specific PRs, those are the work set; otherwise every open PR is. Record numbers, head SHAs, and head branches.
For anything but a single obvious PR, build a file-overlap map:
An unready PR (draft, requested changes) stays in the work set. Make it mergeable; do not drop it, and do not merge over unanswered requested changes without user direction.
If the work set is empty, stop.
Files-disjoint PRs cannot conflict textually in any order, so order for semantics and verifiability. In priority order:
If a PR's base is another work-set PR, merge the parent first. An existing base chain is evidence for that order. A user-stated order wins. State the order and a one-line reason per PR before you start.
Pass the repo's merge method explicitly on gh pr merge. Rulesets and classic
protection are separate; check both for required checks, required reviews, and
strict up-to-date policy.
Work in a temporary worktree. For each PR in order:
gh pr edit <n> --base <default-branch> when GitHub
has not already.isCrossRepository and
maintainerCanModify match the remote you will update. Get explicit
approval before rewriting a branch you do not own unless already authorized,
and disclose every rewrite.gh pr ready first, with user direction
where the draft was deliberate.A merge queue queues the PR and picks its own method; wait until it lands before starting the next PR.
If a teammate pushes to a work-set branch, inspect and preserve their changes, coordinate when possible, and verify the new head. Ask only if ownership or the intended resolution is unclear. A closed PR is no longer mergeable: report it and continue with independent PRs. If someone merges a work-set PR, continue with the remaining PRs.
--admin only with explicit approval, disclosed in the report.
After the last merge, verify the repository's required integration result on the default branch. Use its CI run when that supplies the required evidence; run additional local checks for uncovered risks. Remove the worktree.
If the request chains a release, use $tag-release after CI is green on the
merged commit.
gh repo view --json mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed
gh api repos/{owner}/{repo}/branches/{branch}/protection # may 404 even when gated
gh api repos/{owner}/{repo}/rulesetsgh pr view <n> --json headRefOid
gh pr merge <n> <verified-method-flag> --delete-branch --match-head-commit <sha>