一键导入
merge-pr
Merge a pull request with status checks, squash merge, and branch cleanup. Handles worktree contexts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Merge a pull request with status checks, squash merge, and branch cleanup. Handles worktree contexts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | merge-pr |
| description | Merge a pull request with status checks, squash merge, and branch cleanup. Handles worktree contexts. |
| disable-model-invocation | true |
| argument-hint | [PR-number] |
Merge a pull request with consistent practices: verify checks, squash merge, clean up the branch, and pull the latest base branch.
$ARGUMENTS: PR number (optional — defaults to the PR for the current branch)gh pr view --json number,title,state,headRefName,baseRefNameCheck each of the following and report status:
gh pr checks to verify all required checks have passedgh pr view --json mergeable to verify no conflictsgh pr view --json reviewDecision,reviews to surface any unresolved review threads or a pending "changes requested" — advisory, not a hard gate. (Carries over the review-thread awareness from the retired /review-pr.)If CI has not passed, stop and report. Do not proceed with the merge.
gh pr merge --squash--delete-branch — GitHub is configured to auto-delete remote branches on merge. Local branch cleanup is handled in Step 4.Before updating local state, determine whether you are inside a git worktree:
git rev-parse --git-dir
git rev-parse --git-common-dir
After gh pr merge completes:
main, master, or whatever baseRefName was detected in Step 1) and pull: git switch <base-branch> && git pullgit branch -D <branch-name> (force-delete is required because squash merges produce a different SHA, so -d cannot detect the branch as merged)Then skip to Step 6.
When inside a worktree, git switch to the base branch will fail because it is checked out in another worktree. Handle this differently:
Find the primary worktree on the base branch:
git worktree list --porcelain
Parse the output to find the worktree entry whose branch matches refs/heads/<base-branch>. Extract its path.
Pull the base branch from the primary worktree:
git -C <primary-worktree-path> pull
Do not delete the branch or remove the worktree automatically. The branch cannot be deleted while it is checked out in a worktree, and removing the worktree would destroy the user's current working directory. Instead, provide the cleanup commands in the completion report.
Normal repo — report:
## Merge Complete
- PR: #N — [title]
- Remote branch: deleted
- Local branch: deleted (or kept — reason)
- Local <base-branch>: up to date
Worktree — report:
## Merge Complete
- PR: #N — [title]
- Remote branch: deleted
- Local <base-branch>: up to date (pulled in primary worktree)
## Worktree cleanup (run from outside this directory)
git worktree remove <this-worktree-path>
git branch -D <branch-name>
git branch -d cannot detect squash-merged branches, so -D is the correct flag for cleanup after a confirmed merge.Create a pull request with auto-generated description, issue linking, ROADMAP updates, and PR-metadata validation.
Fan out a batch of autopilot-queued issues to parallel background worktree subagents — each runs /autopilot — with an Opus gating review on every Sonnet-built PR.
Detailed technical walkthrough covering architecture, test coverage, product tour, and key design decisions.
Pre-PR advisory check for deviations from the project spec. Read-only analysis.
Generate a hands-on QA testing guide as a self-contained HTML page — for Rails apps or static (Hugo) sites. --publish uploads the HTML to the project's configured QA host.
Triage a QA-labeled report — investigate it against the code, classify it, and draft the technical issue(s) it warrants, stopping for approval before creating anything.