一键导入
merge
Squash merge the current PR. Verifies merge gate and acceptance criteria before merging.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Squash merge the current PR. Verifies merge gate and acceptance criteria before merging.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate a PM handoff prompt for context-window turnover. Captures static config, live GitHub state, in-flight thread state, and memory summary into a self-contained prompt for a fresh PM thread. Bootstraps `.claude/pm-config.md` on first run. Triggers on "pm-handoff", "handoff", "context turnover", "new pm thread", "thread turnover".
Scan open issues for staleness and suggest closures. Detects issues solved by merged PRs, no-activity issues (30+ days), superseded issues, and potential duplicates of already-closed issues. Presents recommendations for user confirmation — never auto-closes. Triggers on "pm-clean", "stale issues", "clean backlog", "close stale".
Active PM orchestrator — manages issue pipeline, tracks coding threads, ranks the open backlog (OKR-aware) against a business goal, and suggests next work. Cold-starts from GitHub state or resumes from a /pm-handoff prompt. Triggers on "pm", "project manager", "orchestrate", "what should I work on", "rank issues".
Re-scan the current repo and update `.claude/pm-config.md` with fresh infrastructure and architecture detection while preserving user-edited sections (Role, OKRs, Team, Notes, Dependency Rules, Workflow Rules), then run a stale-cleanup pass to prune long-abandoned worktrees and branches. Use this after major milestones, new service integrations, or significant directory restructuring. Triggers on "pm update", "update pm config", "refresh pm config", "rescan repo".
Capture-only thread mode for drafting and opening well-structured GitHub issues. Puts the thread into issue-capture mode — the only job is creating, editing, and closing issues (no implementation, no worktrees, no /start-issue). Always reflects before writing (1–3 scope/clarifying questions), creates canonical 6-section bodies with functional-first tone, runs dedup search, suggests labels, supports batch + cross-references, and prints the issue URL as the closing line of every create/update. Supports /update <N> <statement>, natural-language edit-in-place, and retract. Invoke as `/issue-maker [rapid-fire] [--export-prompt]`.
Manage the OKRs section of `.claude/pm-config.md`. Show current objectives, set new ones, or get AI-suggested updates based on recent work. OKRs drive `/pm` ranking. Use this whenever you want to view, set, or update project OKRs, objectives, key results, or goals. Triggers on "pm okr", "set okrs", "show okrs", "suggest okrs", "project goals", "objectives".
| name | merge |
| description | Squash merge the current PR. Verifies merge gate and acceptance criteria before merging. |
Squash merge the current PR. This is the "we're done here" command.
main./pm-update.gh pr view --json number,title,headRefName,body,state --jq '{number, title, headRefName, body, state}'
If no PR exists on the current branch, stop and tell the user: "No PR found for the current branch. Push and create a PR first."
If the PR is already merged or closed, stop and tell the user.
Worktree check: If running inside a git worktree where the feature branch is checked out, git branch -D will fail even after checking out away — git refuses to delete a branch checked out in any worktree. Detect this and abort early:
if [ "$(git rev-parse --git-common-dir)" != "$(git rev-parse --git-dir)" ]; then
echo "Running inside a worktree. Use /wrap instead — it merges safely from the worktree and leaves cleanup to /pm-update."
exit 1
fi
If running in a worktree, stop here and use the message from the Worktree check above.
pr-state.sh first (NON-NEGOTIABLE): Before calling
gh api .../pulls/{N}/reviews,pulls/{N}/comments, orissues/{N}/commentsdirectly, callpr-state.sh --pr Nfirst and read the cached JSON bundle. This skill delegates tomerge-gate.sh, which callspr-state.shinternally — do not add inlinegh apicalls to these three endpoints.
Run the shared merge-gate verifier, which implements the authoritative gate from .claude/rules/cr-merge-gate.md (CR 1 explicit APPROVED review on current HEAD / BugBot 1-clean / Greptile severity, plus CI and BEHIND checks):
PR_NUM=$(gh pr view --json number --jq .number)
GATE_JSON=$(.claude/scripts/merge-gate.sh "$PR_NUM")
GATE_EXIT=$?
0 → gate met, proceed.1 → gate NOT met. Stop and report the missing array from the JSON output verbatim (e.g., "need 1 explicit CR APPROVED review on HEAD", "Greptile has P0 finding", "branch is BEHIND base").3 → PR not found (already merged/closed). Stop.2/4 → script or gh error; surface the stderr message to the user.If missing says branch protection reviewDecision is not APPROVED and .code_owner_bots lists coderabbitai[bot] or greptile-apps[bot], do not ask the PR author to approve. Trigger the matching bot re-review (@coderabbitai full review or @greptileai) and wait for a fresh current-HEAD approval.
Reviewer assignment is resolved automatically from ~/.claude/session-state.json and live history. Pass --reviewer cr|bugbot|greptile to override.
Use the shared ac-checkboxes.sh helper to parse and tick Test Plan items. All Test Plan checkboxes must be checked off before proceeding. If any fail verification, stop and report — do NOT merge with unchecked boxes.
# 1. Extract items (JSON array of {index, checked, text})
ITEMS=$(.claude/scripts/ac-checkboxes.sh "$PR_NUM" --extract)
AC_EXIT=$?
Exit codes from --extract:
0 → $ITEMS is a JSON array. Verify each unchecked item against the code, then tick the ones that pass.1 → no Test Plan section. Stop and tell the user: "PR has no Test Plan section — cannot verify acceptance criteria."3 → PR not found. Stop.2 → internal script error. Surface stderr ([script-error]) and stop.After verification, tick passing items — and capture the tick exit code:
.claude/scripts/ac-checkboxes.sh "$PR_NUM" --tick "0,2,3" # or --all-pass
TICK_EXIT=$?
Exit codes from --tick/--all-pass:
0 → body updated (or noop — nothing to tick). Proceed.4 → gh pr edit failed. Surface stderr ([gh-error]) and stop — do NOT merge.2 / other non-zero → internal script error. Surface stderr and stop.If any item fails verification, do NOT tick it — stop and report the failure. Do NOT merge with any unchecked AC.
.claude/scripts/merge-gate.sh already verifies CI as part of the gate — a gate-passing PR has all check-runs complete with no blocking conclusions. If Step 2 exited 0, CI is green and you can proceed to merge.
If Step 2 reported missing entries about CI ("CI has N failing check-run(s): ..." or "CI has N incomplete check-run(s): ..."), do NOT merge. Instead:
.claude/scripts/ci-status.sh "$PR_NUM" --format summary (exit 3 = blocking failures, exit 1 = incomplete). For the JSON with failing check-run IDs, drop --format summary.gh api "repos/{owner}/{repo}/check-runs/{CHECK_RUN_ID}" --jq '.output.summary'.claude/scripts/merge-gate.sh to confirm CI is green before proceedingNever add eslint-disable, @ts-ignore, @ts-expect-error, or any suppression comment to work around CI. Fix the actual code.
Merge authorization: /merge invocation authorizes merge. After Steps 2–3 pass, run gh pr merge --squash with no merge prompt — overrides CLAUDE.md "PR MERGE AUTHORIZATION" and cr-merge-gate.md Step 3 for /merge only; gate/CI/AC/worktree failures still stop as above.
gh pr merge --squash
Do NOT use --delete-branch. That flag attempts local branch deletion immediately, which fails when run from a worktree (the branch is still checked out). Handle branch cleanup in Step 5a below.
BRANCH_NAME=$(gh pr view --json headRefName --jq '.headRefName')
BASE_BRANCH=$(gh pr view --json baseRefName --jq '.baseRefName')
Local branch — must use -D (force), not -d. Squash merges rewrite history so the branch commits are not reachable from main and -d always fails post-squash.
If currently on the feature branch, check out the base branch first (can't delete the branch you're on):
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" = "$BRANCH_NAME" ]; then
git checkout "$BASE_BRANCH"
fi
git branch -D "$BRANCH_NAME" || echo "Warning: local branch deletion failed (may already be deleted) — skipping"
Remote branch — treat failure as non-fatal (branch may already be deleted by GitHub's auto-delete-on-merge, by /wrap if run previously, or due to permissions/network):
git push origin --delete "$BRANCH_NAME" || echo "Warning: remote branch deletion failed (may already be deleted) — skipping"
After merging, update the local main so subsequent sessions branch from the latest code. Capture the result for the completion report in Step 6.
# .claude/scripts/main-sync.sh writes the status line to stdout and exits
# 0 OK / 1 skipped (uncommitted) / 2 failed (checkout/pull). All three
# outcomes are captured here for the completion report — a non-zero exit
# is not a hard error for /merge, just a report-worthy condition.
MAIN_SYNC_STATUS=$(bash .claude/scripts/main-sync.sh 2>&1 || true)
echo "Main sync: $MAIN_SYNC_STATUS"
Note: /merge only runs outside worktrees (Step 1 aborts in worktrees), so we should be on main after Step 5a's checkout. The helper's internal checkout-main guard handles edge cases. The post-merge-pull.sh hook also fires as a safety net, but this explicit step captures the result for reporting. See .claude/scripts/main-sync.sh --help for the full contract.
Tell the user: