| name | pr-merge |
| description | Merge the current branch's PR after confirmation |
pr-merge
Use this skill when the user asks to run the migrated command pr-merge or invokes $pr-merge.
Command Template
Merge PR
Merge the GitHub PR for the current branch. This is the ONLY authorized path to merge a PR.
Instructions
1. Find the PR
gh pr view --json number,url,title,state,mergeable,mergeStateStatus,reviewDecision,statusCheckRollup \
--jq '{number, url, title, state, mergeable, mergeStateStatus, reviewDecision, checks: [.statusCheckRollup[]? | {name: .name, status: .status, conclusion: .conclusion}]}'
If no PR exists, stop: "No open PR found for branch $(git branch --show-current)."
2. Check Readiness
Report any blockers:
- CI status: Are all checks passing? List any failures.
- Review status: Is it approved, changes requested, or pending?
- Merge conflicts: Is the branch mergeable?
If there are blockers, report them and stop. Do not proceed.
3. Confirm with User
Present the PR summary and ask for confirmation:
PR #<number>: <title>
CI: ✅ all passing (or ❌ N failing)
Reviews: ✅ approved (or ⚠️ pending / ❌ changes requested)
Conflicts: none (or ⚠️ has conflicts)
Merge method?
Use AskUserQuestion to let the user pick the merge method:
- Squash merge — single commit on the target branch
- Rebase merge — replay commits individually
- Merge commit — traditional merge with merge commit
- Cancel — abort without merging
4. Merge
gh pr merge <number> --<method> --delete-branch
Where <method> is squash, rebase, or merge based on the user's choice.
5. Report
✅ Merged PR #<number> via <method>
<pr_url>
Branch deleted: <branch>
6. Clean Up Local
git checkout main && git pull --prune
The --prune flag removes local remote-tracking refs for branches deleted on the remote (including the just-merged branch).