[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M752PBY7VTX6YRW1MMPBP4N7":3,"skill-same:01M752PBY7VTX6YRW1MMPBP4N7":60},{"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":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":37,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M752PBY7VTX6YRW1MMPBP4N7","x-internal-verify-phase-gates",null,"Validates phase transitions for orchestrators under Rule 25. Four modes: --mode pre (assert predecessor phases completed before entering phase N), --mode post (assert all child tasks of phase N are completed AND all expected artifacts exist on disk), --mode wave (post-Batch-B verification of parallel wave completeness: N child TaskUpdate completed + N artifacts exist), --mode final (terminal gate composing with x-internal-verify-epic-integrity). Reads execution-state.json.taskTracking.phaseGateResults and TaskList task state; writes back the gate result. Emits a single-line JSON envelope {passed, mode, skill, phase, expectedTasks, completedTasks, missingTasks, expectedArtifacts, missingArtifacts, wallclockMs, timestamp}. Exit 0 on passed, 12 on failure, 13 on malformed args, 14 on task-resolution timeout. First skill in the x-internal-* convention authored by EPIC-0055; eighth overall (after status-update, report-write, args-normalize, story-load-context, story-build-plan, story-verify, story-resume, epic-build-plan, epic-integrity-gate, epic-branch-ensure, story-report) and the eighth under internal\u002Fplan\u002F.","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-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-phase-gates\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-internal-verify-phase-gates\ndescription: \"Validates phase transitions for orchestrators under Rule 25. Four modes: --mode pre (assert predecessor phases completed before entering phase N), --mode post (assert all child tasks of phase N are completed AND all expected artifacts exist on disk), --mode wave (post-Batch-B verification of parallel wave completeness: N child TaskUpdate completed + N artifacts exist), --mode final (terminal gate composing with x-internal-verify-epic-integrity). Reads execution-state.json.taskTracking.phaseGateResults and TaskList task state; writes back the gate result. Emits a single-line JSON envelope {passed, mode, skill, phase, expectedTasks, completedTasks, missingTasks, expectedArtifacts, missingArtifacts, wallclockMs, timestamp}. Exit 0 on passed, 12 on failure, 13 on malformed args, 14 on task-resolution timeout. First skill in the x-internal-* convention authored by EPIC-0055; eighth overall (after status-update, report-write, args-normalize, story-load-context, story-build-plan, story-verify, story-resume, epic-build-plan, epic-integrity-gate, epic-branch-ensure, story-report) and the eighth under internal\u002Fplan\u002F.\"\nmodel: haiku\nvisibility: internal\nuser-invocable: false\nallowed-tools: Read, Bash\nargument-hint: \"--mode pre|post|wave|final [--skill \u003Cname>] [--phase \u003CPhase N>] [--parent-task-id \u003Cid>] [--expected-tasks id1,id2] [--expected-artifacts path1,path2] [--timeout-s \u003CN>] [--emit-tracker true|false] [--state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json]\"\ncategory: internal-plan\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 and greetings to save tokens.\n\n> 🔒 **INTERNAL SKILL**\n> Esta skill é invocada apenas por outras skills (orquestradores).\n> NÃO é destinada a invocação direta pelo usuário.\n> Callers principais: `x-implement-epic`, `x-implement-story`,\n> `x-implement-task`, `x-release`, `x-orchestrate-epic`, `x-review-codebase`,\n> `x-review-pr`, `x-manage-pr-merge-train` (após retrofits em stories\n> 0055-0003 a 0055-0010). Oitava skill no subdir `internal\u002Fplan\u002F`\n> (após `x-internal-load-story-context`, `x-internal-build-story-plan`,\n> `x-internal-verify-story`, `x-internal-resume-story`,\n> `x-internal-build-epic-plan`, `x-internal-verify-epic-integrity`,\n> `x-internal-write-story-report`). Primeira skill introduzida por EPIC-0055.\n\n# Skill: x-internal-verify-phase-gates\n\n## Purpose\n\nValidates phase transitions in orchestrators governed by Rule 25. A phase gate is a synchronous, fail-fast check that runs around each numbered `## Phase N` section: a PRE gate ensures the predecessor phases are cleanly `completed`; a POST gate ensures every child task of the current phase is `completed` AND every artifact the phase was supposed to produce exists on disk. Rule 25 moves enforcement from \"Stop hook notices afterwards\" (Rule 24 defense-in-depth) to **sync gate before the phase is marked completed** — missing tasks or artifacts abort the lifecycle with exit 12.\n\nResponsibilities (single):\n\n1. Parse arguments against the 4-mode matrix (`pre` \u002F `post` \u002F `wave` \u002F `final`).\n2. For PRE mode: scan predecessor phases' `phaseGateResults` in `execution-state.json` and `TaskList` for any non-`completed` sibling task.\n3. For POST \u002F WAVE \u002F FINAL mode: intersect `--expected-tasks` against `TaskList` looking for `completed` status on each, AND `stat`-check every path in `--expected-artifacts`.\n4. Atomically append a `phaseGateResults[]` entry to `execution-state.json.taskTracking` via `x-internal-update-status` (delegated).\n5. Emit a single-line JSON envelope on stdout.\n6. Translate every failure class to the exit-code catalogue.\n\nNon-responsibilities (explicit):\n\n- Does NOT mutate task state (no `TaskUpdate(status: ...)`). The caller owns task state transitions.\n- Does NOT run the PostToolUse hook. The hook (`verify-phase-gates.sh`, story-0055-0002) reads `phaseGateResults[]` this skill writes.\n- Does NOT emit `TaskCreate` unless `--mode wave --emit-tracker true` is set (Rule 25 Invariant 6 exception — one tracker task to surface wave wall-clock).\n- Does NOT run tests, build, or any project-level validation. `x-internal-verify-story` \u002F `x-internal-verify-epic-integrity` own those — this gate composes with them via `--mode final`.\n\n## Convention Anchors (x-internal-* — EPIC-0055)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-verify-phase-gates\u002F` | Read-and-compute carve-out, co-located with other story\u002Fepic gate skills. |\n| Frontmatter `visibility` | `internal` | Generator filters from `\u002Fhelp` menu. |\n| Frontmatter `user-invocable` | `false` | Declarative complement. |\n| Frontmatter `model` | `haiku` | Zero-reasoning lookup (RULE-023 utility tier). |\n| Body marker | `> 🔒 **INTERNAL SKILL**` | Rule 22 §Body marker. |\n| Allowed tools | `Read, Bash` | Read for artifact stat; Bash for jq + state-file I\u002FO via `x-internal-update-status`. |\n\n## Triggers\n\nBare-slash form intentionally omitted — never invoked by a user. All invocations follow Rule 13 Pattern 1 (INLINE-SKILL):\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode pre --skill x-implement-story --phase Phase-1 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102,103,104,105,106 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2 --expected-tasks 201,202,203,204,205,206,207,208,209 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n## Parameters\n\n| Flag | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--mode \u003Ctier>` | M | — | One of `pre`, `post`, `wave`, `final`. Case-insensitive; normalized to lowercase. |\n| `--skill \u003Cname>` | M | — | Calling orchestrator name (recorded in the envelope and state file). |\n| `--phase \u003CPhase N>` | M | — | Exact phase label (matches `## Phase N — Name` header). |\n| `--parent-task-id \u003Cid>` | O | — | Integer ID of the parent `TaskCreate` that owns the phase. Used to discover children via `TaskList`. |\n| `--expected-tasks \u003Cids>` | O | — | Comma-separated integer task IDs the gate must see as `completed`. Required for `post`, `wave`, `final`. |\n| `--expected-artifacts \u003Cpaths>` | O | — | Comma-separated relative paths that MUST exist on disk. Required for `post` and `final`. Optional for `wave`. |\n| `--timeout-s \u003CN>` | O | `10` | Integer seconds to retry-poll if any `--expected-tasks` is still `in_progress`. Exceeded → exit 14. |\n| `--emit-tracker \u003Cbool>` | O | `false` | Only legal with `--mode wave`. Emits a single tracker `TaskCreate` with `subject` = `\u003Cskill> › \u003Cphase> › wave-tracker` for CLI visibility. |\n| `--state-file \u003Cpath>` | O | auto | Path to `execution-state.json`. Auto-derived from `$CWD\u002Fai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json` when epic is unambiguous. |\n\n## Response Contract\n\nOn success (exit 0) and on failure (exit 12) the skill writes a single-line JSON object to stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `passed` | `Boolean` | yes | `true` when all checks passed. |\n| `mode` | `String` | yes | Echo of `--mode`. |\n| `skill` | `String` | yes | Echo of `--skill`. |\n| `phase` | `String` | yes | Echo of `--phase`. |\n| `expectedTasks` | `Array\u003CInteger>` | yes | Echo of `--expected-tasks` (`[]` if absent). |\n| `completedTasks` | `Array\u003CInteger>` | yes | Subset of `expectedTasks` confirmed `completed` in `TaskList`. |\n| `missingTasks` | `Array\u003CInteger>` | yes | `expectedTasks \\ completedTasks`. Empty when `passed=true`. |\n| `expectedArtifacts` | `Array\u003CString>` | yes | Echo of `--expected-artifacts`. |\n| `missingArtifacts` | `Array\u003CString>` | yes | Subset of `expectedArtifacts` that do NOT exist on disk. Empty when `passed=true`. |\n| `wallclockMs` | `Integer` | yes | Gate execution time in milliseconds (monotonic clock). |\n| `timestamp` | `String` (ISO-8601) | yes | Gate completion timestamp in UTC. |\n\nThe envelope shape is authoritative. `phaseGateResults[]` in `execution-state.json` receives a slim projection: `{phase, mode, passed, missingArtifacts, missingTasks, timestamp}`.\n\n## Exit Codes\n\n| Code | Name | Condition |\n| :--- | :--- | :--- |\n| 0 | `OK` | `passed=true` |\n| 12 | `PHASE_GATE_FAILED` | `passed=false` — at least one missing task or missing artifact |\n| 13 | `PHASE_GATE_MALFORMED` | Unknown flag, missing required flag, `--emit-tracker true` without `--mode wave`, `--expected-tasks` on `--mode pre`, etc. |\n| 14 | `PHASE_GATE_TIMEOUT` | An expected task is still `in_progress` after `--timeout-s` seconds of polling |\n| 64 | `EX_USAGE` | `--mode` value not in {pre, post, wave, final} or `--phase` fails Rule-25 `subject` regex |\n\nNo partial-success state: the first non-recoverable error aborts the run and yields a non-zero exit.\n\n## Workflow\n\n### Step 1 — Arg parse + validation\n\nParse arguments with the shared Rule-14 `while (($#))` loop. Normalize `--mode` to lowercase. Validate:\n\n- `--mode ∈ {pre, post, wave, final}` — else exit 64.\n- `--phase` matches Rule-25 subject regex — else exit 64.\n- For `--mode post|wave|final`: `--expected-tasks` MUST be present.\n- For `--mode post|final`: `--expected-artifacts` MUST be present.\n- For `--mode pre`: `--expected-tasks` \u002F `--expected-artifacts` MUST be absent (checks come from state file only) — else exit 13.\n- `--emit-tracker true` requires `--mode wave` — else exit 13.\n\n### Step 2 — Resolve `--state-file`\n\nWhen `--state-file` absent, search upward from `$PWD` for `ai\u002Fepics\u002Fepic-*\u002Fexecution-state.json`. Exactly one match → proceed. Zero or multiple → exit 13 with `STATE_FILE_AMBIGUOUS`.\n\n### Step 3 — Short-circuit on `taskTracking.enabled=false`\n\nRead `taskTracking.enabled` from the state file. Default is `true` when the field is absent (Rule 19 fallback). Only when the value is **explicitly** `false`, emit:\n\n```json\n{\"passed\":true,\"mode\":\"\u003Cmode>\",\"skill\":\"\u003Cskill>\",\"phase\":\"\u003Cphase>\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":\u003CN>,\"timestamp\":\"\u003Ct>\",\"note\":\"taskTracking disabled (legacy mode)\"}\n```\n\nand exit 0. This is the Rule-19 backward-compat path — legacy epics treat gates as no-ops.\n\n### Step 4 — Mode-specific validation\n\n#### 4a. `--mode pre`\n\nRead `execution-state.json.taskTracking.phaseGateResults[]`. Let `N = int(phase.replace(\"Phase-\",\"\"))`. For every `k ∈ [0, N-1]`, at least one entry with `phase=\"Phase-k\"` AND `mode=\"post\"` AND `passed=true` MUST be present. Missing entries → `missingTasks=[\u003CPhase-k-placeholder>]`, `passed=false`, exit 12.\n\nNo artifact checks in PRE mode.\n\n#### 4b. `--mode post`\n\n- **Tasks:** For each `id ∈ --expected-tasks`, retrieve its status. Use `TaskList` via Bash (e.g., reading from `~\u002F.claude\u002Fstate\u002Ftasks\u002F\u003Csession>\u002Ftasks.json` when available, falling back to `execution-state.json.taskTracking.taskIndex[]`). `completed` → add to `completedTasks`; else add to `missingTasks`. If any task is `in_progress`, poll every 500ms up to `--timeout-s`; persistent → exit 14.\n- **Artifacts:** For each `path ∈ --expected-artifacts`, `[[ -e \"$path\" ]]` — present → drop; absent → append to `missingArtifacts`.\n- `passed = missingTasks.isEmpty() && missingArtifacts.isEmpty()`.\n\n#### 4c. `--mode wave`\n\nSame as POST, but:\n- Semantics: ALL wave members must be `completed` simultaneously (no ordering assumption).\n- `--expected-artifacts` is optional — waves that only produce task commits (no files) are valid.\n- When `--emit-tracker true`, emit exactly one `TaskCreate(subject: \"\u003Cskill> › \u003Cphase> › wave-tracker\")` upfront and `TaskUpdate(status: \"completed\")` at the end, regardless of result.\n\n#### 4d. `--mode final`\n\nSuperset of POST. Additionally scans the Rule-24 mandatory artifact set (when `--skill = x-implement-story`): verify-envelope, review-story, techlead-review, story-completion-report. Acts as the synchronous Rule-24 gate the Stop-hook normally enforces asynchronously.\n\n### Step 5 — Write `phaseGateResults[]` entry\n\nAtomically append to `execution-state.json.taskTracking.phaseGateResults[]` via:\n\n```markdown\nSkill(skill: \"x-internal-update-status\",\n      args: \"--file \u003Cstate-file> --type phase-gate --phase \u003Cphase> --mode \u003Cmode> --passed \u003Ctrue|false> --missing-artifacts \u003Ccomma-list> --missing-tasks \u003Ccomma-list>\")\n```\n\nThe status-update skill owns the flock-protected read-modify-write.\n\n### Step 6 — Emit envelope\n\nSingle-line JSON via `jq -nc` with all fields. Exit 0 on success, 12 on failure.\n\n## Idempotency Contract\n\nThe skill is idempotent by design:\n\n- Re-invoking the same gate (same `--mode`, `--skill`, `--phase`) is a replay: it re-reads task state + artifact state, writes a fresh `phaseGateResults[]` entry, and returns the current result. Previous entries remain for audit history.\n- Concurrent invocations serialize on `x-internal-update-status`'s flock (file-level).\n\n## Performance Contract\n\n| Mode | Budget |\n| :--- | :--- |\n| `pre` | \u003C 50ms (single file read + jq projection) |\n| `post` | \u003C 100ms + artifact stat × N (usually \u003C 150ms total) |\n| `wave` | same as post |\n| `final` | \u003C 200ms (adds Rule-24 scan) |\n\nTarget global overhead across an epic with ~30 gates: \u003C 5 seconds, i.e., well below the EPIC-0055 DoD threshold of \"\u003C 2% wall-clock overhead\".\n\n## Examples\n\n### Example 1 — Happy path, PRE mode\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode pre --skill x-implement-story --phase Phase-2 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"pre\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-2\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":12,\"timestamp\":\"2026-04-24T10:30:00Z\"}\n```\nExit: 0.\n\n### Example 2 — POST mode all green\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102,103,104,105,106 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[101,102,103,104,105,106],\"completedTasks\":[101,102,103,104,105,106],\"missingTasks\":[],\"expectedArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md\",\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md\"],\"missingArtifacts\":[],\"wallclockMs\":47,\"timestamp\":\"2026-04-24T10:35:00Z\"}\n```\nExit: 0.\n\n### Example 3 — POST mode, missing artifacts\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\")\n```\n\nOutput:\n```json\n{\"passed\":false,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[101,102],\"completedTasks\":[101,102],\"missingTasks\":[],\"expectedArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md\",\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\"],\"missingArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\"],\"wallclockMs\":38,\"timestamp\":\"2026-04-24T10:40:00Z\"}\n```\nExit: 12.\n\n### Example 4 — WAVE mode, one member still running\n\nWith `--timeout-s 2` and task 203 in `in_progress`:\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2 --expected-tasks 201,202,203,204,205,206,207,208,209 --timeout-s 2\")\n```\n\nStderr:\n```\nPHASE_GATE_TIMEOUT — task 203 still in_progress after 2s\n```\nExit: 14.\n\n### Example 5 — Malformed: wave without expected-tasks\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2\")\n```\n\nStderr:\n```\nPHASE_GATE_MALFORMED — --mode wave requires --expected-tasks\n```\nExit: 13.\n\n### Example 6 — Legacy short-circuit\n\nWhen `execution-state.json.taskTracking.enabled = false`:\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101 --expected-artifacts foo.md\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":3,\"timestamp\":\"2026-04-24T10:45:00Z\",\"note\":\"taskTracking disabled (legacy mode)\"}\n```\nExit: 0.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| `--mode` value invalid | `PHASE_GATE_MALFORMED`; exit 13 |\n| `--phase` fails regex | Exit 64 |\n| Required flag missing per mode | `PHASE_GATE_MALFORMED`; exit 13 |\n| State file absent AND no `--state-file` override | `STATE_FILE_AMBIGUOUS`; exit 13 |\n| `taskTracking.enabled=false` | Short-circuit; `passed=true`; exit 0 |\n| Expected task `in_progress` beyond timeout | `PHASE_GATE_TIMEOUT`; exit 14 |\n| At least one expected task missing \u002F non-completed | `PHASE_GATE_FAILED`; exit 12 |\n| At least one expected artifact absent | `PHASE_GATE_FAILED`; exit 12 |\n| `x-internal-update-status` delegation fails | Propagate stderr; exit 13 with `STATE_UPDATE_FAILED` |\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator excludes skills with `visibility: internal` from:\n\n1. `.claude\u002FREADME.md` inventory table.\n2. `\u002Fhelp` menu.\n3. User-facing autocomplete.\n\nStill copied to `.claude\u002Fskills\u002F` (flat layout) so other skills can invoke via `Skill(...)`.\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers — the calling orchestrator owns telemetry wrapping. Passive hooks capture `tool.call` events for the underlying `Bash`\u002F`Read` invocations.\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-internal-update-status` | delegate | Atomic flock-protected write of `phaseGateResults[]` entry. |\n| `x-implement-epic`, `x-implement-story`, `x-implement-task`, `x-release`, `x-orchestrate-epic`, `x-review-codebase`, `x-review-pr`, `x-manage-pr-merge-train` | callers | Retrofit in stories 0055-0003 → 0055-0010. |\n| `x-internal-verify-epic-integrity` | composition | `--mode final` of `x-implement-epic` Phase 4 composes with integrity gate (gate runs first; integrity-gate is subsequent). |\n| `x-internal-verify-story` | composition | `--mode final` of `x-implement-story` Phase 3 composes with story-verify (verify runs first; gate confirms its outputs). |\n| `.claude\u002Fhooks\u002Fverify-phase-gates.sh` | consumer (Stop hook) | Reads `phaseGateResults[]` this skill writes; emits WARNING + exit 2 on gate failure at end of LLM turn. |\n| `.claude\u002Fhooks\u002Fenforce-phase-sequence.sh` | consumer (PreToolUse hook) | Reads `phaseGateResults[]` to block `Skill(...)` of an orchestrator whose predecessor phase has no `passed=true` entry. |\n\n## Rule References\n\n- Rule 25 — the specification this skill enforces.\n- Rule 22 — Skill Visibility convention (`x-internal-*`, visibility: internal).\n- Rule 23 — Model Selection (haiku tier for utility skills).\n- Rule 13 — Skill Invocation Protocol (INLINE-SKILL pattern).\n- Rule 19 — Backward Compatibility (legacy short-circuit behavior).\n- Rule 24 — Execution Integrity (composition via `--mode final`).\n\n## Full Protocol\n\nPer-mode state-file schema, full flock + `x-internal-update-status` interaction pseudocode, polling algorithm for `in_progress` tasks, and the `phaseGateResults[]` append-only invariant live in [`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md).\n","## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, and Concise.\n- **Efficiency**: Remove all conversational fillers and greetings to save tokens.\n\n> 🔒 **INTERNAL SKILL**\n> Esta skill é invocada apenas por outras skills (orquestradores).\n> NÃO é destinada a invocação direta pelo usuário.\n> Callers principais: `x-implement-epic`, `x-implement-story`,\n> `x-implement-task`, `x-release`, `x-orchestrate-epic`, `x-review-codebase`,\n> `x-review-pr`, `x-manage-pr-merge-train` (após retrofits em stories\n> 0055-0003 a 0055-0010). Oitava skill no subdir `internal\u002Fplan\u002F`\n> (após `x-internal-load-story-context`, `x-internal-build-story-plan`,\n> `x-internal-verify-story`, `x-internal-resume-story`,\n> `x-internal-build-epic-plan`, `x-internal-verify-epic-integrity`,\n> `x-internal-write-story-report`). Primeira skill introduzida por EPIC-0055.\n\n# Skill: x-internal-verify-phase-gates\n\n## Purpose\n\nValidates phase transitions in orchestrators governed by Rule 25. A phase gate is a synchronous, fail-fast check that runs around each numbered `## Phase N` section: a PRE gate ensures the predecessor phases are cleanly `completed`; a POST gate ensures every child task of the current phase is `completed` AND every artifact the phase was supposed to produce exists on disk. Rule 25 moves enforcement from \"Stop hook notices afterwards\" (Rule 24 defense-in-depth) to **sync gate before the phase is marked completed** — missing tasks or artifacts abort the lifecycle with exit 12.\n\nResponsibilities (single):\n\n1. Parse arguments against the 4-mode matrix (`pre` \u002F `post` \u002F `wave` \u002F `final`).\n2. For PRE mode: scan predecessor phases' `phaseGateResults` in `execution-state.json` and `TaskList` for any non-`completed` sibling task.\n3. For POST \u002F WAVE \u002F FINAL mode: intersect `--expected-tasks` against `TaskList` looking for `completed` status on each, AND `stat`-check every path in `--expected-artifacts`.\n4. Atomically append a `phaseGateResults[]` entry to `execution-state.json.taskTracking` via `x-internal-update-status` (delegated).\n5. Emit a single-line JSON envelope on stdout.\n6. Translate every failure class to the exit-code catalogue.\n\nNon-responsibilities (explicit):\n\n- Does NOT mutate task state (no `TaskUpdate(status: ...)`). The caller owns task state transitions.\n- Does NOT run the PostToolUse hook. The hook (`verify-phase-gates.sh`, story-0055-0002) reads `phaseGateResults[]` this skill writes.\n- Does NOT emit `TaskCreate` unless `--mode wave --emit-tracker true` is set (Rule 25 Invariant 6 exception — one tracker task to surface wave wall-clock).\n- Does NOT run tests, build, or any project-level validation. `x-internal-verify-story` \u002F `x-internal-verify-epic-integrity` own those — this gate composes with them via `--mode final`.\n\n## Convention Anchors (x-internal-* — EPIC-0055)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-verify-phase-gates\u002F` | Read-and-compute carve-out, co-located with other story\u002Fepic gate skills. |\n| Frontmatter `visibility` | `internal` | Generator filters from `\u002Fhelp` menu. |\n| Frontmatter `user-invocable` | `false` | Declarative complement. |\n| Frontmatter `model` | `haiku` | Zero-reasoning lookup (RULE-023 utility tier). |\n| Body marker | `> 🔒 **INTERNAL SKILL**` | Rule 22 §Body marker. |\n| Allowed tools | `Read, Bash` | Read for artifact stat; Bash for jq + state-file I\u002FO via `x-internal-update-status`. |\n\n## Triggers\n\nBare-slash form intentionally omitted — never invoked by a user. All invocations follow Rule 13 Pattern 1 (INLINE-SKILL):\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode pre --skill x-implement-story --phase Phase-1 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102,103,104,105,106 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2 --expected-tasks 201,202,203,204,205,206,207,208,209 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\n## Parameters\n\n| Flag | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--mode \u003Ctier>` | M | — | One of `pre`, `post`, `wave`, `final`. Case-insensitive; normalized to lowercase. |\n| `--skill \u003Cname>` | M | — | Calling orchestrator name (recorded in the envelope and state file). |\n| `--phase \u003CPhase N>` | M | — | Exact phase label (matches `## Phase N — Name` header). |\n| `--parent-task-id \u003Cid>` | O | — | Integer ID of the parent `TaskCreate` that owns the phase. Used to discover children via `TaskList`. |\n| `--expected-tasks \u003Cids>` | O | — | Comma-separated integer task IDs the gate must see as `completed`. Required for `post`, `wave`, `final`. |\n| `--expected-artifacts \u003Cpaths>` | O | — | Comma-separated relative paths that MUST exist on disk. Required for `post` and `final`. Optional for `wave`. |\n| `--timeout-s \u003CN>` | O | `10` | Integer seconds to retry-poll if any `--expected-tasks` is still `in_progress`. Exceeded → exit 14. |\n| `--emit-tracker \u003Cbool>` | O | `false` | Only legal with `--mode wave`. Emits a single tracker `TaskCreate` with `subject` = `\u003Cskill> › \u003Cphase> › wave-tracker` for CLI visibility. |\n| `--state-file \u003Cpath>` | O | auto | Path to `execution-state.json`. Auto-derived from `$CWD\u002Fai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json` when epic is unambiguous. |\n\n## Response Contract\n\nOn success (exit 0) and on failure (exit 12) the skill writes a single-line JSON object to stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `passed` | `Boolean` | yes | `true` when all checks passed. |\n| `mode` | `String` | yes | Echo of `--mode`. |\n| `skill` | `String` | yes | Echo of `--skill`. |\n| `phase` | `String` | yes | Echo of `--phase`. |\n| `expectedTasks` | `Array\u003CInteger>` | yes | Echo of `--expected-tasks` (`[]` if absent). |\n| `completedTasks` | `Array\u003CInteger>` | yes | Subset of `expectedTasks` confirmed `completed` in `TaskList`. |\n| `missingTasks` | `Array\u003CInteger>` | yes | `expectedTasks \\ completedTasks`. Empty when `passed=true`. |\n| `expectedArtifacts` | `Array\u003CString>` | yes | Echo of `--expected-artifacts`. |\n| `missingArtifacts` | `Array\u003CString>` | yes | Subset of `expectedArtifacts` that do NOT exist on disk. Empty when `passed=true`. |\n| `wallclockMs` | `Integer` | yes | Gate execution time in milliseconds (monotonic clock). |\n| `timestamp` | `String` (ISO-8601) | yes | Gate completion timestamp in UTC. |\n\nThe envelope shape is authoritative. `phaseGateResults[]` in `execution-state.json` receives a slim projection: `{phase, mode, passed, missingArtifacts, missingTasks, timestamp}`.\n\n## Exit Codes\n\n| Code | Name | Condition |\n| :--- | :--- | :--- |\n| 0 | `OK` | `passed=true` |\n| 12 | `PHASE_GATE_FAILED` | `passed=false` — at least one missing task or missing artifact |\n| 13 | `PHASE_GATE_MALFORMED` | Unknown flag, missing required flag, `--emit-tracker true` without `--mode wave`, `--expected-tasks` on `--mode pre`, etc. |\n| 14 | `PHASE_GATE_TIMEOUT` | An expected task is still `in_progress` after `--timeout-s` seconds of polling |\n| 64 | `EX_USAGE` | `--mode` value not in {pre, post, wave, final} or `--phase` fails Rule-25 `subject` regex |\n\nNo partial-success state: the first non-recoverable error aborts the run and yields a non-zero exit.\n\n## Workflow\n\n### Step 1 — Arg parse + validation\n\nParse arguments with the shared Rule-14 `while (($#))` loop. Normalize `--mode` to lowercase. Validate:\n\n- `--mode ∈ {pre, post, wave, final}` — else exit 64.\n- `--phase` matches Rule-25 subject regex — else exit 64.\n- For `--mode post|wave|final`: `--expected-tasks` MUST be present.\n- For `--mode post|final`: `--expected-artifacts` MUST be present.\n- For `--mode pre`: `--expected-tasks` \u002F `--expected-artifacts` MUST be absent (checks come from state file only) — else exit 13.\n- `--emit-tracker true` requires `--mode wave` — else exit 13.\n\n### Step 2 — Resolve `--state-file`\n\nWhen `--state-file` absent, search upward from `$PWD` for `ai\u002Fepics\u002Fepic-*\u002Fexecution-state.json`. Exactly one match → proceed. Zero or multiple → exit 13 with `STATE_FILE_AMBIGUOUS`.\n\n### Step 3 — Short-circuit on `taskTracking.enabled=false`\n\nRead `taskTracking.enabled` from the state file. Default is `true` when the field is absent (Rule 19 fallback). Only when the value is **explicitly** `false`, emit:\n\n```json\n{\"passed\":true,\"mode\":\"\u003Cmode>\",\"skill\":\"\u003Cskill>\",\"phase\":\"\u003Cphase>\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":\u003CN>,\"timestamp\":\"\u003Ct>\",\"note\":\"taskTracking disabled (legacy mode)\"}\n```\n\nand exit 0. This is the Rule-19 backward-compat path — legacy epics treat gates as no-ops.\n\n### Step 4 — Mode-specific validation\n\n#### 4a. `--mode pre`\n\nRead `execution-state.json.taskTracking.phaseGateResults[]`. Let `N = int(phase.replace(\"Phase-\",\"\"))`. For every `k ∈ [0, N-1]`, at least one entry with `phase=\"Phase-k\"` AND `mode=\"post\"` AND `passed=true` MUST be present. Missing entries → `missingTasks=[\u003CPhase-k-placeholder>]`, `passed=false`, exit 12.\n\nNo artifact checks in PRE mode.\n\n#### 4b. `--mode post`\n\n- **Tasks:** For each `id ∈ --expected-tasks`, retrieve its status. Use `TaskList` via Bash (e.g., reading from `~\u002F.claude\u002Fstate\u002Ftasks\u002F\u003Csession>\u002Ftasks.json` when available, falling back to `execution-state.json.taskTracking.taskIndex[]`). `completed` → add to `completedTasks`; else add to `missingTasks`. If any task is `in_progress`, poll every 500ms up to `--timeout-s`; persistent → exit 14.\n- **Artifacts:** For each `path ∈ --expected-artifacts`, `[[ -e \"$path\" ]]` — present → drop; absent → append to `missingArtifacts`.\n- `passed = missingTasks.isEmpty() && missingArtifacts.isEmpty()`.\n\n#### 4c. `--mode wave`\n\nSame as POST, but:\n- Semantics: ALL wave members must be `completed` simultaneously (no ordering assumption).\n- `--expected-artifacts` is optional — waves that only produce task commits (no files) are valid.\n- When `--emit-tracker true`, emit exactly one `TaskCreate(subject: \"\u003Cskill> › \u003Cphase> › wave-tracker\")` upfront and `TaskUpdate(status: \"completed\")` at the end, regardless of result.\n\n#### 4d. `--mode final`\n\nSuperset of POST. Additionally scans the Rule-24 mandatory artifact set (when `--skill = x-implement-story`): verify-envelope, review-story, techlead-review, story-completion-report. Acts as the synchronous Rule-24 gate the Stop-hook normally enforces asynchronously.\n\n### Step 5 — Write `phaseGateResults[]` entry\n\nAtomically append to `execution-state.json.taskTracking.phaseGateResults[]` via:\n\n```markdown\nSkill(skill: \"x-internal-update-status\",\n      args: \"--file \u003Cstate-file> --type phase-gate --phase \u003Cphase> --mode \u003Cmode> --passed \u003Ctrue|false> --missing-artifacts \u003Ccomma-list> --missing-tasks \u003Ccomma-list>\")\n```\n\nThe status-update skill owns the flock-protected read-modify-write.\n\n### Step 6 — Emit envelope\n\nSingle-line JSON via `jq -nc` with all fields. Exit 0 on success, 12 on failure.\n\n## Idempotency Contract\n\nThe skill is idempotent by design:\n\n- Re-invoking the same gate (same `--mode`, `--skill`, `--phase`) is a replay: it re-reads task state + artifact state, writes a fresh `phaseGateResults[]` entry, and returns the current result. Previous entries remain for audit history.\n- Concurrent invocations serialize on `x-internal-update-status`'s flock (file-level).\n\n## Performance Contract\n\n| Mode | Budget |\n| :--- | :--- |\n| `pre` | \u003C 50ms (single file read + jq projection) |\n| `post` | \u003C 100ms + artifact stat × N (usually \u003C 150ms total) |\n| `wave` | same as post |\n| `final` | \u003C 200ms (adds Rule-24 scan) |\n\nTarget global overhead across an epic with ~30 gates: \u003C 5 seconds, i.e., well below the EPIC-0055 DoD threshold of \"\u003C 2% wall-clock overhead\".\n\n## Examples\n\n### Example 1 — Happy path, PRE mode\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode pre --skill x-implement-story --phase Phase-2 --state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"pre\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-2\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":12,\"timestamp\":\"2026-04-24T10:30:00Z\"}\n```\nExit: 0.\n\n### Example 2 — POST mode all green\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102,103,104,105,106 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[101,102,103,104,105,106],\"completedTasks\":[101,102,103,104,105,106],\"missingTasks\":[],\"expectedArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md\",\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-0060-0001.md\"],\"missingArtifacts\":[],\"wallclockMs\":47,\"timestamp\":\"2026-04-24T10:35:00Z\"}\n```\nExit: 0.\n\n### Example 3 — POST mode, missing artifacts\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101,102 --expected-artifacts ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md,ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\")\n```\n\nOutput:\n```json\n{\"passed\":false,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[101,102],\"completedTasks\":[101,102],\"missingTasks\":[],\"expectedArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-0060-0001.md\",\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\"],\"missingArtifacts\":[\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fmissing.md\"],\"wallclockMs\":38,\"timestamp\":\"2026-04-24T10:40:00Z\"}\n```\nExit: 12.\n\n### Example 4 — WAVE mode, one member still running\n\nWith `--timeout-s 2` and task 203 in `in_progress`:\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2 --expected-tasks 201,202,203,204,205,206,207,208,209 --timeout-s 2\")\n```\n\nStderr:\n```\nPHASE_GATE_TIMEOUT — task 203 still in_progress after 2s\n```\nExit: 14.\n\n### Example 5 — Malformed: wave without expected-tasks\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode wave --skill x-review-codebase --phase Phase-2\")\n```\n\nStderr:\n```\nPHASE_GATE_MALFORMED — --mode wave requires --expected-tasks\n```\nExit: 13.\n\n### Example 6 — Legacy short-circuit\n\nWhen `execution-state.json.taskTracking.enabled = false`:\n\n```bash\nSkill(skill: \"x-internal-verify-phase-gates\",\n      args: \"--mode post --skill x-implement-story --phase Phase-1 --expected-tasks 101 --expected-artifacts foo.md\")\n```\n\nOutput:\n```json\n{\"passed\":true,\"mode\":\"post\",\"skill\":\"x-implement-story\",\"phase\":\"Phase-1\",\"expectedTasks\":[],\"completedTasks\":[],\"missingTasks\":[],\"expectedArtifacts\":[],\"missingArtifacts\":[],\"wallclockMs\":3,\"timestamp\":\"2026-04-24T10:45:00Z\",\"note\":\"taskTracking disabled (legacy mode)\"}\n```\nExit: 0.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| `--mode` value invalid | `PHASE_GATE_MALFORMED`; exit 13 |\n| `--phase` fails regex | Exit 64 |\n| Required flag missing per mode | `PHASE_GATE_MALFORMED`; exit 13 |\n| State file absent AND no `--state-file` override | `STATE_FILE_AMBIGUOUS`; exit 13 |\n| `taskTracking.enabled=false` | Short-circuit; `passed=true`; exit 0 |\n| Expected task `in_progress` beyond timeout | `PHASE_GATE_TIMEOUT`; exit 14 |\n| At least one expected task missing \u002F non-completed | `PHASE_GATE_FAILED`; exit 12 |\n| At least one expected artifact absent | `PHASE_GATE_FAILED`; exit 12 |\n| `x-internal-update-status` delegation fails | Propagate stderr; exit 13 with `STATE_UPDATE_FAILED` |\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator excludes skills with `visibility: internal` from:\n\n1. `.claude\u002FREADME.md` inventory table.\n2. `\u002Fhelp` menu.\n3. User-facing autocomplete.\n\nStill copied to `.claude\u002Fskills\u002F` (flat layout) so other skills can invoke via `Skill(...)`.\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers — the calling orchestrator owns telemetry wrapping. Passive hooks capture `tool.call` events for the underlying `Bash`\u002F`Read` invocations.\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-internal-update-status` | delegate | Atomic flock-protected write of `phaseGateResults[]` entry. |\n| `x-implement-epic`, `x-implement-story`, `x-implement-task`, `x-release`, `x-orchestrate-epic`, `x-review-codebase`, `x-review-pr`, `x-manage-pr-merge-train` | callers | Retrofit in stories 0055-0003 → 0055-0010. |\n| `x-internal-verify-epic-integrity` | composition | `--mode final` of `x-implement-epic` Phase 4 composes with integrity gate (gate runs first; integrity-gate is subsequent). |\n| `x-internal-verify-story` | composition | `--mode final` of `x-implement-story` Phase 3 composes with story-verify (verify runs first; gate confirms its outputs). |\n| `.claude\u002Fhooks\u002Fverify-phase-gates.sh` | consumer (Stop hook) | Reads `phaseGateResults[]` this skill writes; emits WARNING + exit 2 on gate failure at end of LLM turn. |\n| `.claude\u002Fhooks\u002Fenforce-phase-sequence.sh` | consumer (PreToolUse hook) | Reads `phaseGateResults[]` to block `Skill(...)` of an orchestrator whose predecessor phase has no `passed=true` entry. |\n\n## Rule References\n\n- Rule 25 — the specification this skill enforces.\n- Rule 22 — Skill Visibility convention (`x-internal-*`, visibility: internal).\n- Rule 23 — Model Selection (haiku tier for utility skills).\n- Rule 13 — Skill Invocation Protocol (INLINE-SKILL pattern).\n- Rule 19 — Backward Compatibility (legacy short-circuit behavior).\n- Rule 24 — Execution Integrity (composition via `--mode final`).\n\n## Full Protocol\n\nPer-mode state-file schema, full flock + `x-internal-update-status` interaction pseudocode, polling algorithm for `in_progress` tasks, and the `phaseGateResults[]` append-only invariant live in [`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md).\n",{"name":5,"model":24,"category":25,"visibility":26,"description":7,"allowed-tools":27,"argument-hint":28,"context-budget":29,"user-invocable":20,"requires-capabilities":30},"haiku","internal-plan","internal","Read, Bash","--mode pre|post|wave|final [--skill \u003Cname>] [--phase \u003CPhase N>] [--parent-task-id \u003Cid>] [--expected-tasks id1,id2] [--expected-artifacts path1,path2] [--timeout-s \u003CN>] [--emit-tracker true|false] [--state-file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json]","medium",[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-phase-gates",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":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-verify-phase-gates",{"tool":46,"command":47},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-verify-phase-gates",{"tool":49,"command":50},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-verify-phase-gates","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-phase-gates\u002FSKILL.md",true,[54],{"path":55,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Ffull-protocol.md","REFERENCE","参考文档",8187,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-phase-gates\u002Freferences\u002Ffull-protocol.md",[61,68,75,82,89,96],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"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":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"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":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"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":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"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":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"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":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"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",[],[]]