/empire-git:pr-merge-stack [pr numbers or branches, bottom to top] [--admin]from empire-git
Merges a chain of stacked PRs bottom-up: merges the base, rebases the next PR onto it, waits for CI, and repeats until the stack is empty. Use when the user says 'merge the stack', 'merge pr stack', 'land the stack', 'merge all these PRs', 'merge the chain', 'ship the whole stack', or names several stacked PRs to merge in order.
Ships in empire-git. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Merge a chain of stacked PRs one by one, bottom-up, keeping each remaining PR rebased and green before it lands.
User input: $ARGUMENTS
CRITICAL: Never merge red CI — not even with --admin. Admin mode only bypasses review requirements. And never plain-rebase a child onto the base after its parent squash-merged; always git rebase --onto (Step 4).
Build the ordered list of PRs, bottom (base = default branch) to top:
$ARGUMENTS names PRs or branches, use those.baseRefName must be the previous PR's headRefName:gh pr view <pr> --json number,title,state,baseRefName,headRefName,mergeable,mergeStateStatus,url
Confirm the resolved order with the user in one line before merging: #12 ← #13 ← #14 (3 PRs, bottom-up).
Check whether the user can bypass review requirements:
gh api repos/<owner>/<repo> --jq .permissions.admin
If true (and the user didn't already pass --admin), ask once up front:
question: "Merge with admin privileges (skip review requirements)? CI must still pass for every PR."
header: "Admin merge"
options:
- label: "Yes — admin merge"
description: "Merge each PR without waiting for review approval. CI stays a hard gate."
- label: "No — wait for approvals"
description: "Each PR must satisfy branch protection (reviews) before it merges."
Remember the answer for the whole stack; don't re-ask per PR.
For the current bottom PR:
gh pr checks <pr> --watch
pr-merge skill's CI gate applies), or report to the user. Never merge red, never skip to the next PR — the stack above depends on this one.gh pr merge <pr> --squash --delete-branch # add --admin only if authorized in Step 2
Honor the repo's allowed merge methods (gh repo view --json squashMergeAllowed,mergeCommitAllowed,rebaseMergeAllowed); prefer squash.
Nothing left in the stack → Step 5. Otherwise:
git fetch origin <base>
git -C <base-checkout> merge --ff-only origin/<base> # if the base is checked out locally
Verify retargeting. GitHub retargets the child PR's base to <base> when the merged branch is deleted — confirm with gh pr view <next-pr> --json baseRefName before pushing.
Rebase the child. The parent was squash-merged, so its old commits would replay and conflict on a plain rebase. Replay only the child's own commits:
git fetch origin
git rebase --onto origin/<base> <merged-parent-branch> <child-branch>
git push --force-with-lease
If more PRs sit above, one command restacks them all: rebase from the topmost branch with --update-refs, then git push --force-with-lease origin <each-branch>. If a rebase skill is available, prefer it — it also checks the branch still makes semantic sense on the new base.
Resolve conflicts by understanding both sides, never by blindly taking one. If a conflict is non-trivial, stop and ask the user.
--force-with-lease push restarts its CI; --watch in Step 3 covers the wait.One line per PR: merged (method, admin or not), plus the final state — e.g. #12 ✓ squash, #13 ✓ squash (admin), #14 ✓ squash — stack merged, local master fast-forwarded. Note anything deferred to the user (conflicts, red CI, missing permissions).
Stacked PRs merged naively break in two ways: merging out of order orphans children, and plain-rebasing after a squash merge replays the parent's commits as conflicts. Merging strictly bottom-up with rebase --onto and a hard CI gate per PR lands the whole chain without either failure mode.
What SKILL.md sets; muted values are Claude Code's defaults
sonnetThree short reads, in order
npx claudepluginhub marcoskichel/empire --plugin empire-git12 skills in this plugin
/activity-reportGenerate a concise activity report of the user's GitHub work over a period, grouped by area or feature instead of PR by PR. Use when user says "activity report", "weekly report", "what did I do this week", "what did I ship", "work summary", "summarize my week", "status update for my manager", "what did <user> ship", or `/empire-git:activity-report [start-date] [end-date] [author]`.
/pr-comment-replyRender the canonical reply text for a PR review comment. Use when drafting, writing, or posting a "PR comment reply", "review comment reply", "reply to this comment", "respond to this review comment", "answer the reviewer", "reply on the PR thread", or any text bound for `gh api` review-thread replies, `gh pr comment`, or a GitHub review comment box. Triggers on "reply to the comment", "answer this review comment", "respond to the reviewer", "draft a reply", "post a reply on the PR". Outputs plain text for the caller to post unchanged.
/pr-descriptionRender the canonical PR description body. Use when drafting, writing, updating, or regenerating a "PR description", "PR body", "pull request description", "pull request body", "PR summary", "PR template", "GitHub PR body", or any text bound for `gh pr create --body`, `gh pr create --body-file`, `gh pr edit --body`, `gh pr edit --body-file`, or a GitHub PR template. Triggers on "draft a PR", "write the PR", "summarize this branch for review", "regenerate PR body". MUST be invoked before any `gh pr create --body*` or `gh pr edit --body*` per empire-git rules. Outputs markdown for stdin.