[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M754X6D28ZXV68WX6R9SNK19":3,"skill-same:01M754X6D28ZXV68WX6R9SNK19":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":50},"01M754X6D28ZXV68WX6R9SNK19","x-merge-pr",null,"Merges a single PR via gh CLI with configurable strategy (merge\u002Fsquash\u002Frebase), idempotency for already-merged PRs, pre-checks for CI and approvals in synchronous mode, GitHub native auto-merge in --auto mode, and structured error codes. Extracted from x-implement-epic Phase 1.3b to provide a testable, reusable merge primitive callable from x-create-pr --auto-merge and x-implement-epic.","review-bench\u002Federcnj_ia-dev-environment","review-bench","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F286778065?v=4","01M7517F9NTEPDZDAXJBR30FWT","ReviewBench","01M7517FAC9F4P7TGWCNJ8VYVW",0,"MIT","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-merge-pr\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-merge-pr\ndescription: \"Merges a single PR via gh CLI with configurable strategy (merge\u002Fsquash\u002Frebase), idempotency for already-merged PRs, pre-checks for CI and approvals in synchronous mode, GitHub native auto-merge in --auto mode, and structured error codes. Extracted from x-implement-epic Phase 1.3b to provide a testable, reusable merge primitive callable from x-create-pr --auto-merge and x-implement-epic.\"\nuser-invocable: true\nallowed-tools: Bash, Read, Write\nargument-hint: \"--pr N [--strategy merge|squash|rebase] [--delete-branch true|false] [--auto] [--wait-timeout-min N]\"\ncontext-budget: medium\nrequires-capabilities: []\n---\n\n## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, and Concise.\n- **Efficiency**: Remove all conversational fillers. Start directly with technical information.\n- **Progress lines**: Prefix with the current phase, e.g. `[Phase 0]`, `[Phase 1]`, `[Phase 2]`.\n\n## Purpose\n\nMerge a single pull request through the GitHub CLI with three orthogonal strategies (`merge` \u002F `squash` \u002F `rebase`), producing a structured result envelope and a deterministic exit code. The skill operates in two mutually exclusive modes:\n\n- **Synchronous mode (default)** — the skill validates pre-conditions (`mergeable`, `reviewDecision`, `statusCheckRollup`) before invoking `gh pr merge`. On success, it returns the merge SHA immediately.\n- **Auto-merge mode (`--auto`)** — the skill delegates waiting to GitHub's native auto-merge feature (`gh pr merge --auto`). It returns in under 5 seconds; GitHub will merge the PR asynchronously once CI and approvals are green.\n\nThe skill is idempotent: a second invocation on an already-merged PR returns `merged=true` without error. It replaces the ~80 lines of ad-hoc `gh pr merge` + polling logic previously embedded in `x-implement-epic` Phase 1.3b (ADR reference: story-0049-0003, epic-0049 \"x-merge-pr extraction\").\n\n## Triggers\n\n```\n\u002Fx-merge-pr --pr 123\n\u002Fx-merge-pr --pr 123 --strategy squash\n\u002Fx-merge-pr --pr 123 --strategy rebase --delete-branch false\n\u002Fx-merge-pr --pr 123 --strategy merge --auto\n\u002Fx-merge-pr --pr 123 --wait-timeout-min 30\n```\n\n## Parameters\n\n| Flag | Type | Required | Default | Description |\n| :--- | :--- | :--- | :--- | :--- |\n| `--pr` | `Integer` (> 0) | Yes | — | Target PR number. Must exist and be visible to the current `gh` token. |\n| `--strategy` | `Enum` (`merge` \\| `squash` \\| `rebase`) | No | `merge` | Merge strategy passed to `gh pr merge`. Maps 1-to-1 to `--merge`, `--squash`, `--rebase`. |\n| `--delete-branch` | `Boolean` (`true` \\| `false`) | No | `true` | If `true`, appends `--delete-branch` to the `gh pr merge` call. |\n| `--auto` | Flag | No | `false` | Enable GitHub native auto-merge (`gh pr merge --auto`). Skill returns in \u003C5s regardless of CI state. |\n| `--wait-timeout-min` | `Integer` (1–600) | No | `60` | Synchronous-mode timeout in minutes for `mergeable=UNKNOWN` polling. Ignored when `--auto` is set. |\n\n### Mutual Exclusivity and Validation\n\n- `--pr` MUST be a positive integer. Zero, negative, or non-numeric input aborts with `PR_NOT_FOUND` before any `gh` call.\n- `--strategy` MUST be one of `merge`, `squash`, `rebase`. Any other value aborts with `INVALID_STRATEGY` (exit 1 class).\n- `--wait-timeout-min` MUST satisfy `1 \u003C= N \u003C= 600`. Out-of-range values abort with `INVALID_TIMEOUT`.\n- `--auto` and `--wait-timeout-min` are independent; when `--auto` is set, `--wait-timeout-min` is accepted but ignored (logged as informational warning).\n\n## Output Contract\n\n### Response Envelope (stdout, single-line JSON)\n\n| Field | Type | Always present | Description |\n| :--- | :--- | :--- | :--- |\n| `merged` | `Boolean` | Yes | `true` when the PR is MERGED at skill exit (synchronous mode). `false` in `--auto` mode (merge happens asynchronously). |\n| `mergeSha` | `String(40)` | No (synchronous mode only, on success) | SHA of the merge commit reported by `gh pr view` after merge. Absent on error, absent in `--auto` mode. |\n| `prState` | `Enum` (`OPEN` \\| `MERGED` \\| `CLOSED`) | Yes | Final observed PR state. |\n| `waitedSec` | `Integer` | Yes | Seconds the skill waited for a state transition (0 when idempotent or `--auto`). |\n| `autoEnabled` | `Boolean` | Yes | `true` when GitHub auto-merge was successfully enabled by this invocation; `false` otherwise. |\n\nExample success (synchronous):\n\n```json\n{\"merged\":true,\"mergeSha\":\"a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0\",\"prState\":\"MERGED\",\"waitedSec\":12,\"autoEnabled\":false}\n```\n\nExample success (auto mode):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":true}\n```\n\nExample idempotent (already merged):\n\n```json\n{\"merged\":true,\"prState\":\"MERGED\",\"waitedSec\":0,\"autoEnabled\":false}\n```\n\n### Exit Codes\n\n| Exit | Error Code | Condition | Message |\n| :--- | :--- | :--- | :--- |\n| 0 | — | Success (merge happened, auto enabled, or idempotent no-op) | — |\n| 1 | `PR_NOT_FOUND` | PR number does not exist or input invalid | `\"PR #{N} not found\"` |\n| 2 | `PR_CLOSED` | PR state is `CLOSED` without a merge | `\"PR #{N} is closed\"` |\n| 3 | `NOT_APPROVED` | Synchronous mode: `reviewDecision != APPROVED` | `\"PR #{N} not approved\"` |\n| 4 | `CI_FAILING` | Synchronous mode: `statusCheckRollup` has any `FAILURE`\u002F`ERROR` conclusion | `\"PR #{N} has failing checks\"` |\n| 5 | `MERGE_CONFLICT` | `mergeable == CONFLICTING` | `\"PR #{N} has merge conflicts\"` |\n| 6 | `TIMEOUT` | Synchronous mode: `mergeable == UNKNOWN` persisted past `--wait-timeout-min` | `\"Wait timeout after {N} min\"` |\n\nExit codes are stable contract — consumers (e.g., `x-implement-epic`, `x-create-pr --auto-merge`) MAY switch on them.\n\n## Workflow Overview\n\n```\nPhase 0: Argument parsing + validation      — normalize flags, reject invalid input\nPhase 1: PR state inspection + idempotency  — single gh pr view; exit early if MERGED\u002FCLOSED\nPhase 2: Mode dispatch                      — branch on --auto vs synchronous\nPhase 3a: Auto-merge path (--auto)          — gh pr merge --auto; return in \u003C5s\nPhase 3b: Synchronous path (default)        — pre-checks; gh pr merge; fetch mergeSha\nPhase 4: Result emission                    — single-line JSON to stdout; exit with code\n```\n\n## Phase 0 — Argument Parsing and Validation\n\n### Step 0.1 — Parse Flags\n\nExtract the five flags from the command line in the order they appear. Assign defaults from the parameters table. Stop and emit `PR_NOT_FOUND` (exit 1) if `--pr` is absent, empty, or not a positive integer.\n\nLog: `\"[Phase 0] pr={N} strategy={STRATEGY} deleteBranch={BOOL} auto={BOOL} waitTimeoutMin={N}\"`\n\n### Step 0.2 — Validate Enumerations\n\n- If `--strategy` is present but not in `{merge, squash, rebase}`, abort with `INVALID_STRATEGY` (exit code 1 class).\n- If `--wait-timeout-min` is present and outside `[1, 600]`, abort with `INVALID_TIMEOUT` (exit code 1 class).\n- If both validations pass, proceed to Phase 1.\n\nLog: `\"[Phase 0] arguments validated\"`\n\n## Phase 1 — PR State Inspection and Idempotency\n\n### Step 1.1 — Single `gh pr view` Call\n\nExecute exactly ONE state-fetching call (performance contract: \u003C 5s in the `--auto` path depends on this being the only gh invocation before merge):\n\n```bash\ngh pr view {PR_NUMBER} --json number,state,mergeable,reviewDecision,statusCheckRollup,headRefName,baseRefName\n```\n\nCapture stdout into a local variable `prState`. If the call fails with a non-zero exit:\n\n- gh exit 1 with message containing \"Could not resolve\" or \"not found\" → abort `PR_NOT_FOUND` (exit 1).\n- Any other gh failure → abort with a generic error carrying the gh stderr as message.\n\nLog: `\"[Phase 1] fetched state for PR #{N}: state={STATE} mergeable={MERGEABLE} reviewDecision={DECISION}\"`\n\n### Step 1.2 — Idempotency Short-Circuit\n\nApply the following decision table BEFORE any further processing:\n\n| `state` | Action | Response |\n| :--- | :--- | :--- |\n| `MERGED` | Emit success envelope with `merged=true, prState=MERGED, waitedSec=0, autoEnabled=false`. Exit 0. | Idempotent no-op. |\n| `CLOSED` | Abort with `PR_CLOSED` (exit 2). | — |\n| `OPEN` | Continue to Phase 2. | — |\n\nLog (when short-circuiting): `\"[Phase 1] PR #{N} already in terminal state {STATE}; idempotent exit\"`\n\n## Phase 2 — Mode Dispatch\n\nBranch on the `--auto` flag value recorded in Phase 0:\n\n| `--auto` | Next Phase |\n| :--- | :--- |\n| `true` | Phase 3a (Auto-merge path) |\n| `false` | Phase 3b (Synchronous path) |\n\n## Phase 3a — Auto-Merge Path (`--auto`)\n\n### Step 3a.1 — Invoke `gh pr merge --auto`\n\nBuild the command by appending flags in this order:\n\n```bash\ngh pr merge {PR_NUMBER} --{STRATEGY} --auto [--delete-branch]\n```\n\n- `--{STRATEGY}` is one of `--merge`, `--squash`, `--rebase`.\n- `--delete-branch` is appended ONLY when `--delete-branch true` (the default).\n\nExecute the command. The performance contract is strict: this step MUST return in \u003C 5s. Do NOT poll, do NOT wait.\n\n### Step 3a.2 — Interpret Result\n\n| `gh` exit | Interpretation |\n| :--- | :--- |\n| 0 | Auto-merge enabled. Emit `{merged:false, prState:OPEN, waitedSec:0, autoEnabled:true}`. Exit 0. |\n| Non-zero, message contains \"Pull request is in clean state\" | PR was already mergeable and was merged synchronously by GitHub. Refetch state (Phase 1), emit `{merged:true, mergeSha:..., prState:MERGED, waitedSec:0, autoEnabled:false}`. Exit 0. |\n| Non-zero, message contains \"auto-merge is not allowed\" | Repo does not permit auto-merge. Emit error with clear message and exit with `CI_FAILING`-adjacent code 4 (repo misconfiguration; caller should enable auto-merge in repo settings). |\n| Non-zero, other | Emit generic error carrying gh stderr. Exit 1. |\n\nLog: `\"[Phase 3a] auto-merge enabled for PR #{N}; skill returning\"`\n\n## Phase 3b — Synchronous Path (Default)\n\n### Step 3b.1 — Pre-Check: `mergeable`\n\nInspect the `mergeable` field captured in Phase 1:\n\n| Value | Action |\n| :--- | :--- |\n| `MERGEABLE` | Proceed to Step 3b.2. |\n| `CONFLICTING` | Abort with `MERGE_CONFLICT` (exit 5). |\n| `UNKNOWN` | Enter polling loop (Step 3b.1a). |\n\n#### Step 3b.1a — Polling Loop for `UNKNOWN`\n\nLoop with a fixed 10-second sleep between iterations. Break when `mergeable != UNKNOWN` or total elapsed time exceeds `--wait-timeout-min` minutes:\n\n```bash\nelapsed=0\ntimeout_sec=$(( WAIT_TIMEOUT_MIN * 60 ))\nwhile [ \"$mergeable\" = \"UNKNOWN\" ] && [ \"$elapsed\" -lt \"$timeout_sec\" ]; do\n  sleep 10\n  elapsed=$(( elapsed + 10 ))\n  mergeable=$(gh pr view {N} --json mergeable --jq '.mergeable')\ndone\n```\n\nIf the loop exits with `mergeable == UNKNOWN`, abort with `TIMEOUT` (exit 6). Record `waitedSec = elapsed`.\n\n### Step 3b.2 — Pre-Check: `reviewDecision`\n\n| Value | Action |\n| :--- | :--- |\n| `APPROVED` | Proceed to Step 3b.3. |\n| `REVIEW_REQUIRED` \\| `CHANGES_REQUESTED` \\| `null` | Abort with `NOT_APPROVED` (exit 3). |\n\n### Step 3b.3 — Pre-Check: `statusCheckRollup`\n\nParse the `statusCheckRollup` array. A \"failing\" check has `conclusion` in `{FAILURE, ERROR, TIMED_OUT, CANCELLED}` OR `status == IN_PROGRESS` past the timeout.\n\n| Summary | Action |\n| :--- | :--- |\n| All checks `conclusion == SUCCESS` OR `status == COMPLETED && conclusion == NEUTRAL` | Proceed to Step 3b.4. |\n| Any failing check | Abort with `CI_FAILING` (exit 4). |\n| Any check still `IN_PROGRESS` | Enter polling loop identical to Step 3b.1a, re-fetching `statusCheckRollup` until all checks complete or timeout. On timeout, abort `TIMEOUT` (exit 6). |\n\nLog: `\"[Phase 3b] pre-checks passed: mergeable=MERGEABLE reviewDecision=APPROVED checks=all-green\"`\n\n### Step 3b.4 — Invoke `gh pr merge` (Synchronous)\n\nBuild and execute the command (NO `--auto` flag):\n\n```bash\ngh pr merge {PR_NUMBER} --{STRATEGY} [--delete-branch]\n```\n\nCapture stdout and stderr. On non-zero exit:\n\n- stderr contains \"not mergeable\" → abort `MERGE_CONFLICT` (exit 5).\n- stderr contains \"approval\" → abort `NOT_APPROVED` (exit 3).\n- other → abort with generic error carrying stderr.\n\n### Step 3b.5 — Fetch Merge SHA\n\nAfter a successful `gh pr merge`, refetch PR state to capture the merge commit SHA:\n\n```bash\ngh pr view {PR_NUMBER} --json mergeCommit --jq '.mergeCommit.oid'\n```\n\nRecord as `mergeSha`. If the field is null (rare race), retry after 2 seconds once; if still null, emit success with `mergeSha=null` and a warning log.\n\n### Step 3b.6 — Emit Result\n\nEmit to stdout:\n\n```json\n{\"merged\":true,\"mergeSha\":\"{SHA}\",\"prState\":\"MERGED\",\"waitedSec\":{N},\"autoEnabled\":false}\n```\n\nExit 0.\n\nLog: `\"[Phase 3b] PR #{N} merged synchronously; mergeSha={SHA} waitedSec={N}\"`\n\n## Phase 4 — Result Emission\n\nAll exit paths (success and failure) emit EXACTLY one line of JSON to stdout and exit with the code from the table in \"Output Contract > Exit Codes\". Error envelopes carry:\n\n```json\n{\"merged\":false,\"prState\":\"{STATE}\",\"waitedSec\":{N},\"autoEnabled\":false,\"errorCode\":\"{CODE}\",\"message\":\"{HUMAN_MESSAGE}\"}\n```\n\nStderr SHOULD carry the `[Phase N] ...` log lines; stdout MUST carry only the single JSON envelope. This separation allows callers to pipe `stdout | jq` without contamination.\n\n## Examples\n\n### Example 1 — Happy Path (Synchronous, merge strategy)\n\n```bash\n\u002Fx-merge-pr --pr 123\n```\n\nResult (stdout):\n\n```json\n{\"merged\":true,\"mergeSha\":\"a1b2...\",\"prState\":\"MERGED\",\"waitedSec\":3,\"autoEnabled\":false}\n```\n\n### Example 2 — Squash Strategy with Auto-Merge\n\n```bash\n\u002Fx-merge-pr --pr 456 --strategy squash --auto\n```\n\nResult (returns in \u003C5s):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":true}\n```\n\nGitHub will merge asynchronously when CI + approvals pass.\n\n### Example 3 — Rebase Strategy, Preserve Branch\n\n```bash\n\u002Fx-merge-pr --pr 789 --strategy rebase --delete-branch false\n```\n\nResult (stdout):\n\n```json\n{\"merged\":true,\"mergeSha\":\"c3d4...\",\"prState\":\"MERGED\",\"waitedSec\":5,\"autoEnabled\":false}\n```\n\n### Example 4 — Idempotent Re-Invocation\n\n```bash\n\u002Fx-merge-pr --pr 123     # already merged by previous run\n```\n\nResult (exits 0 immediately, no gh pr merge call):\n\n```json\n{\"merged\":true,\"prState\":\"MERGED\",\"waitedSec\":0,\"autoEnabled\":false}\n```\n\n### Example 5 — Error: Not Approved\n\n```bash\n\u002Fx-merge-pr --pr 123\n```\n\nResult (exit 3):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":false,\"errorCode\":\"NOT_APPROVED\",\"message\":\"PR #123 not approved\"}\n```\n\n## Error Envelope\n\n| Scenario | Exit | Error Code |\n| :--- | :--- | :--- |\n| `--pr` missing, zero, negative, non-numeric | 1 | `PR_NOT_FOUND` |\n| `--strategy` not in `{merge, squash, rebase}` | 1 | `INVALID_STRATEGY` |\n| `--wait-timeout-min` not in `[1, 600]` | 1 | `INVALID_TIMEOUT` |\n| `gh pr view` returns \"not found\" | 1 | `PR_NOT_FOUND` |\n| PR state is `CLOSED` (not merged) | 2 | `PR_CLOSED` |\n| `reviewDecision != APPROVED` (synchronous mode) | 3 | `NOT_APPROVED` |\n| `statusCheckRollup` has failing checks (synchronous mode) | 4 | `CI_FAILING` |\n| `mergeable == CONFLICTING` | 5 | `MERGE_CONFLICT` |\n| `mergeable == UNKNOWN` past timeout (synchronous mode) | 6 | `TIMEOUT` |\n\n## Integration Notes\n\n| Consumer | Relationship | Usage |\n| :--- | :--- | :--- |\n| `x-create-pr` | Invokes this skill when `--auto-merge \u003Cstrategy>` is passed (RULE-002 auto-merge default ON) | After creating the PR, forwards `--strategy` + `--auto` to `x-merge-pr` to enable native GitHub auto-merge. |\n| `x-implement-epic` | Invokes this skill in Phase 1.3b (merge of epic PRs to `epic\u002FXXXX` or `develop`) | Replaces the previous ~80 lines of inline `gh pr merge` + polling. Calls with `--strategy merge --auto` by default. |\n| `x-manage-pr-merge-train` | Does NOT call this skill directly | Uses its own train-specific merge orchestration; however, both skills share the same exit-code semantics for consistency across the `\u002Fx-pr-*` family. |\n\n### Called Tools\n\n- `gh pr view` (one call minimum, two in the auto-merge \"clean state\" edge case)\n- `gh pr merge` (one call in synchronous path; one call in `--auto` path)\n- `sleep` (only in the `UNKNOWN` \u002F `IN_PROGRESS` polling loop)\n\nNo git operations are performed by this skill — branch deletion is delegated to `gh pr merge --delete-branch`.\n\n## Testing Contract\n\n### Unit Tests (mocked `gh` CLI)\n\n1. `idempotent_alreadyMerged_returnsMergedTrue` — `gh pr view` returns `state=MERGED`; skill exits 0 with `{merged:true, waitedSec:0}`.\n2. `closed_pr_returnsPrClosed` — `gh pr view` returns `state=CLOSED`; skill exits 2 with `PR_CLOSED`.\n3. `sync_happy_path_mergeStrategy` — all pre-checks pass; `gh pr merge --merge` succeeds; skill emits `{merged:true, mergeSha:...}`.\n4. `sync_happy_path_squashStrategy` — same as above with `--strategy squash`; verifies `--squash` flag propagation.\n5. `sync_happy_path_rebaseStrategy` — same with `--strategy rebase`; verifies `--rebase` flag propagation.\n6. `sync_notApproved_exitsNotApproved` — `reviewDecision=REVIEW_REQUIRED`; skill exits 3 with `NOT_APPROVED`.\n7. `sync_ciFailing_exitsCiFailing` — `statusCheckRollup` contains a `FAILURE` conclusion; skill exits 4.\n8. `sync_mergeConflict_exitsMergeConflict` — `mergeable=CONFLICTING`; skill exits 5.\n9. `sync_timeout_exitsTimeout` — `mergeable=UNKNOWN` persists past `--wait-timeout-min=1`; skill exits 6 after ~60s.\n10. `auto_mode_enablesAutoMerge` — `--auto` → `gh pr merge --auto` returns 0; skill emits `{autoEnabled:true, merged:false}` in \u003C5s.\n11. `auto_mode_cleanStateEdgeCase` — `gh pr merge --auto` returns \"clean state\"; skill refetches and reports as synchronous merge.\n12. `deleteBranchFalse_doesNotAppendFlag` — `--delete-branch false`; verify `gh pr merge` invocation does NOT include `--delete-branch`.\n13. `invalidStrategy_exitsInvalidStrategy` — `--strategy invalid`; skill exits 1 with `INVALID_STRATEGY` before any `gh` call.\n14. `invalidTimeout_exitsInvalidTimeout` — `--wait-timeout-min 0` or `--wait-timeout-min 601`; skill exits 1 with `INVALID_TIMEOUT`.\n15. `missingPr_exitsPrNotFound` — no `--pr`; skill exits 1 with `PR_NOT_FOUND`.\n\n### Smoke Test (gated by `GITHUB_TOKEN`)\n\nSingle end-to-end test (`PrMergeSmokeTest`) that:\n\n1. Creates a disposable PR on a fixture repository branch.\n2. Invokes `\u002Fx-merge-pr --pr {N} --auto`.\n3. Verifies `autoEnabled=true` and exit 0.\n4. Waits up to 60s for GitHub to merge asynchronously.\n5. Cleans up the test branch.\n\nSkipped when `GITHUB_TOKEN` is absent; reported as `SKIPPED` to avoid failing CI in contributor forks.\n\n### Coverage Targets\n\n- Line coverage: ≥ 95% (skill-level logic exercised by the 15 unit scenarios above).\n- Branch coverage: ≥ 90% (each decision table branch in Phases 1, 3a, 3b covered).\n\n## Forbidden\n\n- NEVER invoke `git merge` directly — the skill MUST route all merges through `gh pr merge` to preserve GitHub-side history and branch-deletion side effects.\n- NEVER bypass pre-checks in synchronous mode — even on repeat invocations after a CI flake.\n- NEVER emit multiple JSON envelopes to stdout — callers rely on single-line parsing.\n- NEVER exit 0 on any error condition — the exit-code table is a hard contract.\n- NEVER poll `gh pr merge` itself — only `gh pr view` is polled. `gh pr merge` is a single synchronous call per phase.\n\n## Status\n\n- **Story**: story-0049-0003 (epic-0049, \"x-merge-pr extraction from x-implement-epic Phase 1.3b\")\n- **Parent Contract**: RULE-002 (auto-merge default ON), RULE-004 (preserve history), RULE-005 (thin orchestrator)\n- **Dependencies**: none (first skill in its sub-tree of epic-0049)\n- **Downstream**: story-0049-0016 (`x-create-pr --auto-merge` propagation), story-0049-0018 (`x-implement-epic` refactor)\n","## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, and Concise.\n- **Efficiency**: Remove all conversational fillers. Start directly with technical information.\n- **Progress lines**: Prefix with the current phase, e.g. `[Phase 0]`, `[Phase 1]`, `[Phase 2]`.\n\n## Purpose\n\nMerge a single pull request through the GitHub CLI with three orthogonal strategies (`merge` \u002F `squash` \u002F `rebase`), producing a structured result envelope and a deterministic exit code. The skill operates in two mutually exclusive modes:\n\n- **Synchronous mode (default)** — the skill validates pre-conditions (`mergeable`, `reviewDecision`, `statusCheckRollup`) before invoking `gh pr merge`. On success, it returns the merge SHA immediately.\n- **Auto-merge mode (`--auto`)** — the skill delegates waiting to GitHub's native auto-merge feature (`gh pr merge --auto`). It returns in under 5 seconds; GitHub will merge the PR asynchronously once CI and approvals are green.\n\nThe skill is idempotent: a second invocation on an already-merged PR returns `merged=true` without error. It replaces the ~80 lines of ad-hoc `gh pr merge` + polling logic previously embedded in `x-implement-epic` Phase 1.3b (ADR reference: story-0049-0003, epic-0049 \"x-merge-pr extraction\").\n\n## Triggers\n\n```\n\u002Fx-merge-pr --pr 123\n\u002Fx-merge-pr --pr 123 --strategy squash\n\u002Fx-merge-pr --pr 123 --strategy rebase --delete-branch false\n\u002Fx-merge-pr --pr 123 --strategy merge --auto\n\u002Fx-merge-pr --pr 123 --wait-timeout-min 30\n```\n\n## Parameters\n\n| Flag | Type | Required | Default | Description |\n| :--- | :--- | :--- | :--- | :--- |\n| `--pr` | `Integer` (> 0) | Yes | — | Target PR number. Must exist and be visible to the current `gh` token. |\n| `--strategy` | `Enum` (`merge` \\| `squash` \\| `rebase`) | No | `merge` | Merge strategy passed to `gh pr merge`. Maps 1-to-1 to `--merge`, `--squash`, `--rebase`. |\n| `--delete-branch` | `Boolean` (`true` \\| `false`) | No | `true` | If `true`, appends `--delete-branch` to the `gh pr merge` call. |\n| `--auto` | Flag | No | `false` | Enable GitHub native auto-merge (`gh pr merge --auto`). Skill returns in \u003C5s regardless of CI state. |\n| `--wait-timeout-min` | `Integer` (1–600) | No | `60` | Synchronous-mode timeout in minutes for `mergeable=UNKNOWN` polling. Ignored when `--auto` is set. |\n\n### Mutual Exclusivity and Validation\n\n- `--pr` MUST be a positive integer. Zero, negative, or non-numeric input aborts with `PR_NOT_FOUND` before any `gh` call.\n- `--strategy` MUST be one of `merge`, `squash`, `rebase`. Any other value aborts with `INVALID_STRATEGY` (exit 1 class).\n- `--wait-timeout-min` MUST satisfy `1 \u003C= N \u003C= 600`. Out-of-range values abort with `INVALID_TIMEOUT`.\n- `--auto` and `--wait-timeout-min` are independent; when `--auto` is set, `--wait-timeout-min` is accepted but ignored (logged as informational warning).\n\n## Output Contract\n\n### Response Envelope (stdout, single-line JSON)\n\n| Field | Type | Always present | Description |\n| :--- | :--- | :--- | :--- |\n| `merged` | `Boolean` | Yes | `true` when the PR is MERGED at skill exit (synchronous mode). `false` in `--auto` mode (merge happens asynchronously). |\n| `mergeSha` | `String(40)` | No (synchronous mode only, on success) | SHA of the merge commit reported by `gh pr view` after merge. Absent on error, absent in `--auto` mode. |\n| `prState` | `Enum` (`OPEN` \\| `MERGED` \\| `CLOSED`) | Yes | Final observed PR state. |\n| `waitedSec` | `Integer` | Yes | Seconds the skill waited for a state transition (0 when idempotent or `--auto`). |\n| `autoEnabled` | `Boolean` | Yes | `true` when GitHub auto-merge was successfully enabled by this invocation; `false` otherwise. |\n\nExample success (synchronous):\n\n```json\n{\"merged\":true,\"mergeSha\":\"a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0\",\"prState\":\"MERGED\",\"waitedSec\":12,\"autoEnabled\":false}\n```\n\nExample success (auto mode):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":true}\n```\n\nExample idempotent (already merged):\n\n```json\n{\"merged\":true,\"prState\":\"MERGED\",\"waitedSec\":0,\"autoEnabled\":false}\n```\n\n### Exit Codes\n\n| Exit | Error Code | Condition | Message |\n| :--- | :--- | :--- | :--- |\n| 0 | — | Success (merge happened, auto enabled, or idempotent no-op) | — |\n| 1 | `PR_NOT_FOUND` | PR number does not exist or input invalid | `\"PR #{N} not found\"` |\n| 2 | `PR_CLOSED` | PR state is `CLOSED` without a merge | `\"PR #{N} is closed\"` |\n| 3 | `NOT_APPROVED` | Synchronous mode: `reviewDecision != APPROVED` | `\"PR #{N} not approved\"` |\n| 4 | `CI_FAILING` | Synchronous mode: `statusCheckRollup` has any `FAILURE`\u002F`ERROR` conclusion | `\"PR #{N} has failing checks\"` |\n| 5 | `MERGE_CONFLICT` | `mergeable == CONFLICTING` | `\"PR #{N} has merge conflicts\"` |\n| 6 | `TIMEOUT` | Synchronous mode: `mergeable == UNKNOWN` persisted past `--wait-timeout-min` | `\"Wait timeout after {N} min\"` |\n\nExit codes are stable contract — consumers (e.g., `x-implement-epic`, `x-create-pr --auto-merge`) MAY switch on them.\n\n## Workflow Overview\n\n```\nPhase 0: Argument parsing + validation      — normalize flags, reject invalid input\nPhase 1: PR state inspection + idempotency  — single gh pr view; exit early if MERGED\u002FCLOSED\nPhase 2: Mode dispatch                      — branch on --auto vs synchronous\nPhase 3a: Auto-merge path (--auto)          — gh pr merge --auto; return in \u003C5s\nPhase 3b: Synchronous path (default)        — pre-checks; gh pr merge; fetch mergeSha\nPhase 4: Result emission                    — single-line JSON to stdout; exit with code\n```\n\n## Phase 0 — Argument Parsing and Validation\n\n### Step 0.1 — Parse Flags\n\nExtract the five flags from the command line in the order they appear. Assign defaults from the parameters table. Stop and emit `PR_NOT_FOUND` (exit 1) if `--pr` is absent, empty, or not a positive integer.\n\nLog: `\"[Phase 0] pr={N} strategy={STRATEGY} deleteBranch={BOOL} auto={BOOL} waitTimeoutMin={N}\"`\n\n### Step 0.2 — Validate Enumerations\n\n- If `--strategy` is present but not in `{merge, squash, rebase}`, abort with `INVALID_STRATEGY` (exit code 1 class).\n- If `--wait-timeout-min` is present and outside `[1, 600]`, abort with `INVALID_TIMEOUT` (exit code 1 class).\n- If both validations pass, proceed to Phase 1.\n\nLog: `\"[Phase 0] arguments validated\"`\n\n## Phase 1 — PR State Inspection and Idempotency\n\n### Step 1.1 — Single `gh pr view` Call\n\nExecute exactly ONE state-fetching call (performance contract: \u003C 5s in the `--auto` path depends on this being the only gh invocation before merge):\n\n```bash\ngh pr view {PR_NUMBER} --json number,state,mergeable,reviewDecision,statusCheckRollup,headRefName,baseRefName\n```\n\nCapture stdout into a local variable `prState`. If the call fails with a non-zero exit:\n\n- gh exit 1 with message containing \"Could not resolve\" or \"not found\" → abort `PR_NOT_FOUND` (exit 1).\n- Any other gh failure → abort with a generic error carrying the gh stderr as message.\n\nLog: `\"[Phase 1] fetched state for PR #{N}: state={STATE} mergeable={MERGEABLE} reviewDecision={DECISION}\"`\n\n### Step 1.2 — Idempotency Short-Circuit\n\nApply the following decision table BEFORE any further processing:\n\n| `state` | Action | Response |\n| :--- | :--- | :--- |\n| `MERGED` | Emit success envelope with `merged=true, prState=MERGED, waitedSec=0, autoEnabled=false`. Exit 0. | Idempotent no-op. |\n| `CLOSED` | Abort with `PR_CLOSED` (exit 2). | — |\n| `OPEN` | Continue to Phase 2. | — |\n\nLog (when short-circuiting): `\"[Phase 1] PR #{N} already in terminal state {STATE}; idempotent exit\"`\n\n## Phase 2 — Mode Dispatch\n\nBranch on the `--auto` flag value recorded in Phase 0:\n\n| `--auto` | Next Phase |\n| :--- | :--- |\n| `true` | Phase 3a (Auto-merge path) |\n| `false` | Phase 3b (Synchronous path) |\n\n## Phase 3a — Auto-Merge Path (`--auto`)\n\n### Step 3a.1 — Invoke `gh pr merge --auto`\n\nBuild the command by appending flags in this order:\n\n```bash\ngh pr merge {PR_NUMBER} --{STRATEGY} --auto [--delete-branch]\n```\n\n- `--{STRATEGY}` is one of `--merge`, `--squash`, `--rebase`.\n- `--delete-branch` is appended ONLY when `--delete-branch true` (the default).\n\nExecute the command. The performance contract is strict: this step MUST return in \u003C 5s. Do NOT poll, do NOT wait.\n\n### Step 3a.2 — Interpret Result\n\n| `gh` exit | Interpretation |\n| :--- | :--- |\n| 0 | Auto-merge enabled. Emit `{merged:false, prState:OPEN, waitedSec:0, autoEnabled:true}`. Exit 0. |\n| Non-zero, message contains \"Pull request is in clean state\" | PR was already mergeable and was merged synchronously by GitHub. Refetch state (Phase 1), emit `{merged:true, mergeSha:..., prState:MERGED, waitedSec:0, autoEnabled:false}`. Exit 0. |\n| Non-zero, message contains \"auto-merge is not allowed\" | Repo does not permit auto-merge. Emit error with clear message and exit with `CI_FAILING`-adjacent code 4 (repo misconfiguration; caller should enable auto-merge in repo settings). |\n| Non-zero, other | Emit generic error carrying gh stderr. Exit 1. |\n\nLog: `\"[Phase 3a] auto-merge enabled for PR #{N}; skill returning\"`\n\n## Phase 3b — Synchronous Path (Default)\n\n### Step 3b.1 — Pre-Check: `mergeable`\n\nInspect the `mergeable` field captured in Phase 1:\n\n| Value | Action |\n| :--- | :--- |\n| `MERGEABLE` | Proceed to Step 3b.2. |\n| `CONFLICTING` | Abort with `MERGE_CONFLICT` (exit 5). |\n| `UNKNOWN` | Enter polling loop (Step 3b.1a). |\n\n#### Step 3b.1a — Polling Loop for `UNKNOWN`\n\nLoop with a fixed 10-second sleep between iterations. Break when `mergeable != UNKNOWN` or total elapsed time exceeds `--wait-timeout-min` minutes:\n\n```bash\nelapsed=0\ntimeout_sec=$(( WAIT_TIMEOUT_MIN * 60 ))\nwhile [ \"$mergeable\" = \"UNKNOWN\" ] && [ \"$elapsed\" -lt \"$timeout_sec\" ]; do\n  sleep 10\n  elapsed=$(( elapsed + 10 ))\n  mergeable=$(gh pr view {N} --json mergeable --jq '.mergeable')\ndone\n```\n\nIf the loop exits with `mergeable == UNKNOWN`, abort with `TIMEOUT` (exit 6). Record `waitedSec = elapsed`.\n\n### Step 3b.2 — Pre-Check: `reviewDecision`\n\n| Value | Action |\n| :--- | :--- |\n| `APPROVED` | Proceed to Step 3b.3. |\n| `REVIEW_REQUIRED` \\| `CHANGES_REQUESTED` \\| `null` | Abort with `NOT_APPROVED` (exit 3). |\n\n### Step 3b.3 — Pre-Check: `statusCheckRollup`\n\nParse the `statusCheckRollup` array. A \"failing\" check has `conclusion` in `{FAILURE, ERROR, TIMED_OUT, CANCELLED}` OR `status == IN_PROGRESS` past the timeout.\n\n| Summary | Action |\n| :--- | :--- |\n| All checks `conclusion == SUCCESS` OR `status == COMPLETED && conclusion == NEUTRAL` | Proceed to Step 3b.4. |\n| Any failing check | Abort with `CI_FAILING` (exit 4). |\n| Any check still `IN_PROGRESS` | Enter polling loop identical to Step 3b.1a, re-fetching `statusCheckRollup` until all checks complete or timeout. On timeout, abort `TIMEOUT` (exit 6). |\n\nLog: `\"[Phase 3b] pre-checks passed: mergeable=MERGEABLE reviewDecision=APPROVED checks=all-green\"`\n\n### Step 3b.4 — Invoke `gh pr merge` (Synchronous)\n\nBuild and execute the command (NO `--auto` flag):\n\n```bash\ngh pr merge {PR_NUMBER} --{STRATEGY} [--delete-branch]\n```\n\nCapture stdout and stderr. On non-zero exit:\n\n- stderr contains \"not mergeable\" → abort `MERGE_CONFLICT` (exit 5).\n- stderr contains \"approval\" → abort `NOT_APPROVED` (exit 3).\n- other → abort with generic error carrying stderr.\n\n### Step 3b.5 — Fetch Merge SHA\n\nAfter a successful `gh pr merge`, refetch PR state to capture the merge commit SHA:\n\n```bash\ngh pr view {PR_NUMBER} --json mergeCommit --jq '.mergeCommit.oid'\n```\n\nRecord as `mergeSha`. If the field is null (rare race), retry after 2 seconds once; if still null, emit success with `mergeSha=null` and a warning log.\n\n### Step 3b.6 — Emit Result\n\nEmit to stdout:\n\n```json\n{\"merged\":true,\"mergeSha\":\"{SHA}\",\"prState\":\"MERGED\",\"waitedSec\":{N},\"autoEnabled\":false}\n```\n\nExit 0.\n\nLog: `\"[Phase 3b] PR #{N} merged synchronously; mergeSha={SHA} waitedSec={N}\"`\n\n## Phase 4 — Result Emission\n\nAll exit paths (success and failure) emit EXACTLY one line of JSON to stdout and exit with the code from the table in \"Output Contract > Exit Codes\". Error envelopes carry:\n\n```json\n{\"merged\":false,\"prState\":\"{STATE}\",\"waitedSec\":{N},\"autoEnabled\":false,\"errorCode\":\"{CODE}\",\"message\":\"{HUMAN_MESSAGE}\"}\n```\n\nStderr SHOULD carry the `[Phase N] ...` log lines; stdout MUST carry only the single JSON envelope. This separation allows callers to pipe `stdout | jq` without contamination.\n\n## Examples\n\n### Example 1 — Happy Path (Synchronous, merge strategy)\n\n```bash\n\u002Fx-merge-pr --pr 123\n```\n\nResult (stdout):\n\n```json\n{\"merged\":true,\"mergeSha\":\"a1b2...\",\"prState\":\"MERGED\",\"waitedSec\":3,\"autoEnabled\":false}\n```\n\n### Example 2 — Squash Strategy with Auto-Merge\n\n```bash\n\u002Fx-merge-pr --pr 456 --strategy squash --auto\n```\n\nResult (returns in \u003C5s):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":true}\n```\n\nGitHub will merge asynchronously when CI + approvals pass.\n\n### Example 3 — Rebase Strategy, Preserve Branch\n\n```bash\n\u002Fx-merge-pr --pr 789 --strategy rebase --delete-branch false\n```\n\nResult (stdout):\n\n```json\n{\"merged\":true,\"mergeSha\":\"c3d4...\",\"prState\":\"MERGED\",\"waitedSec\":5,\"autoEnabled\":false}\n```\n\n### Example 4 — Idempotent Re-Invocation\n\n```bash\n\u002Fx-merge-pr --pr 123     # already merged by previous run\n```\n\nResult (exits 0 immediately, no gh pr merge call):\n\n```json\n{\"merged\":true,\"prState\":\"MERGED\",\"waitedSec\":0,\"autoEnabled\":false}\n```\n\n### Example 5 — Error: Not Approved\n\n```bash\n\u002Fx-merge-pr --pr 123\n```\n\nResult (exit 3):\n\n```json\n{\"merged\":false,\"prState\":\"OPEN\",\"waitedSec\":0,\"autoEnabled\":false,\"errorCode\":\"NOT_APPROVED\",\"message\":\"PR #123 not approved\"}\n```\n\n## Error Envelope\n\n| Scenario | Exit | Error Code |\n| :--- | :--- | :--- |\n| `--pr` missing, zero, negative, non-numeric | 1 | `PR_NOT_FOUND` |\n| `--strategy` not in `{merge, squash, rebase}` | 1 | `INVALID_STRATEGY` |\n| `--wait-timeout-min` not in `[1, 600]` | 1 | `INVALID_TIMEOUT` |\n| `gh pr view` returns \"not found\" | 1 | `PR_NOT_FOUND` |\n| PR state is `CLOSED` (not merged) | 2 | `PR_CLOSED` |\n| `reviewDecision != APPROVED` (synchronous mode) | 3 | `NOT_APPROVED` |\n| `statusCheckRollup` has failing checks (synchronous mode) | 4 | `CI_FAILING` |\n| `mergeable == CONFLICTING` | 5 | `MERGE_CONFLICT` |\n| `mergeable == UNKNOWN` past timeout (synchronous mode) | 6 | `TIMEOUT` |\n\n## Integration Notes\n\n| Consumer | Relationship | Usage |\n| :--- | :--- | :--- |\n| `x-create-pr` | Invokes this skill when `--auto-merge \u003Cstrategy>` is passed (RULE-002 auto-merge default ON) | After creating the PR, forwards `--strategy` + `--auto` to `x-merge-pr` to enable native GitHub auto-merge. |\n| `x-implement-epic` | Invokes this skill in Phase 1.3b (merge of epic PRs to `epic\u002FXXXX` or `develop`) | Replaces the previous ~80 lines of inline `gh pr merge` + polling. Calls with `--strategy merge --auto` by default. |\n| `x-manage-pr-merge-train` | Does NOT call this skill directly | Uses its own train-specific merge orchestration; however, both skills share the same exit-code semantics for consistency across the `\u002Fx-pr-*` family. |\n\n### Called Tools\n\n- `gh pr view` (one call minimum, two in the auto-merge \"clean state\" edge case)\n- `gh pr merge` (one call in synchronous path; one call in `--auto` path)\n- `sleep` (only in the `UNKNOWN` \u002F `IN_PROGRESS` polling loop)\n\nNo git operations are performed by this skill — branch deletion is delegated to `gh pr merge --delete-branch`.\n\n## Testing Contract\n\n### Unit Tests (mocked `gh` CLI)\n\n1. `idempotent_alreadyMerged_returnsMergedTrue` — `gh pr view` returns `state=MERGED`; skill exits 0 with `{merged:true, waitedSec:0}`.\n2. `closed_pr_returnsPrClosed` — `gh pr view` returns `state=CLOSED`; skill exits 2 with `PR_CLOSED`.\n3. `sync_happy_path_mergeStrategy` — all pre-checks pass; `gh pr merge --merge` succeeds; skill emits `{merged:true, mergeSha:...}`.\n4. `sync_happy_path_squashStrategy` — same as above with `--strategy squash`; verifies `--squash` flag propagation.\n5. `sync_happy_path_rebaseStrategy` — same with `--strategy rebase`; verifies `--rebase` flag propagation.\n6. `sync_notApproved_exitsNotApproved` — `reviewDecision=REVIEW_REQUIRED`; skill exits 3 with `NOT_APPROVED`.\n7. `sync_ciFailing_exitsCiFailing` — `statusCheckRollup` contains a `FAILURE` conclusion; skill exits 4.\n8. `sync_mergeConflict_exitsMergeConflict` — `mergeable=CONFLICTING`; skill exits 5.\n9. `sync_timeout_exitsTimeout` — `mergeable=UNKNOWN` persists past `--wait-timeout-min=1`; skill exits 6 after ~60s.\n10. `auto_mode_enablesAutoMerge` — `--auto` → `gh pr merge --auto` returns 0; skill emits `{autoEnabled:true, merged:false}` in \u003C5s.\n11. `auto_mode_cleanStateEdgeCase` — `gh pr merge --auto` returns \"clean state\"; skill refetches and reports as synchronous merge.\n12. `deleteBranchFalse_doesNotAppendFlag` — `--delete-branch false`; verify `gh pr merge` invocation does NOT include `--delete-branch`.\n13. `invalidStrategy_exitsInvalidStrategy` — `--strategy invalid`; skill exits 1 with `INVALID_STRATEGY` before any `gh` call.\n14. `invalidTimeout_exitsInvalidTimeout` — `--wait-timeout-min 0` or `--wait-timeout-min 601`; skill exits 1 with `INVALID_TIMEOUT`.\n15. `missingPr_exitsPrNotFound` — no `--pr`; skill exits 1 with `PR_NOT_FOUND`.\n\n### Smoke Test (gated by `GITHUB_TOKEN`)\n\nSingle end-to-end test (`PrMergeSmokeTest`) that:\n\n1. Creates a disposable PR on a fixture repository branch.\n2. Invokes `\u002Fx-merge-pr --pr {N} --auto`.\n3. Verifies `autoEnabled=true` and exit 0.\n4. Waits up to 60s for GitHub to merge asynchronously.\n5. Cleans up the test branch.\n\nSkipped when `GITHUB_TOKEN` is absent; reported as `SKIPPED` to avoid failing CI in contributor forks.\n\n### Coverage Targets\n\n- Line coverage: ≥ 95% (skill-level logic exercised by the 15 unit scenarios above).\n- Branch coverage: ≥ 90% (each decision table branch in Phases 1, 3a, 3b covered).\n\n## Forbidden\n\n- NEVER invoke `git merge` directly — the skill MUST route all merges through `gh pr merge` to preserve GitHub-side history and branch-deletion side effects.\n- NEVER bypass pre-checks in synchronous mode — even on repeat invocations after a CI flake.\n- NEVER emit multiple JSON envelopes to stdout — callers rely on single-line parsing.\n- NEVER exit 0 on any error condition — the exit-code table is a hard contract.\n- NEVER poll `gh pr merge` itself — only `gh pr view` is polled. `gh pr merge` is a single synchronous call per phase.\n\n## Status\n\n- **Story**: story-0049-0003 (epic-0049, \"x-merge-pr extraction from x-implement-epic Phase 1.3b\")\n- **Parent Contract**: RULE-002 (auto-merge default ON), RULE-004 (preserve history), RULE-005 (thin orchestrator)\n- **Dependencies**: none (first skill in its sub-tree of epic-0049)\n- **Downstream**: story-0049-0016 (`x-create-pr --auto-merge` propagation), story-0049-0018 (`x-implement-epic` refactor)\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25,"context-budget":26,"user-invocable":27,"requires-capabilities":28},"Bash, Read, Write","--pr N [--strategy merge|squash|rebase] [--delete-branch true|false] [--auto] [--wait-timeout-min N]","medium",true,[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-merge-pr",1,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment","https:\u002F\u002Fgithub.com\u002Freview-bench","https:\u002F\u002Freview-bench.ai","An open benchmark for AI code review.","2026-10-27 06:56:37",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":27},[40,43,46],{"tool":41,"command":42},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-merge-pr",{"tool":44,"command":45},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-merge-pr",{"tool":47,"command":48},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-merge-pr","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-merge-pr\u002FSKILL.md",[],[52,59,66,73,80,87],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M757M8J48TQ1Y3X25GSJBXAS","x-parallel-eval","Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan \u002F x-story-plan, applies the parallelism-heuristics knowledge pack (hard \u002F regen \u002F soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fx-parallel-eval\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M757M57XMR9546S69466HDWT","parallelism-heuristics","Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard \u002F regen \u002F soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fparallelism-heuristics\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M757M11SZ8P1VCQABT08QVYA","x-watch-pr-ci","Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-watch-pr-ci\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M757KW53K8KFPGADFB4PH949","x-validate-docs","Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared\u002Fauto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-validate-docs\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M757KQZHSA10MKC0CR571D60","x-update-system-architecture","Incrementally updates docs\u002Farchitecture\u002Fsystem.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component\u002Fintegration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-system-architecture\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M757KKBT5Q1SVF8DMJBVF46M","x-update-architecture","Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-architecture\u002FSKILL.md",[],[]]