[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75788M84WJWBZAX48VBZBHR":3,"skill-same:01M75788M84WJWBZAX48VBZBHR":59},{"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":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M75788M84WJWBZAX48VBZBHR","x-internal-build-story-plan",null,"Orchestrates parallel story-planning (Phase 1 carve-out of x-implement-story): invokes x-plan-architecture (Step 1A) and then dispatches 5 sibling Agent subagents in ONE assistant message for implementation plan, test plan, task breakdown, security assessment, and compliance assessment (Steps 1B-1F). Applies the Rule 13 SUBAGENT-GENERAL pattern as the canonical parallel-planning gateway. Scope-aware: SIMPLE skips 1E\u002F1F. Returns a consolidated envelope of artifact paths to the calling orchestrator. Fifth skill in the x-internal-* convention and the second under internal\u002Fplan\u002F (after x-internal-load-story-context).","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\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-internal-build-story-plan\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-internal-build-story-plan\ndescription: \"Orchestrates parallel story-planning (Phase 1 carve-out of x-implement-story): invokes x-plan-architecture (Step 1A) and then dispatches 5 sibling Agent subagents in ONE assistant message for implementation plan, test plan, task breakdown, security assessment, and compliance assessment (Steps 1B-1F). Applies the Rule 13 SUBAGENT-GENERAL pattern as the canonical parallel-planning gateway. Scope-aware: SIMPLE skips 1E\u002F1F. Returns a consolidated envelope of artifact paths to the calling orchestrator. Fifth skill in the x-internal-* convention and the second under internal\u002Fplan\u002F (after x-internal-load-story-context).\"\nvisibility: internal\nuser-invocable: false\nallowed-tools: Bash, Skill, Agent\nargument-hint: \"--story-id \u003Cstory-XXXX-YYYY> --epic-id \u003CXXXX> [--scope \u003CSIMPLE|STANDARD|COMPLEX>] [--skip-review]\"\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> Caller principal: x-implement-story (Phase 1 carve-out).\n> Quinta skill da convenção `x-internal-*` (após x-internal-update-status\n> pilot 0049-0005, x-internal-write-report 0049-0006,\n> x-internal-normalize-args 0049-0007, e x-internal-load-story-context\n> 0049-0011). Segunda skill na subdir `internal\u002Fplan\u002F` (co-habita com\n> x-internal-load-story-context). A subdir `plan\u002F` agrupa as skills que\n> orquestram lógica de planejamento; difere de `internal\u002Fops\u002F`, cujas\n> sibling skills mutam estado (execution-state.json, reports).\n\n# Skill: x-internal-build-story-plan\n\n## Purpose\n\nCarve out Phase 1 (Architecture Planning + Parallel Planning) of\n`x-implement-story` into a single orchestration skill. The ~250\ninline lines currently inside `x-implement-story` Phase 1 become a\nsingle `Skill(skill: \"x-internal-build-story-plan\", …)` invocation;\nthe orchestrator shrinks to a read-the-envelope consumer.\n\nResponsibilities (single):\n\n1. Invoke `x-plan-architecture` for the story (Step 1A).\n2. Dispatch 5 sibling `Agent(general-purpose, …)` subagents in ONE\n   assistant message for Steps 1B (implementation plan), 1C (test\n   plan), 1D (task breakdown), 1E (security assessment), and 1F\n   (compliance assessment).\n3. Gate Steps 1E and 1F behind `--scope` (SIMPLE → skip 1E\u002F1F).\n4. Collect artifact paths from every subagent, assemble a\n   consolidated response envelope, and emit it on stdout.\n5. Translate individual subagent or `x-plan-architecture` failures into the\n   stable exit-code catalogue below.\n\nNon-responsibilities (explicit):\n\n- The skill does NOT read, re-parse, or classify the story file —\n  that is `x-internal-load-story-context`'s contract (story-0049-0011).\n- The skill does NOT mutate `execution-state.json`, story\n  `**Status:**` headers, or IMPLEMENTATION-MAP — those belong to\n  `x-internal-update-status` (story-0049-0005).\n- The skill does NOT run the parallelism-collision gate — Phase 1.5\n  remains the orchestrator's responsibility via `x-evaluate-parallelism`\n  (EPIC-0041).\n- The skill does NOT perform pre-check \u002F freshness classification of\n  the 7 planning artifacts — that runs upstream inside\n  `x-internal-load-story-context` (Step 4). Callers only invoke this\n  skill when `planningMode ∈ {HYBRID, INLINE}` and a regen is\n  actually required.\n\n## Convention Anchors (x-internal-*)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-build-story-plan\u002F` | `internal\u002F` prefix scopes visibility; `plan\u002F` co-locates with the sibling read-only carve-out (x-internal-load-story-context) |\n| Frontmatter `visibility` | `internal` | Generator filters these from `\u002Fhelp` menu |\n| Frontmatter `user-invocable` | `false` | Declarative complement to `visibility: internal` |\n| Body marker | `> 🔒 **INTERNAL SKILL**` block as first non-frontmatter content | Visible to humans browsing the repo; no parsing required |\n| Allowed tools | `Bash, Skill, Agent` | Minimal for an orchestrator: `Skill` for Step 1A (x-plan-architecture), `Agent` for Steps 1B-1F, `Bash` for argv parsing and the envelope `jq -nc` assembly |\n| Naming | `x-internal-{subject}-{action}` | Mirrors Rule 04 skill taxonomy; `story-build-plan` = subject+action |\n\nAudit rule: Rule 22 (Lifecycle Integrity) validates every skill under\n`internal\u002F**` satisfies all 6 anchors above. Violations fail\n`LifecycleIntegrityAuditTest`.\n\n## Triggers\n\nBare-slash form is intentionally omitted — this skill is never\ninvoked by a human typing `\u002Fx-internal-build-story-plan` in chat.\nAll invocations follow Rule 13 INLINE-SKILL pattern from a calling\norchestrator:\n\n```markdown\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0012 --epic-id 0049 --scope STANDARD\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--story-id \u003Cid>` | M | — | Story identifier (`story-XXXX-YYYY` canonical form) |\n| `--epic-id \u003Cid>` | M | — | 4-digit epic identifier (`XXXX`) — used to resolve `ai\u002Fepics\u002Fepic-XXXX\u002F` |\n| `--scope \u003Ctier>` | O | `STANDARD` | `SIMPLE` \u002F `STANDARD` \u002F `COMPLEX`; `SIMPLE` skips Steps 1E (security) and 1F (compliance) |\n| `--skip-review` | O | `false` | When `true`, signals downstream subagents to omit inline peer-review passes in the generated artifacts (advisory only — does not affect artifact count) |\n\nAll four argument forms (`--key value`, `--key=value`, empty, and\nunknown-flag rejection) follow the Rule-14 rejection matrix: reject\nunknown flags and missing required flags with exit `64` (sysexits\n`EX_USAGE`). The `--story-id` value is normalised to lowercase and\nvalidated against `^story-[0-9]{4}-[0-9]{4}$`; `--epic-id` is\nzero-padded to 4 digits.\n\n## Response Contract\n\nOn success the skill writes a single-line JSON object to stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `archPlan` | `String` (path) | yes | Path of the architecture plan (`ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-XXXX-YYYY.md`) |\n| `implPlan` | `String` (path) | yes | Path of the implementation plan (`plan-story-XXXX-YYYY.md`) |\n| `testPlan` | `String` (path) | yes | Path of the test plan (`tests-story-XXXX-YYYY.md`) |\n| `taskBreakdown` | `String` (path) | yes | Path of the task breakdown (`tasks-story-XXXX-YYYY.md`) |\n| `securityAssessment` | `String` (path) \\| `null` | no — null when `scope=SIMPLE` | Path of the security assessment (`security-story-XXXX-YYYY.md`) |\n| `complianceAssessment` | `String` (path) \\| `null` | no — null when `scope=SIMPLE` | Path of the compliance assessment (`compliance-story-XXXX-YYYY.md`) |\n| `taskMap` | `String` (path) | yes | Path of the task-implementation map (`task-implementation-map-story-XXXX-YYYY.md`) |\n| `scope` | `String` | yes | Echo of the resolved scope tier — lets the caller verify the gate applied |\n| `skipped` | `Array\u003CString>` | yes | Names of gated steps skipped (e.g., `[\"1E\", \"1F\"]` in SIMPLE; `[]` otherwise) |\n\nThe six artifact basenames (all under `ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002F`):\n\n1. `arch-story-XXXX-YYYY.md` (Step 1A — `x-plan-architecture`)\n2. `plan-story-XXXX-YYYY.md` (Step 1B — Senior Architect subagent)\n3. `tests-story-XXXX-YYYY.md` (Step 1C — `x-plan-tests` subagent)\n4. `tasks-story-XXXX-YYYY.md` (Step 1D — `x-lib-decompose-task` subagent)\n5. `security-story-XXXX-YYYY.md` (Step 1E — `x-model-threats` subagent; omitted in SIMPLE)\n6. `compliance-story-XXXX-YYYY.md` (Step 1F — Compliance Engineer subagent; omitted in SIMPLE)\n\nThe task-implementation-map (`task-implementation-map-story-XXXX-YYYY.md`)\nis produced by the Step 1D subagent as part of the task-decomposition\nartifact (EPIC-0038 v2 contract).\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | All required artifacts produced | — |\n| 1 | ARCH_PLAN_FAILED | `x-plan-architecture` (Step 1A) returned non-zero or failed to produce `arch-story-*.md` | `Architecture plan failed: \u003Cdetail>` |\n| 2 | SUBAGENT_FAILED | Any of Steps 1B-1F (subagent dispatch) failed or did not produce its artifact | `Subagent \u003Cname> failed: \u003Cdetail>` |\n| 64 | EX_USAGE | Unknown flag, missing required flag, or malformed `--story-id` \u002F `--epic-id` | `usage: \u003Cdetail>` |\n\nNo partial-success state: if any required step fails, the skill\nexits non-zero. Optional steps (1E \u002F 1F in SIMPLE) are not errors\nwhen skipped by the gate; they ARE errors when dispatched and\nfailed.\n\n## Workflow\n\n### Step 1 — Argument parsing and path resolution\n\nParse arguments with the Rule-14 single-file `while (($#))` loop;\nreject unknown flags \u002F missing required flags \u002F empty values with\nexit `64`. Normalise `--story-id` to lowercase and verify against\n`^story-[0-9]{4}-[0-9]{4}$`; zero-pad `--epic-id` to 4 digits.\nDerive:\n\n```bash\nepic_dir=\"ai\u002Fepics\u002Fepic-${epic_id}\"\nstory_file=\"${epic_dir}\u002F${story_id}.md\"\nplans_dir=\"${epic_dir}\u002Fplans\"\n```\n\nWhen `${epic_dir}` is not a directory, exit 64 with\n`usage: epic dir not found: ai\u002Fepics\u002Fepic-\u003Cid>`. The skill does NOT\nre-validate the story file existence — that is the caller's\nresponsibility (`x-internal-load-story-context` runs upstream).\n\n### Step 1A — Architecture plan (sequential)\n\nInvoke `x-plan-architecture` via the Rule 13 INLINE-SKILL pattern:\n\n```markdown\nSkill(skill: \"x-plan-architecture\",\n      args: \"--story-id ${story_id} --epic-id ${epic_id}\")\n```\n\nExpected output: `${plans_dir}\u002Farch-story-${story_id}.md`.\n\nOn any failure (non-zero exit from `x-plan-architecture`, or the expected\nfile does not exist after invocation), emit to stderr:\n`Architecture plan failed: \u003Cunderlying message>` and exit `1`.\n\nStep 1A MUST complete before Step 1B-1F dispatch: later steps read\narchitectural context (ports, layers, dependency direction) from\nthe arch plan.\n\n### Steps 1B-1F — Parallel subagent dispatch (one assistant message)\n\nDispatch exactly 5 sibling `Agent(general-purpose, …)` tool calls\nin ONE assistant message — the canonical Rule 13 Pattern 2\n(SUBAGENT-GENERAL) parallel-launch shape. When `--scope=SIMPLE`,\ndispatch only Steps 1B \u002F 1C \u002F 1D (3 siblings) and record `1E` and\n`1F` in `skipped`.\n\nEach subagent prompt follows the structure:\n\n```markdown\nFIRST ACTION: \u003Cno-op — TaskCreate\u002FTaskUpdate unavailable in this harness>.\nYou are a \u003Crole>. Read context files:\n- ai\u002Fepics\u002Fepic-${epic_id}\u002F${story_id}.md (story)\n- ai\u002Fepics\u002Fepic-${epic_id}\u002Fplans\u002Farch-story-${story_id}.md (arch plan)\n- \u003Crole-specific templates under .claude\u002Ftemplates\u002F>.\nProduce \u003Cartifact> at ${plans_dir}\u002F\u003Cbasename>.\nLAST ACTION: return the absolute path of the artifact you produced.\n```\n\nPer-step role and artifact mapping:\n\n| Step | Role | Skill delegate (if any) | Artifact basename |\n| :--- | :--- | :--- | :--- |\n| 1B | Senior Architect | — (inline prompt) | `plan-story-${story_id}.md` |\n| 1C | QA Engineer | `x-plan-tests` via `Skill(…)` inside subagent | `tests-story-${story_id}.md` |\n| 1D | Task Decomposer | `x-lib-decompose-task` via `Skill(…)` inside subagent | `tasks-story-${story_id}.md` + `task-implementation-map-story-${story_id}.md` |\n| 1E | Security Engineer | `x-model-threats` via `Skill(…)` inside subagent | `security-story-${story_id}.md` |\n| 1F | Compliance Engineer | — (inline prompt) | `compliance-story-${story_id}.md` |\n\n#### Origin Marker Emission (EPIC-0059 — mandatory for all 1B-1F artifacts)\n\nEvery subagent producing a planning artifact MUST prepend the YAML frontmatter block\nbefore writing the file content:\n\n```yaml\n---\ngenerated-by: x-internal-build-story-plan@$(git rev-parse HEAD 2>\u002Fdev\u002Fnull || echo \"unknown\")\ngenerated-at: $(date -u +%Y-%m-%dT%H:%M:%SZ)\nstory-id: ${story_id}\n---\n```\n\nInclude the following instruction in each subagent prompt:\n\n> **MANDATORY — FIRST STEP of writing the artifact:** Prepend the following YAML frontmatter\n> block at the very top of the output file before any Markdown content:\n> ```yaml\n> ---\n> generated-by: x-internal-build-story-plan@\u003Crun: git rev-parse HEAD>\n> generated-at: \u003Crun: date -u +%Y-%m-%dT%H:%M:%SZ>\n> story-id: ${story_id}\n> ---\n> ```\n> This is required by `audit-execution-integrity.sh` Phase-1 validation (EPIC-0059, Rule 24).\n> Artifacts without this block fail the CI audit with `EIE_EVIDENCE_MISSING`.\n\nThe `--skip-review` flag propagates into the subagent prompt when\nset: a single sentence instructing the subagent to omit the inline\npeer-review pass customarily appended to its artifact.\n\n### Step 2 — Collect results and assemble envelope\n\nAfter all subagents return, validate that every expected artifact\nexists on disk:\n\n```bash\nfor basename in arch plan tests tasks; do\n  path=\"${plans_dir}\u002F${basename}-story-${story_id}.md\"\n  [[ -f \"${path}\" ]] || { err \"Subagent ${basename} did not produce ${path}\"; exit 2; }\ndone\n```\n\nRepeat for `security-` \u002F `compliance-` ONLY when `scope != SIMPLE`.\n\nAssemble the response envelope via `jq -nc` so the shape is\nauthoritative:\n\n```bash\njq -nc \\\n  --arg archPlan \"${plans_dir}\u002Farch-story-${story_id}.md\" \\\n  --arg implPlan \"${plans_dir}\u002Fplan-story-${story_id}.md\" \\\n  --arg testPlan \"${plans_dir}\u002Ftests-story-${story_id}.md\" \\\n  --arg taskBreakdown \"${plans_dir}\u002Ftasks-story-${story_id}.md\" \\\n  --arg taskMap \"${plans_dir}\u002Ftask-implementation-map-story-${story_id}.md\" \\\n  --arg scope \"${scope}\" \\\n  --argjson skipped \"${skipped_json}\" \\\n  --arg securityAssessment \"${security_path_or_null}\" \\\n  --arg complianceAssessment \"${compliance_path_or_null}\" \\\n  '{archPlan:$archPlan, implPlan:$implPlan, testPlan:$testPlan,\n    taskBreakdown:$taskBreakdown, taskMap:$taskMap,\n    securityAssessment: (if $securityAssessment == \"\" then null\n                         else $securityAssessment end),\n    complianceAssessment: (if $complianceAssessment == \"\" then null\n                           else $complianceAssessment end),\n    scope:$scope, skipped:$skipped}'\n```\n\nEmit on stdout as a single line terminated by `\\n`. Exit 0.\n\n## Examples\n\n### Example 1 — Happy path: STANDARD scope (6 artifacts)\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0012 --epic-id 0049 --scope STANDARD\")\n```\n\nOutput:\n```json\n{\"archPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-XXXX-YYYY.md\",\"implPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-XXXX-YYYY.md\",\"testPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftests-story-XXXX-YYYY.md\",\"taskBreakdown\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftasks-story-XXXX-YYYY.md\",\"taskMap\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftask-implementation-map-story-XXXX-YYYY.md\",\"securityAssessment\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fsecurity-story-XXXX-YYYY.md\",\"complianceAssessment\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fcompliance-story-XXXX-YYYY.md\",\"scope\":\"STANDARD\",\"skipped\":[]}\n```\nExit: 0.\n\n### Example 2 — SIMPLE scope skips 1E \u002F 1F\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0001 --epic-id 0049 --scope SIMPLE\")\n```\n\nOutput (truncated):\n```json\n{\"archPlan\":\"…\",\"implPlan\":\"…\",\"testPlan\":\"…\",\"taskBreakdown\":\"…\",\"taskMap\":\"…\",\"securityAssessment\":null,\"complianceAssessment\":null,\"scope\":\"SIMPLE\",\"skipped\":[\"1E\",\"1F\"]}\n```\nExit: 0.\n\n### Example 3 — COMPLEX scope (same artifact set as STANDARD)\n\nCOMPLEX currently produces the same 6 artifacts as STANDARD; the\ntier is echoed in `scope` for downstream decisions (e.g., post-Phase-2\nstakeholder review gate in `x-implement-story`) but does not change\nthe planning surface.\n\n### Example 4 — Architecture plan fails\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0099 --epic-id 0049 --scope STANDARD\")\n```\n\nStderr:\n```\nArchitecture plan failed: x-plan-architecture exit 3 (story not found)\n```\nExit: 1.\n\n### Example 5 — Subagent failure\n\nStep 1B (Senior Architect) fails to produce `plan-story-…md`.\n\nStderr:\n```\nSubagent 1B failed: plan-story-0049-0012.md not produced\n```\nExit: 2.\n\n## Outputs\n\n| Artifact | Path | Description |\n| :--- | :--- | :--- |\n| Response envelope | stdout | Single-line JSON matching the Response Contract |\n| Error diagnostic | stderr | Single line, non-empty only on exit ≠ 0 |\n| Planning artifacts | `ai\u002Fepics\u002Fepic-${epic_id}\u002Fplans\u002F*.md` | Written by `x-plan-architecture` + Step 1B-1F subagents |\n\nThis skill DOES create files — unlike `x-internal-load-story-context`,\nwhich is strictly read-only. The `allowed-tools` frontmatter\nincludes `Skill` and `Agent` to reflect this: the writes happen\ninside the dispatched subagents \u002F the invoked `x-plan-architecture`, not\ndirectly from this skill's body.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| Missing required flag | Print `usage:` banner to stderr; exit 64 |\n| Unknown flag | Print `usage: unknown flag …` to stderr; exit 64 |\n| Malformed `--story-id` | `usage: --story-id must match story-NNNN-NNNN`; exit 64 |\n| Missing epic dir | `usage: epic dir not found: ai\u002Fepics\u002Fepic-\u003Cid>`; exit 64 |\n| `x-plan-architecture` non-zero | `Architecture plan failed: \u003Cdetail>`; exit 1 |\n| Expected `arch-story-*.md` absent after Step 1A | `Architecture plan failed: arch-story-*.md not produced`; exit 1 |\n| Any subagent returns error | `Subagent \u003Cstep> failed: \u003Cdetail>`; exit 2 |\n| Any subagent returns success but required artifact absent | `Subagent \u003Cstep> failed: \u003Cbasename> not produced`; exit 2 |\n| `jq` absent on PATH | Exit 127 with `jq is required`; abort before dispatch |\n| `--scope` value unrecognised | `usage: --scope must be SIMPLE \u002F STANDARD \u002F COMPLEX`; exit 64 |\n\nThe skill is fail-fast: the first error aborts the run. Partial\nartifacts produced by successful subagents remain on disk (the\norchestrator may choose to re-invoke with the same arguments —\n`x-plan-architecture` and each subagent are idempotent with respect to their\nartifact path).\n\n## Performance Contract\n\nTarget: ~3-5 minutes for STANDARD scope on a typical story. The\ndominant cost is the wall-clock of the slowest subagent (Step 1B-1F\nrun in parallel, so the total ≈ max(individual)). Step 1A is\nstrictly sequential and typically ≤ 60 seconds.\n\nSIMPLE-scope runs save ~0-30 seconds by skipping 1E and 1F (those\nsubagents are typically I\u002FO-bound on template reads, not model\ninference).\n\n## Testing\n\nAcceptance scenarios (mirroring Section 7 of story-0049-0012):\n\n1. **Happy path — STANDARD.** All 6 artifacts produced; envelope\n   echoes `scope=STANDARD`, `skipped=[]`.\n2. **Degenerate — SIMPLE.** 4 artifacts produced; envelope reports\n   `securityAssessment=null`, `complianceAssessment=null`,\n   `skipped=[\"1E\",\"1F\"]`.\n3. **Boundary — COMPLEX.** Same 6 artifacts as STANDARD; envelope\n   echoes `scope=COMPLEX`.\n4. **Error — `x-plan-architecture` fails.** Exit 1; stderr starts with\n   `Architecture plan failed:`.\n5. **Error — subagent failure.** Exit 2; stderr identifies which\n   step (`1B` \u002F `1C` \u002F `1D` \u002F `1E` \u002F `1F`).\n\nCoverage requirement: ≥ 95% line \u002F ≥ 90% branch across the\ninvoking Bash codepaths and the dispatch \u002F envelope-assembly\nlogic. Goldens (if added) lock the SKILL.md rendering under\n`src\u002Ftest\u002Fresources\u002Fgolden\u002Finternal\u002Fplan\u002Fx-internal-build-story-plan\u002F`\nper the sibling pattern.\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator MUST exclude skills with\n`visibility: internal` from:\n\n1. The `.claude\u002FREADME.md` skill-inventory table.\n2. The `\u002Fhelp` menu listing surfaced by Claude Code.\n3. User-facing autocomplete in the chat input.\n\nInternal skills are still copied into `.claude\u002Fskills\u002F` (flat\nlayout) so `Skill(skill: \"x-internal-…\")` invocations from other\nskills resolve correctly. The invariant: **user cannot see them;\norchestrators can invoke them.**\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers —\ntelemetry is produced by the invoking orchestrator (the `phase`\nwrapping the orchestrator's own step is the correct aggregation\nboundary). Passive hooks still capture `tool.call` for each\nunderlying `Skill` \u002F `Agent` \u002F `Bash` invocation made from inside\nthe skill body.\n\nSubagent `subagent.start` \u002F `subagent.end` markers around Steps\n1B-1F are emitted by the caller (`x-implement-story` Phase 1)\nbecause that orchestrator owns the enclosing phase. Re-emitting\nfrom inside this skill would double-count the wave.\n\nReference: Rule 13 (Skill Invocation Protocol), Rule 22 (Lifecycle\nIntegrity Audit), ADR-0010 (Interactive Gates Convention — exempts\ninternal skills from the 3-option menu contract).\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-implement-story` | caller (primary) | Phase 1 carve-out: ~250 inline lines collapse to one `Skill(skill: \"x-internal-build-story-plan\", …)` invocation in story-0049-0019 |\n| `x-internal-load-story-context` | upstream peer | Caller runs this sibling first to decide whether Phase 1 needs regen (`planningMode != PRE_PLANNED`); only then invokes `x-internal-build-story-plan` |\n| `x-plan-architecture` | delegate (Step 1A) | Sequential precondition; produces `arch-story-*.md` consumed by Steps 1B-1F |\n| `x-plan-tests` | delegate (Step 1C) | Invoked from inside the QA-Engineer subagent |\n| `x-lib-decompose-task` | delegate (Step 1D) | Invoked from inside the Task-Decomposer subagent; produces both the tasks file and the task-implementation-map |\n| `x-model-threats` | delegate (Step 1E) | Invoked from inside the Security-Engineer subagent; skipped in SIMPLE |\n| `x-evaluate-parallelism` | consumer (downstream) | Phase 1.5 of the caller reads the `task-implementation-map` produced here to compute the collision matrix (EPIC-0041) |\n| `x-internal-update-status` | peer | Separate concern (mutates state); never invoked from this skill |\n\nDownstream stories that depend on this carve-out:\nstory-0049-0019 (orchestrator consumes the envelope and deletes the\ninline Phase 1 block).\n\nFull workflow detail (subagent prompt catalogue per step, scope-gate\ndecision table, envelope-assembly edge cases, and the interaction\nwith `x-internal-load-story-context`'s upstream freshness result)\nlives in [`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md)\nper ADR-0011.\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> Caller principal: x-implement-story (Phase 1 carve-out).\n> Quinta skill da convenção `x-internal-*` (após x-internal-update-status\n> pilot 0049-0005, x-internal-write-report 0049-0006,\n> x-internal-normalize-args 0049-0007, e x-internal-load-story-context\n> 0049-0011). Segunda skill na subdir `internal\u002Fplan\u002F` (co-habita com\n> x-internal-load-story-context). A subdir `plan\u002F` agrupa as skills que\n> orquestram lógica de planejamento; difere de `internal\u002Fops\u002F`, cujas\n> sibling skills mutam estado (execution-state.json, reports).\n\n# Skill: x-internal-build-story-plan\n\n## Purpose\n\nCarve out Phase 1 (Architecture Planning + Parallel Planning) of\n`x-implement-story` into a single orchestration skill. The ~250\ninline lines currently inside `x-implement-story` Phase 1 become a\nsingle `Skill(skill: \"x-internal-build-story-plan\", …)` invocation;\nthe orchestrator shrinks to a read-the-envelope consumer.\n\nResponsibilities (single):\n\n1. Invoke `x-plan-architecture` for the story (Step 1A).\n2. Dispatch 5 sibling `Agent(general-purpose, …)` subagents in ONE\n   assistant message for Steps 1B (implementation plan), 1C (test\n   plan), 1D (task breakdown), 1E (security assessment), and 1F\n   (compliance assessment).\n3. Gate Steps 1E and 1F behind `--scope` (SIMPLE → skip 1E\u002F1F).\n4. Collect artifact paths from every subagent, assemble a\n   consolidated response envelope, and emit it on stdout.\n5. Translate individual subagent or `x-plan-architecture` failures into the\n   stable exit-code catalogue below.\n\nNon-responsibilities (explicit):\n\n- The skill does NOT read, re-parse, or classify the story file —\n  that is `x-internal-load-story-context`'s contract (story-0049-0011).\n- The skill does NOT mutate `execution-state.json`, story\n  `**Status:**` headers, or IMPLEMENTATION-MAP — those belong to\n  `x-internal-update-status` (story-0049-0005).\n- The skill does NOT run the parallelism-collision gate — Phase 1.5\n  remains the orchestrator's responsibility via `x-evaluate-parallelism`\n  (EPIC-0041).\n- The skill does NOT perform pre-check \u002F freshness classification of\n  the 7 planning artifacts — that runs upstream inside\n  `x-internal-load-story-context` (Step 4). Callers only invoke this\n  skill when `planningMode ∈ {HYBRID, INLINE}` and a regen is\n  actually required.\n\n## Convention Anchors (x-internal-*)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-build-story-plan\u002F` | `internal\u002F` prefix scopes visibility; `plan\u002F` co-locates with the sibling read-only carve-out (x-internal-load-story-context) |\n| Frontmatter `visibility` | `internal` | Generator filters these from `\u002Fhelp` menu |\n| Frontmatter `user-invocable` | `false` | Declarative complement to `visibility: internal` |\n| Body marker | `> 🔒 **INTERNAL SKILL**` block as first non-frontmatter content | Visible to humans browsing the repo; no parsing required |\n| Allowed tools | `Bash, Skill, Agent` | Minimal for an orchestrator: `Skill` for Step 1A (x-plan-architecture), `Agent` for Steps 1B-1F, `Bash` for argv parsing and the envelope `jq -nc` assembly |\n| Naming | `x-internal-{subject}-{action}` | Mirrors Rule 04 skill taxonomy; `story-build-plan` = subject+action |\n\nAudit rule: Rule 22 (Lifecycle Integrity) validates every skill under\n`internal\u002F**` satisfies all 6 anchors above. Violations fail\n`LifecycleIntegrityAuditTest`.\n\n## Triggers\n\nBare-slash form is intentionally omitted — this skill is never\ninvoked by a human typing `\u002Fx-internal-build-story-plan` in chat.\nAll invocations follow Rule 13 INLINE-SKILL pattern from a calling\norchestrator:\n\n```markdown\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0012 --epic-id 0049 --scope STANDARD\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--story-id \u003Cid>` | M | — | Story identifier (`story-XXXX-YYYY` canonical form) |\n| `--epic-id \u003Cid>` | M | — | 4-digit epic identifier (`XXXX`) — used to resolve `ai\u002Fepics\u002Fepic-XXXX\u002F` |\n| `--scope \u003Ctier>` | O | `STANDARD` | `SIMPLE` \u002F `STANDARD` \u002F `COMPLEX`; `SIMPLE` skips Steps 1E (security) and 1F (compliance) |\n| `--skip-review` | O | `false` | When `true`, signals downstream subagents to omit inline peer-review passes in the generated artifacts (advisory only — does not affect artifact count) |\n\nAll four argument forms (`--key value`, `--key=value`, empty, and\nunknown-flag rejection) follow the Rule-14 rejection matrix: reject\nunknown flags and missing required flags with exit `64` (sysexits\n`EX_USAGE`). The `--story-id` value is normalised to lowercase and\nvalidated against `^story-[0-9]{4}-[0-9]{4}$`; `--epic-id` is\nzero-padded to 4 digits.\n\n## Response Contract\n\nOn success the skill writes a single-line JSON object to stdout:\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `archPlan` | `String` (path) | yes | Path of the architecture plan (`ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-XXXX-YYYY.md`) |\n| `implPlan` | `String` (path) | yes | Path of the implementation plan (`plan-story-XXXX-YYYY.md`) |\n| `testPlan` | `String` (path) | yes | Path of the test plan (`tests-story-XXXX-YYYY.md`) |\n| `taskBreakdown` | `String` (path) | yes | Path of the task breakdown (`tasks-story-XXXX-YYYY.md`) |\n| `securityAssessment` | `String` (path) \\| `null` | no — null when `scope=SIMPLE` | Path of the security assessment (`security-story-XXXX-YYYY.md`) |\n| `complianceAssessment` | `String` (path) \\| `null` | no — null when `scope=SIMPLE` | Path of the compliance assessment (`compliance-story-XXXX-YYYY.md`) |\n| `taskMap` | `String` (path) | yes | Path of the task-implementation map (`task-implementation-map-story-XXXX-YYYY.md`) |\n| `scope` | `String` | yes | Echo of the resolved scope tier — lets the caller verify the gate applied |\n| `skipped` | `Array\u003CString>` | yes | Names of gated steps skipped (e.g., `[\"1E\", \"1F\"]` in SIMPLE; `[]` otherwise) |\n\nThe six artifact basenames (all under `ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002F`):\n\n1. `arch-story-XXXX-YYYY.md` (Step 1A — `x-plan-architecture`)\n2. `plan-story-XXXX-YYYY.md` (Step 1B — Senior Architect subagent)\n3. `tests-story-XXXX-YYYY.md` (Step 1C — `x-plan-tests` subagent)\n4. `tasks-story-XXXX-YYYY.md` (Step 1D — `x-lib-decompose-task` subagent)\n5. `security-story-XXXX-YYYY.md` (Step 1E — `x-model-threats` subagent; omitted in SIMPLE)\n6. `compliance-story-XXXX-YYYY.md` (Step 1F — Compliance Engineer subagent; omitted in SIMPLE)\n\nThe task-implementation-map (`task-implementation-map-story-XXXX-YYYY.md`)\nis produced by the Step 1D subagent as part of the task-decomposition\nartifact (EPIC-0038 v2 contract).\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | All required artifacts produced | — |\n| 1 | ARCH_PLAN_FAILED | `x-plan-architecture` (Step 1A) returned non-zero or failed to produce `arch-story-*.md` | `Architecture plan failed: \u003Cdetail>` |\n| 2 | SUBAGENT_FAILED | Any of Steps 1B-1F (subagent dispatch) failed or did not produce its artifact | `Subagent \u003Cname> failed: \u003Cdetail>` |\n| 64 | EX_USAGE | Unknown flag, missing required flag, or malformed `--story-id` \u002F `--epic-id` | `usage: \u003Cdetail>` |\n\nNo partial-success state: if any required step fails, the skill\nexits non-zero. Optional steps (1E \u002F 1F in SIMPLE) are not errors\nwhen skipped by the gate; they ARE errors when dispatched and\nfailed.\n\n## Workflow\n\n### Step 1 — Argument parsing and path resolution\n\nParse arguments with the Rule-14 single-file `while (($#))` loop;\nreject unknown flags \u002F missing required flags \u002F empty values with\nexit `64`. Normalise `--story-id` to lowercase and verify against\n`^story-[0-9]{4}-[0-9]{4}$`; zero-pad `--epic-id` to 4 digits.\nDerive:\n\n```bash\nepic_dir=\"ai\u002Fepics\u002Fepic-${epic_id}\"\nstory_file=\"${epic_dir}\u002F${story_id}.md\"\nplans_dir=\"${epic_dir}\u002Fplans\"\n```\n\nWhen `${epic_dir}` is not a directory, exit 64 with\n`usage: epic dir not found: ai\u002Fepics\u002Fepic-\u003Cid>`. The skill does NOT\nre-validate the story file existence — that is the caller's\nresponsibility (`x-internal-load-story-context` runs upstream).\n\n### Step 1A — Architecture plan (sequential)\n\nInvoke `x-plan-architecture` via the Rule 13 INLINE-SKILL pattern:\n\n```markdown\nSkill(skill: \"x-plan-architecture\",\n      args: \"--story-id ${story_id} --epic-id ${epic_id}\")\n```\n\nExpected output: `${plans_dir}\u002Farch-story-${story_id}.md`.\n\nOn any failure (non-zero exit from `x-plan-architecture`, or the expected\nfile does not exist after invocation), emit to stderr:\n`Architecture plan failed: \u003Cunderlying message>` and exit `1`.\n\nStep 1A MUST complete before Step 1B-1F dispatch: later steps read\narchitectural context (ports, layers, dependency direction) from\nthe arch plan.\n\n### Steps 1B-1F — Parallel subagent dispatch (one assistant message)\n\nDispatch exactly 5 sibling `Agent(general-purpose, …)` tool calls\nin ONE assistant message — the canonical Rule 13 Pattern 2\n(SUBAGENT-GENERAL) parallel-launch shape. When `--scope=SIMPLE`,\ndispatch only Steps 1B \u002F 1C \u002F 1D (3 siblings) and record `1E` and\n`1F` in `skipped`.\n\nEach subagent prompt follows the structure:\n\n```markdown\nFIRST ACTION: \u003Cno-op — TaskCreate\u002FTaskUpdate unavailable in this harness>.\nYou are a \u003Crole>. Read context files:\n- ai\u002Fepics\u002Fepic-${epic_id}\u002F${story_id}.md (story)\n- ai\u002Fepics\u002Fepic-${epic_id}\u002Fplans\u002Farch-story-${story_id}.md (arch plan)\n- \u003Crole-specific templates under .claude\u002Ftemplates\u002F>.\nProduce \u003Cartifact> at ${plans_dir}\u002F\u003Cbasename>.\nLAST ACTION: return the absolute path of the artifact you produced.\n```\n\nPer-step role and artifact mapping:\n\n| Step | Role | Skill delegate (if any) | Artifact basename |\n| :--- | :--- | :--- | :--- |\n| 1B | Senior Architect | — (inline prompt) | `plan-story-${story_id}.md` |\n| 1C | QA Engineer | `x-plan-tests` via `Skill(…)` inside subagent | `tests-story-${story_id}.md` |\n| 1D | Task Decomposer | `x-lib-decompose-task` via `Skill(…)` inside subagent | `tasks-story-${story_id}.md` + `task-implementation-map-story-${story_id}.md` |\n| 1E | Security Engineer | `x-model-threats` via `Skill(…)` inside subagent | `security-story-${story_id}.md` |\n| 1F | Compliance Engineer | — (inline prompt) | `compliance-story-${story_id}.md` |\n\n#### Origin Marker Emission (EPIC-0059 — mandatory for all 1B-1F artifacts)\n\nEvery subagent producing a planning artifact MUST prepend the YAML frontmatter block\nbefore writing the file content:\n\n```yaml\n---\ngenerated-by: x-internal-build-story-plan@$(git rev-parse HEAD 2>\u002Fdev\u002Fnull || echo \"unknown\")\ngenerated-at: $(date -u +%Y-%m-%dT%H:%M:%SZ)\nstory-id: ${story_id}\n---\n```\n\nInclude the following instruction in each subagent prompt:\n\n> **MANDATORY — FIRST STEP of writing the artifact:** Prepend the following YAML frontmatter\n> block at the very top of the output file before any Markdown content:\n> ```yaml\n> ---\n> generated-by: x-internal-build-story-plan@\u003Crun: git rev-parse HEAD>\n> generated-at: \u003Crun: date -u +%Y-%m-%dT%H:%M:%SZ>\n> story-id: ${story_id}\n> ---\n> ```\n> This is required by `audit-execution-integrity.sh` Phase-1 validation (EPIC-0059, Rule 24).\n> Artifacts without this block fail the CI audit with `EIE_EVIDENCE_MISSING`.\n\nThe `--skip-review` flag propagates into the subagent prompt when\nset: a single sentence instructing the subagent to omit the inline\npeer-review pass customarily appended to its artifact.\n\n### Step 2 — Collect results and assemble envelope\n\nAfter all subagents return, validate that every expected artifact\nexists on disk:\n\n```bash\nfor basename in arch plan tests tasks; do\n  path=\"${plans_dir}\u002F${basename}-story-${story_id}.md\"\n  [[ -f \"${path}\" ]] || { err \"Subagent ${basename} did not produce ${path}\"; exit 2; }\ndone\n```\n\nRepeat for `security-` \u002F `compliance-` ONLY when `scope != SIMPLE`.\n\nAssemble the response envelope via `jq -nc` so the shape is\nauthoritative:\n\n```bash\njq -nc \\\n  --arg archPlan \"${plans_dir}\u002Farch-story-${story_id}.md\" \\\n  --arg implPlan \"${plans_dir}\u002Fplan-story-${story_id}.md\" \\\n  --arg testPlan \"${plans_dir}\u002Ftests-story-${story_id}.md\" \\\n  --arg taskBreakdown \"${plans_dir}\u002Ftasks-story-${story_id}.md\" \\\n  --arg taskMap \"${plans_dir}\u002Ftask-implementation-map-story-${story_id}.md\" \\\n  --arg scope \"${scope}\" \\\n  --argjson skipped \"${skipped_json}\" \\\n  --arg securityAssessment \"${security_path_or_null}\" \\\n  --arg complianceAssessment \"${compliance_path_or_null}\" \\\n  '{archPlan:$archPlan, implPlan:$implPlan, testPlan:$testPlan,\n    taskBreakdown:$taskBreakdown, taskMap:$taskMap,\n    securityAssessment: (if $securityAssessment == \"\" then null\n                         else $securityAssessment end),\n    complianceAssessment: (if $complianceAssessment == \"\" then null\n                           else $complianceAssessment end),\n    scope:$scope, skipped:$skipped}'\n```\n\nEmit on stdout as a single line terminated by `\\n`. Exit 0.\n\n## Examples\n\n### Example 1 — Happy path: STANDARD scope (6 artifacts)\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0012 --epic-id 0049 --scope STANDARD\")\n```\n\nOutput:\n```json\n{\"archPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Farch-story-XXXX-YYYY.md\",\"implPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fplan-story-XXXX-YYYY.md\",\"testPlan\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftests-story-XXXX-YYYY.md\",\"taskBreakdown\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftasks-story-XXXX-YYYY.md\",\"taskMap\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Ftask-implementation-map-story-XXXX-YYYY.md\",\"securityAssessment\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fsecurity-story-XXXX-YYYY.md\",\"complianceAssessment\":\"ai\u002Fepics\u002Fepic-XXXX\u002Fplans\u002Fcompliance-story-XXXX-YYYY.md\",\"scope\":\"STANDARD\",\"skipped\":[]}\n```\nExit: 0.\n\n### Example 2 — SIMPLE scope skips 1E \u002F 1F\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0001 --epic-id 0049 --scope SIMPLE\")\n```\n\nOutput (truncated):\n```json\n{\"archPlan\":\"…\",\"implPlan\":\"…\",\"testPlan\":\"…\",\"taskBreakdown\":\"…\",\"taskMap\":\"…\",\"securityAssessment\":null,\"complianceAssessment\":null,\"scope\":\"SIMPLE\",\"skipped\":[\"1E\",\"1F\"]}\n```\nExit: 0.\n\n### Example 3 — COMPLEX scope (same artifact set as STANDARD)\n\nCOMPLEX currently produces the same 6 artifacts as STANDARD; the\ntier is echoed in `scope` for downstream decisions (e.g., post-Phase-2\nstakeholder review gate in `x-implement-story`) but does not change\nthe planning surface.\n\n### Example 4 — Architecture plan fails\n\n```bash\nSkill(skill: \"x-internal-build-story-plan\",\n      args: \"--story-id story-0049-0099 --epic-id 0049 --scope STANDARD\")\n```\n\nStderr:\n```\nArchitecture plan failed: x-plan-architecture exit 3 (story not found)\n```\nExit: 1.\n\n### Example 5 — Subagent failure\n\nStep 1B (Senior Architect) fails to produce `plan-story-…md`.\n\nStderr:\n```\nSubagent 1B failed: plan-story-0049-0012.md not produced\n```\nExit: 2.\n\n## Outputs\n\n| Artifact | Path | Description |\n| :--- | :--- | :--- |\n| Response envelope | stdout | Single-line JSON matching the Response Contract |\n| Error diagnostic | stderr | Single line, non-empty only on exit ≠ 0 |\n| Planning artifacts | `ai\u002Fepics\u002Fepic-${epic_id}\u002Fplans\u002F*.md` | Written by `x-plan-architecture` + Step 1B-1F subagents |\n\nThis skill DOES create files — unlike `x-internal-load-story-context`,\nwhich is strictly read-only. The `allowed-tools` frontmatter\nincludes `Skill` and `Agent` to reflect this: the writes happen\ninside the dispatched subagents \u002F the invoked `x-plan-architecture`, not\ndirectly from this skill's body.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| Missing required flag | Print `usage:` banner to stderr; exit 64 |\n| Unknown flag | Print `usage: unknown flag …` to stderr; exit 64 |\n| Malformed `--story-id` | `usage: --story-id must match story-NNNN-NNNN`; exit 64 |\n| Missing epic dir | `usage: epic dir not found: ai\u002Fepics\u002Fepic-\u003Cid>`; exit 64 |\n| `x-plan-architecture` non-zero | `Architecture plan failed: \u003Cdetail>`; exit 1 |\n| Expected `arch-story-*.md` absent after Step 1A | `Architecture plan failed: arch-story-*.md not produced`; exit 1 |\n| Any subagent returns error | `Subagent \u003Cstep> failed: \u003Cdetail>`; exit 2 |\n| Any subagent returns success but required artifact absent | `Subagent \u003Cstep> failed: \u003Cbasename> not produced`; exit 2 |\n| `jq` absent on PATH | Exit 127 with `jq is required`; abort before dispatch |\n| `--scope` value unrecognised | `usage: --scope must be SIMPLE \u002F STANDARD \u002F COMPLEX`; exit 64 |\n\nThe skill is fail-fast: the first error aborts the run. Partial\nartifacts produced by successful subagents remain on disk (the\norchestrator may choose to re-invoke with the same arguments —\n`x-plan-architecture` and each subagent are idempotent with respect to their\nartifact path).\n\n## Performance Contract\n\nTarget: ~3-5 minutes for STANDARD scope on a typical story. The\ndominant cost is the wall-clock of the slowest subagent (Step 1B-1F\nrun in parallel, so the total ≈ max(individual)). Step 1A is\nstrictly sequential and typically ≤ 60 seconds.\n\nSIMPLE-scope runs save ~0-30 seconds by skipping 1E and 1F (those\nsubagents are typically I\u002FO-bound on template reads, not model\ninference).\n\n## Testing\n\nAcceptance scenarios (mirroring Section 7 of story-0049-0012):\n\n1. **Happy path — STANDARD.** All 6 artifacts produced; envelope\n   echoes `scope=STANDARD`, `skipped=[]`.\n2. **Degenerate — SIMPLE.** 4 artifacts produced; envelope reports\n   `securityAssessment=null`, `complianceAssessment=null`,\n   `skipped=[\"1E\",\"1F\"]`.\n3. **Boundary — COMPLEX.** Same 6 artifacts as STANDARD; envelope\n   echoes `scope=COMPLEX`.\n4. **Error — `x-plan-architecture` fails.** Exit 1; stderr starts with\n   `Architecture plan failed:`.\n5. **Error — subagent failure.** Exit 2; stderr identifies which\n   step (`1B` \u002F `1C` \u002F `1D` \u002F `1E` \u002F `1F`).\n\nCoverage requirement: ≥ 95% line \u002F ≥ 90% branch across the\ninvoking Bash codepaths and the dispatch \u002F envelope-assembly\nlogic. Goldens (if added) lock the SKILL.md rendering under\n`src\u002Ftest\u002Fresources\u002Fgolden\u002Finternal\u002Fplan\u002Fx-internal-build-story-plan\u002F`\nper the sibling pattern.\n\n## Generator Filter Contract\n\nThe `ia-dev-env` generator MUST exclude skills with\n`visibility: internal` from:\n\n1. The `.claude\u002FREADME.md` skill-inventory table.\n2. The `\u002Fhelp` menu listing surfaced by Claude Code.\n3. User-facing autocomplete in the chat input.\n\nInternal skills are still copied into `.claude\u002Fskills\u002F` (flat\nlayout) so `Skill(skill: \"x-internal-…\")` invocations from other\nskills resolve correctly. The invariant: **user cannot see them;\norchestrators can invoke them.**\n\n## Telemetry\n\nInternal skills DO NOT emit `phase.start` \u002F `phase.end` markers —\ntelemetry is produced by the invoking orchestrator (the `phase`\nwrapping the orchestrator's own step is the correct aggregation\nboundary). Passive hooks still capture `tool.call` for each\nunderlying `Skill` \u002F `Agent` \u002F `Bash` invocation made from inside\nthe skill body.\n\nSubagent `subagent.start` \u002F `subagent.end` markers around Steps\n1B-1F are emitted by the caller (`x-implement-story` Phase 1)\nbecause that orchestrator owns the enclosing phase. Re-emitting\nfrom inside this skill would double-count the wave.\n\nReference: Rule 13 (Skill Invocation Protocol), Rule 22 (Lifecycle\nIntegrity Audit), ADR-0010 (Interactive Gates Convention — exempts\ninternal skills from the 3-option menu contract).\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-implement-story` | caller (primary) | Phase 1 carve-out: ~250 inline lines collapse to one `Skill(skill: \"x-internal-build-story-plan\", …)` invocation in story-0049-0019 |\n| `x-internal-load-story-context` | upstream peer | Caller runs this sibling first to decide whether Phase 1 needs regen (`planningMode != PRE_PLANNED`); only then invokes `x-internal-build-story-plan` |\n| `x-plan-architecture` | delegate (Step 1A) | Sequential precondition; produces `arch-story-*.md` consumed by Steps 1B-1F |\n| `x-plan-tests` | delegate (Step 1C) | Invoked from inside the QA-Engineer subagent |\n| `x-lib-decompose-task` | delegate (Step 1D) | Invoked from inside the Task-Decomposer subagent; produces both the tasks file and the task-implementation-map |\n| `x-model-threats` | delegate (Step 1E) | Invoked from inside the Security-Engineer subagent; skipped in SIMPLE |\n| `x-evaluate-parallelism` | consumer (downstream) | Phase 1.5 of the caller reads the `task-implementation-map` produced here to compute the collision matrix (EPIC-0041) |\n| `x-internal-update-status` | peer | Separate concern (mutates state); never invoked from this skill |\n\nDownstream stories that depend on this carve-out:\nstory-0049-0019 (orchestrator consumes the envelope and deletes the\ninline Phase 1 block).\n\nFull workflow detail (subagent prompt catalogue per step, scope-gate\ndecision table, envelope-assembly edge cases, and the interaction\nwith `x-internal-load-story-context`'s upstream freshness result)\nlives in [`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md)\nper ADR-0011.\n",{"name":5,"category":24,"visibility":25,"description":7,"allowed-tools":26,"argument-hint":27,"context-budget":28,"user-invocable":20,"requires-capabilities":29},"internal-plan","internal","Bash, Skill, Agent","--story-id \u003Cstory-XXXX-YYYY> --epic-id \u003CXXXX> [--scope \u003CSIMPLE|STANDARD|COMPLEX>] [--skip-review]","medium",[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-internal-build-story-plan",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":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-build-story-plan",{"tool":45,"command":46},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-build-story-plan",{"tool":48,"command":49},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-build-story-plan","安装技能，技能地址：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-internal-build-story-plan\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Ffull-protocol.md","REFERENCE","参考文档",11640,"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-internal-build-story-plan\u002Freferences\u002Ffull-protocol.md",[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"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":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"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":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"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":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"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":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"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":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"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",[],[]]