[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M752P52KZP4S2W24525TKVCG":3,"skill-same:01M752P52KZP4S2W24525TKVCG":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},"01M752P52KZP4S2W24525TKVCG","x-internal-verify-epic-integrity",null,"Executes the epic-level verification gate end-to-end (Phase 1.7 \u002F Phase 4 carve-out of x-implement-epic) on the epic\u002FXXXX branch HEAD: checks out the branch, runs mvn clean test + jacoco:report, parses filtered coverage against epic-level thresholds (default line >=95, branch >=90), runs a declarative DoD checklist (presence of tests, tasks DONE, CHANGELOG entry, ADR references), and emits a single-line JSON envelope {passed, failures, coverageDelta, dodChecklist}. Seventh skill in the x-internal-* convention and the fourth under internal\u002Fplan\u002F (after x-internal-load-story-context, x-internal-build-story-plan, and x-internal-verify-story). Isolates ~180 inline lines of integrity-gate logic from x-implement-epic.","review-bench\u002Federcnj_ia-dev-environment","review-bench","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F286778065?v=4","01M7517F9NTEPDZDAXJBR30FWT","ReviewBench","01M7517FAC9F4P7TGWCNJ8VYVW",0,"MIT","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-epic-integrity\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-internal-verify-epic-integrity\ndescription: \"Executes the epic-level verification gate end-to-end (Phase 1.7 \u002F Phase 4 carve-out of x-implement-epic) on the epic\u002FXXXX branch HEAD: checks out the branch, runs mvn clean test + jacoco:report, parses filtered coverage against epic-level thresholds (default line >=95, branch >=90), runs a declarative DoD checklist (presence of tests, tasks DONE, CHANGELOG entry, ADR references), and emits a single-line JSON envelope {passed, failures, coverageDelta, dodChecklist}. Seventh skill in the x-internal-* convention and the fourth under internal\u002Fplan\u002F (after x-internal-load-story-context, x-internal-build-story-plan, and x-internal-verify-story). Isolates ~180 inline lines of integrity-gate logic from x-implement-epic.\"\nvisibility: internal\nuser-invocable: false\nallowed-tools: Bash\nargument-hint: \"--epic-id \u003CXXXX> [--branch \u003Cname>] [--coverage-threshold-line \u003CN>] [--coverage-threshold-branch \u003CN>]\"\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-epic` (Phase 1.7 \u002F Phase 4 carve-out).\n> Sétima 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, x-internal-load-story-context\n> 0049-0011, x-internal-build-story-plan 0049-0012, e\n> x-internal-verify-story 0049-0014). Quarta skill na subdir\n> `internal\u002Fplan\u002F` — o subdir `plan\u002F` agrupa skills que orquestram\n> planejamento e verificação (load → build → verify → integrity-gate).\n> Difere de `internal\u002Fops\u002F`, cujas sibling skills mutam estado\n> (`execution-state.json`, reports).\n\n# Skill: x-internal-verify-epic-integrity\n\n## Purpose\n\nCarve out the epic-level integrity gate of `x-implement-epic` (the\n~180 inline lines documented in `references\u002Fintegrity-gate.md` of\n`x-implement-epic`) into a single, single-responsibility skill with a\nstable JSON envelope. The orchestrator shrinks to a read-the-envelope\nconsumer that drives its phase-advance \u002F regression-diagnosis branching\noff the four response fields.\n\nResponsibilities (single):\n\n1. Verify the target branch exists (local or remote); fail fast with\n   `BRANCH_NOT_FOUND` when absent.\n2. Check out the branch (`git checkout \u003Cname>`) with a detached-HEAD\n   guard that restores the caller's original branch on any downstream\n   failure.\n3. Run `mvn clean test jacoco:report` (Maven default) and parse the\n   exit code. Non-Maven stacks use their build-tool-native equivalent\n   (listed in the full protocol).\n4. Parse the coverage CSV (Maven default:\n   `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`), aggregate the line and branch\n   totals across every module in scope, and compare against the\n   line \u002F branch thresholds.\n5. Run the declarative DoD checklist — a static list of boolean\n   predicates (tests present per touched file, tasks DONE in every\n   story, CHANGELOG entry present, ADR references resolvable). Each\n   item contributes one `{item, passed}` tuple to the envelope.\n6. Emit a single-line JSON envelope on stdout:\n   `{passed, failures, coverageDelta, dodChecklist}`.\n\nNon-responsibilities (explicit):\n\n- The skill does NOT dispatch specialist reviews or the Tech Lead\n  review — those stay in `x-implement-epic` Phase 4.4 \u002F 4.6.\n- The skill does NOT mutate `execution-state.json`, `**Status:**`\n  headers, or IMPLEMENTATION-MAP — those belong to\n  `x-internal-update-status`.\n- The skill does NOT write reports; `x-internal-write-report` renders\n  the phase-completion report off the envelope this skill emits.\n- The skill does NOT perform regression diagnosis (failed-test → story\n  correlation) — that stays in the orchestrator, which consumes\n  `failures[]` and branches accordingly.\n- The skill does NOT advance to the next phase or version-bump — those\n  are orchestrator concerns downstream of `passed=true`.\n\n## Convention Anchors (x-internal-*)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-verify-epic-integrity\u002F` | `internal\u002F` prefix scopes visibility; `plan\u002F` co-locates with sibling verification carve-outs (`x-internal-verify-story`, `x-internal-build-epic-plan`) |\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` only | The skill shells out to git + Maven, parses CSV with `awk`, emits JSON with `jq -n`; no `Skill` \u002F `Agent` needed — the gate is a leaf computation |\n| Naming | `x-internal-{subject}-{action}` | `epic-integrity-gate` — subject (epic) + action (integrity-gate) per Rule 04 taxonomy |\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-verify-epic-integrity` in chat.\nAll invocations follow the Rule 13 INLINE-SKILL pattern from a\ncalling orchestrator:\n\n```markdown\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049 --branch epic\u002F0049 --coverage-threshold-line 90 --coverage-threshold-branch 85\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--epic-id \u003Cid>` | M | — | 4-digit epic identifier (`XXXX`) — used to resolve default branch name and `ai\u002Fepics\u002Fepic-XXXX\u002F` |\n| `--branch \u003Cname>` | O | `epic\u002F\u003Cid>` | Branch to validate; defaults to `epic\u002F\u003Cepic-id>` (the phase-integration branch) |\n| `--coverage-threshold-line \u003CN>` | O | `95` | Minimum line coverage percentage (integer, 0-100) |\n| `--coverage-threshold-branch \u003CN>` | O | `90` | Minimum branch coverage percentage (integer, 0-100) |\n\nAll four argument forms (`--key value`, `--key=value`, empty, and\nunknown-flag rejection) are supported; unknown flags and missing\nrequired flags exit with `64` (sysexits `EX_USAGE`). The `--epic-id`\nvalue is zero-padded to 4 digits and validated against `^[0-9]{4}$`;\n`--branch` is trimmed and validated against `refs\u002Fheads\u002F` naming rules\n(no spaces, no `..`, no leading `-`). Thresholds outside `[0, 100]`\nexit `64`.\n\n## Response Contract\n\nOn success (any exit code ≤ 4) the skill writes a single-line JSON\nobject to stdout. The envelope is always well-formed JSON; consumers\nMUST read `passed` as the authoritative gate.\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `passed` | `Boolean` | yes | Global gate: `true` iff all sub-gates pass (tests green, coverage ≥ thresholds, every DoD item `passed=true`) |\n| `failures` | `Array\u003CString>` | yes | One human-readable line per failure (empty array on happy path). Categories: `branch:`, `test:`, `coverage:`, `dod:` |\n| `coverageDelta` | `Object` | yes | `{line: Number, branch: Number, lineThreshold: Number, branchThreshold: Number, lineDelta: Number, branchDelta: Number}` — `*Threshold` echo inputs; `*Delta` is `actual − threshold` (negative when below) |\n| `dodChecklist` | `Array\u003C{item:String, passed:Boolean}>` | yes | One entry per DoD predicate; `passed=false` always corresponds to a `dod:` failure in `failures` |\n\n### Example envelope (happy path)\n\n```json\n{\"passed\":true,\"failures\":[],\"coverageDelta\":{\"line\":96.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":1.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":true},{\"item\":\"tests-present\",\"passed\":true}]}\n```\n\n### Example envelope (coverage below + DoD gap)\n\n```json\n{\"passed\":false,\"failures\":[\"coverage: line 88.0 \u003C 95\",\"dod: changelog-entry missing\"],\"coverageDelta\":{\"line\":88.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":-7.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":false},{\"item\":\"tests-present\",\"passed\":true}]}\n```\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | Envelope emitted with `passed=true` | — |\n| 1 | BRANCH_NOT_FOUND | Target branch does not exist locally or on `origin` | `Branch \u003Cname> not found` |\n| 2 | MVN_TEST_FAILED | Build tool returned non-zero before coverage could be parsed | `Test suite failed` |\n| 3 | COVERAGE_BELOW_THRESHOLD | Envelope emitted with `passed=false` due to coverage | `Coverage below threshold: line=\u003CL>, branch=\u003CB>` |\n| 4 | JACOCO_REPORT_MISSING | Coverage CSV not generated (build completed but no `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`) | `JaCoCo report not found at \u003Cpath>` |\n| 64 | EX_USAGE | Unknown or malformed flag | `usage: --epic-id \u003Cid> [--branch \u003Cname>] [--coverage-threshold-line N] [--coverage-threshold-branch N]` |\n\nWhen `passed=false` is driven purely by DoD gaps (not coverage, not\ntest-failure), the exit code is `0` and the caller MUST branch off\n`passed`. The non-zero exit is reserved for infrastructure-level\nfailures (missing branch, build failure, missing report). This keeps\nthe envelope the single source of truth for the orchestrator.\n\n## Workflow\n\n### Step 1 — Argument parsing and path resolution\n\nParse the four flags; reject unknown and missing required flags with\nexit `64`. Resolve canonical paths:\n\n```bash\nepic_id=\"$(printf '%04d' \"${raw_epic_id}\")\"\nbranch=\"${branch:-epic\u002F${epic_id}}\"\nepic_dir=\"ai\u002Fepics\u002Fepic-${epic_id}\"\njacoco_csv=\"target\u002Fsite\u002Fjacoco\u002Fjacoco.csv\"\n```\n\n### Step 2 — Branch existence + checkout\n\n```bash\nif ! git rev-parse --verify \"${branch}\" >\u002Fdev\u002Fnull 2>&1 \\\n   && ! git rev-parse --verify \"origin\u002F${branch}\" >\u002Fdev\u002Fnull 2>&1; then\n    echo \"Branch ${branch} not found\" >&2\n    exit 1\nfi\n\noriginal_branch=\"$(git symbolic-ref --short HEAD 2>\u002Fdev\u002Fnull || echo DETACHED)\"\ngit checkout \"${branch}\" >\u002Fdev\u002Fnull 2>&1 || {\n    echo \"Branch ${branch} checkout failed\" >&2\n    exit 1\n}\ntrap 'git checkout \"${original_branch}\" >\u002Fdev\u002Fnull 2>&1 || true' EXIT\n```\n\nThe `trap` ensures the caller's working tree is restored even if a\nlater step aborts.\n\n### Step 3 — Run mvn clean test + jacoco:report\n\n```bash\nmvn clean test jacoco:report -q\nmvn_exit=$?\nif [ \"${mvn_exit}\" -ne 0 ]; then\n    echo \"Test suite failed (exit=${mvn_exit})\" >&2\n    exit 2\nfi\n```\n\nNon-Maven stacks use their own equivalents (listed in the full\nprotocol); the skill auto-detects the build tool by probing `pom.xml`,\n`build.gradle(.kts)`, `package.json`, `Cargo.toml`, `go.mod`,\n`pyproject.toml`. When no build tool is detected, the skill logs\n`test: no build tool detected; skipping` to stderr, emits `passed=true`\nfor the test gate (degraded but non-blocking), and continues to\nStep 4 best-effort.\n\n### Step 4 — Parse filtered coverage (JaCoCo CSV)\n\nRead `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`. The JaCoCo CSV schema is\n(header, then one row per class):\n\n```\nGROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,...\n```\n\nSum `LINE_COVERED` and `LINE_MISSED` across all rows; compute:\n\n```\nline_pct = round(line_covered \u002F (line_covered + line_missed) * 100, 1)\nbranch_pct = round(branch_covered \u002F (branch_covered + branch_missed) * 100, 1)\n```\n\nCompare against `--coverage-threshold-line` and\n`--coverage-threshold-branch` (inclusive: `>=` passes). When the CSV\nis absent (build completed but report not generated), exit `4`\n(`JACOCO_REPORT_MISSING`) with no envelope.\n\nWhen coverage is below threshold, append\n`coverage: line \u003Cactual> \u003C \u003Cthreshold>` and\u002For\n`coverage: branch \u003Cactual> \u003C \u003Cthreshold>` to `failures`, compute\n`lineDelta` \u002F `branchDelta` as `actual - threshold` (negative when\nbelow), set `passed=false`, exit `3`.\n\n### Step 5 — DoD checklist (declarative, extensible)\n\nThe DoD checklist is a declarative list of boolean predicates\nembedded in the skill. Each predicate is deterministic and read-only.\nDefault catalogue (v1):\n\n| Item | Predicate | Failure Message |\n| :--- | :--- | :--- |\n| `all-tasks-done` | Every `- [ ]` checkbox in `ai\u002Fepics\u002Fepic-\u003Cid>\u002Fstory-*.md` Section 8 is either `- [x]` OR the story `**Status:**` is `Concluida` | `dod: \u003CN> task(s) not marked DONE` |\n| `changelog-entry` | `CHANGELOG.md` contains at least one `### Added` \u002F `### Fixed` \u002F `### Changed` entry under `## [Unreleased]` OR under a version header newer than the previous release tag | `dod: changelog-entry missing` |\n| `tests-present` | Every `src\u002Fmain\u002F**\u002F*.{java,kt,ts,py,go,rs}` file touched on this branch (diff vs `main`) has at least one corresponding test file under `src\u002Ftest\u002F` matching the class-name convention | `dod: \u003CN> file(s) without corresponding test` |\n| `adr-references-resolvable` | Every `adr\u002FADR-NNNN-*.md` referenced in story markdowns actually exists | `dod: \u003CN> ADR reference(s) unresolved` |\n| `story-status-concluida` | Every `ai\u002Fepics\u002Fepic-\u003Cid>\u002Fstory-*.md` has `**Status:** Concluida` (or `Concluída`, accent-agnostic) | `dod: \u003CN> story(ies) not Concluida` |\n\nExtension contract: additional predicates are appended to the\ncatalogue in the full-protocol reference; the envelope schema is\nstable (each predicate maps to exactly one `dodChecklist` entry).\nPredicates MUST be pure: no network I\u002FO, no git write, no mutation.\n\n### Step 6 — Assemble and emit envelope\n\nCompose the JSON envelope via `jq -nc`. The exit code is the lowest\napplicable (0 success; 1 branch missing; 2 test failure; 3 coverage\nbelow; 4 missing report).\n\n```bash\njq -nc \\\n  --argjson passed \"${passed_bool}\" \\\n  --argjson failures \"${failures_json}\" \\\n  --argjson coverageDelta \"${coverage_json}\" \\\n  --argjson dodChecklist \"${dod_json}\" \\\n  '{passed:$passed, failures:$failures,\n    coverageDelta:$coverageDelta, dodChecklist:$dodChecklist}'\n```\n\n## Examples\n\n### Example 1 — Happy path: gate passes on clean epic branch\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope:\n\n```json\n{\"passed\":true,\"failures\":[],\"coverageDelta\":{\"line\":96.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":1.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":true},{\"item\":\"tests-present\",\"passed\":true},{\"item\":\"adr-references-resolvable\",\"passed\":true},{\"item\":\"story-status-concluida\",\"passed\":true}]}\n```\n\nExit: 0.\n\n### Example 2 — Coverage below threshold\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope includes `\"passed\":false` and\n`\"coverage: line 88.0 \u003C 95\"` in `failures`; `coverageDelta.lineDelta=-7.0`.\nExit: 3.\n\n### Example 3 — Test failure\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nStderr: `Test suite failed (exit=\u003CN>)`. Exit: 2. No envelope\nemitted.\n\n### Example 4 — Branch not found\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 9999\")\n```\n\nStderr: `Branch epic\u002F9999 not found`. Exit: 1. No envelope emitted.\n\n### Example 5 — Boundary: coverage exactly on threshold\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope `\"coverageDelta\":{\"line\":95.0,\"branch\":90.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":0.0,\"branchDelta\":0.0,...}` → `passed=true` (inclusive).\nExit: 0.\n\n### Example 6 — Custom thresholds (per-epic override)\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049 --coverage-threshold-line 80 --coverage-threshold-branch 75\")\n```\n\nEnvelope reports `lineThreshold=80, branchThreshold=75`. Use case:\nmeta-epics touching only documentation\u002Fgenerator resources override\nthe project-wide defaults.\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\nNo file is created or modified. The skill is **strictly read-only**\nagainst the project source tree (enforced by `allowed-tools: Bash`\nfrontmatter — no `Write` \u002F `Edit` available). It DOES execute Maven,\nwhich mutates `target\u002F` — that is the build tool's responsibility,\nnot a state mutation in the sense of `x-internal-ops\u002F*`.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| Missing required flag (`--epic-id`) | Print `usage:` banner to stderr; exit 64 |\n| Unknown flag | Print `unknown flag \u003Cname>; usage:`; exit 64 |\n| Threshold outside `[0, 100]` | Print `threshold must be in [0,100]`; exit 64 |\n| `jq` absent on PATH | Print `dependency missing: jq`; exit 127 |\n| `pom.xml` \u002F build config absent | Print `no build tool detected`; emit `test: no build tool detected` in failures; continue Steps 4–5 best-effort |\n| Coverage CSV unreadable | Emit `coverage: report unreadable (\u003Creason>)` in failures; `passed=false`; exit 4 |\n| Test process segfaults \u002F OOM | Exit 2 with `Test suite failed (\u003Csignal>)`; no envelope |\n| Checkout fails (dirty working tree) | Exit 1 with `Branch \u003Cname> checkout failed: \u003Cgit stderr>`; caller expected to stash first |\n| Story file missing during DoD check | Append `dod: story file \u003Cid> missing` to failures; `passed=false`; exit 0 |\n| CHANGELOG.md absent | Append `dod: changelog-entry missing (CHANGELOG.md absent)` to failures; `passed=false`; exit 0 |\n| `mvn` absent on PATH (Maven project) | Print `dependency missing: mvn`; exit 127 |\n\n## Performance Contract\n\nTarget: \u003C 5 minutes for a medium epic (~10 stories, ~50 classes in\naggregate) on a laptop-class machine. Breakdown budget:\n\n| Step | Target |\n| :--- | :--- |\n| Argument parse + branch validation | \u003C 200 ms |\n| Checkout | \u003C 500 ms |\n| `mvn clean test jacoco:report` | \u003C 4 min |\n| Coverage CSV parse | \u003C 300 ms |\n| DoD checklist evaluation | \u003C 10 s |\n| Envelope assembly | \u003C 50 ms |\n\nLarge epics (20+ stories, 200+ classes) may exceed the total; the\nfull-protocol reference documents an opt-in `--skip-clean` knob that\nreuses prior `target\u002F` when safe.\n\n## Testing\n\nThe story ships the following acceptance test scenarios, mirroring\nSection 7 of story-0049-0010:\n\n1. **Degenerate — gate passes on a clean branch.** All DoD items\n   pass, coverage line=96 \u002F branch=91 → `passed=true`, exit 0.\n2. **Failure — coverage below threshold.** Line=88 with threshold=95 →\n   `passed=false`, exit 3, `failures` contains\n   `\"coverage: line 88.0 \u003C 95\"`.\n3. **Failure — test suite failure.** `mvn test` exits non-zero →\n   exit 2, no envelope.\n4. **Error — branch not found.** `--epic-id 9999` with no such\n   branch → exit 1, no envelope.\n5. **Boundary — coverage exactly on threshold.** Line=95, Branch=90 →\n   `passed=true`, exit 0 (inclusive).\n\nGoldens live under the smoke test resource path (see `Files:` of\nTASK-0049-0010-005). Coverage requirement: ≥ 95% line \u002F ≥ 90% branch\nacross the invoking Bash codepaths.\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 layout)\nso `Skill(skill: \"x-internal-...\")` invocations from other skills\nresolve 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 — Phase 1.7 \u002F Phase 4 in\n`x-implement-epic` — is the correct aggregation boundary). Passive\nhooks still capture `tool.call` for the underlying `Bash` invocations\n(git, Maven, jq).\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), and ADR-0011\n(Slim-SKILL \u002F Fat-Reference Split).\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-implement-epic` | caller (primary) | Phase 1.7 \u002F Phase 4 carve-out: the skill's stdout envelope replaces the ~180 inline lines that currently live in `references\u002Fintegrity-gate.md` and the Phase 4 orchestrator body — Phase 4 shrinks to ~80 lines (story-level metric per story-0049-0018) |\n| `x-internal-verify-story` | peer | Sibling `internal\u002Fplan\u002F` skill; runs the equivalent gate at story scope (coverage filtered to story's files, cross-file consistency, AC mapping). `x-internal-verify-epic-integrity` runs at the epic\u002Fphase scope — aggregate coverage, aggregate DoD |\n| `x-internal-build-epic-plan` | peer | Sibling `internal\u002Fplan\u002F` skill; computes the epic DAG + phase ordering upstream (Phase 0). This skill consumes the `epic\u002F\u003Cid>` branch AFTER all phase stories are merged |\n| `x-internal-write-report` | downstream | Consumes this skill's envelope to render the phase-completion report `phase-report-epic-XXXX.md` via `_TEMPLATE-PHASE-COMPLETION-REPORT.md` |\n| `x-internal-update-status` | downstream | Consumes `passed` to transition phase status and trigger the semantic version bump (when `passed=true`) per RULE-013 |\n| `x-evaluate-parallelism` | indirect | Runs BEFORE this skill at Phase 1.5 to validate parallelism constraints; its output does not feed the integrity gate |\n\nDownstream stories that depend on this carve-out:\n- **story-0049-0018** (refactor `x-implement-epic`) consumes the\n  envelope and deletes the inline Phase 4 block.\n\nFull workflow detail (argument-parser rejection matrix, JaCoCo CSV\nschema with worked parsing example, build-tool-native equivalents for\nGradle \u002F npm \u002F cargo \u002F go \u002F pytest, DoD-predicate catalogue with\nextension examples, `--skip-clean` optimisation semantics, and the\ncoverage-aggregation formula for multi-module Maven projects) lives in\n[`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md) per\nADR-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-epic` (Phase 1.7 \u002F Phase 4 carve-out).\n> Sétima 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, x-internal-load-story-context\n> 0049-0011, x-internal-build-story-plan 0049-0012, e\n> x-internal-verify-story 0049-0014). Quarta skill na subdir\n> `internal\u002Fplan\u002F` — o subdir `plan\u002F` agrupa skills que orquestram\n> planejamento e verificação (load → build → verify → integrity-gate).\n> Difere de `internal\u002Fops\u002F`, cujas sibling skills mutam estado\n> (`execution-state.json`, reports).\n\n# Skill: x-internal-verify-epic-integrity\n\n## Purpose\n\nCarve out the epic-level integrity gate of `x-implement-epic` (the\n~180 inline lines documented in `references\u002Fintegrity-gate.md` of\n`x-implement-epic`) into a single, single-responsibility skill with a\nstable JSON envelope. The orchestrator shrinks to a read-the-envelope\nconsumer that drives its phase-advance \u002F regression-diagnosis branching\noff the four response fields.\n\nResponsibilities (single):\n\n1. Verify the target branch exists (local or remote); fail fast with\n   `BRANCH_NOT_FOUND` when absent.\n2. Check out the branch (`git checkout \u003Cname>`) with a detached-HEAD\n   guard that restores the caller's original branch on any downstream\n   failure.\n3. Run `mvn clean test jacoco:report` (Maven default) and parse the\n   exit code. Non-Maven stacks use their build-tool-native equivalent\n   (listed in the full protocol).\n4. Parse the coverage CSV (Maven default:\n   `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`), aggregate the line and branch\n   totals across every module in scope, and compare against the\n   line \u002F branch thresholds.\n5. Run the declarative DoD checklist — a static list of boolean\n   predicates (tests present per touched file, tasks DONE in every\n   story, CHANGELOG entry present, ADR references resolvable). Each\n   item contributes one `{item, passed}` tuple to the envelope.\n6. Emit a single-line JSON envelope on stdout:\n   `{passed, failures, coverageDelta, dodChecklist}`.\n\nNon-responsibilities (explicit):\n\n- The skill does NOT dispatch specialist reviews or the Tech Lead\n  review — those stay in `x-implement-epic` Phase 4.4 \u002F 4.6.\n- The skill does NOT mutate `execution-state.json`, `**Status:**`\n  headers, or IMPLEMENTATION-MAP — those belong to\n  `x-internal-update-status`.\n- The skill does NOT write reports; `x-internal-write-report` renders\n  the phase-completion report off the envelope this skill emits.\n- The skill does NOT perform regression diagnosis (failed-test → story\n  correlation) — that stays in the orchestrator, which consumes\n  `failures[]` and branches accordingly.\n- The skill does NOT advance to the next phase or version-bump — those\n  are orchestrator concerns downstream of `passed=true`.\n\n## Convention Anchors (x-internal-*)\n\n| Aspect | Value | Rationale |\n| :--- | :--- | :--- |\n| Path | `internal\u002Fplan\u002Fx-internal-verify-epic-integrity\u002F` | `internal\u002F` prefix scopes visibility; `plan\u002F` co-locates with sibling verification carve-outs (`x-internal-verify-story`, `x-internal-build-epic-plan`) |\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` only | The skill shells out to git + Maven, parses CSV with `awk`, emits JSON with `jq -n`; no `Skill` \u002F `Agent` needed — the gate is a leaf computation |\n| Naming | `x-internal-{subject}-{action}` | `epic-integrity-gate` — subject (epic) + action (integrity-gate) per Rule 04 taxonomy |\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-verify-epic-integrity` in chat.\nAll invocations follow the Rule 13 INLINE-SKILL pattern from a\ncalling orchestrator:\n\n```markdown\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\n```markdown\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049 --branch epic\u002F0049 --coverage-threshold-line 90 --coverage-threshold-branch 85\")\n```\n\n## Parameters\n\n| Parameter | Required | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `--epic-id \u003Cid>` | M | — | 4-digit epic identifier (`XXXX`) — used to resolve default branch name and `ai\u002Fepics\u002Fepic-XXXX\u002F` |\n| `--branch \u003Cname>` | O | `epic\u002F\u003Cid>` | Branch to validate; defaults to `epic\u002F\u003Cepic-id>` (the phase-integration branch) |\n| `--coverage-threshold-line \u003CN>` | O | `95` | Minimum line coverage percentage (integer, 0-100) |\n| `--coverage-threshold-branch \u003CN>` | O | `90` | Minimum branch coverage percentage (integer, 0-100) |\n\nAll four argument forms (`--key value`, `--key=value`, empty, and\nunknown-flag rejection) are supported; unknown flags and missing\nrequired flags exit with `64` (sysexits `EX_USAGE`). The `--epic-id`\nvalue is zero-padded to 4 digits and validated against `^[0-9]{4}$`;\n`--branch` is trimmed and validated against `refs\u002Fheads\u002F` naming rules\n(no spaces, no `..`, no leading `-`). Thresholds outside `[0, 100]`\nexit `64`.\n\n## Response Contract\n\nOn success (any exit code ≤ 4) the skill writes a single-line JSON\nobject to stdout. The envelope is always well-formed JSON; consumers\nMUST read `passed` as the authoritative gate.\n\n| Field | Type | Always Present | Description |\n| :--- | :--- | :--- | :--- |\n| `passed` | `Boolean` | yes | Global gate: `true` iff all sub-gates pass (tests green, coverage ≥ thresholds, every DoD item `passed=true`) |\n| `failures` | `Array\u003CString>` | yes | One human-readable line per failure (empty array on happy path). Categories: `branch:`, `test:`, `coverage:`, `dod:` |\n| `coverageDelta` | `Object` | yes | `{line: Number, branch: Number, lineThreshold: Number, branchThreshold: Number, lineDelta: Number, branchDelta: Number}` — `*Threshold` echo inputs; `*Delta` is `actual − threshold` (negative when below) |\n| `dodChecklist` | `Array\u003C{item:String, passed:Boolean}>` | yes | One entry per DoD predicate; `passed=false` always corresponds to a `dod:` failure in `failures` |\n\n### Example envelope (happy path)\n\n```json\n{\"passed\":true,\"failures\":[],\"coverageDelta\":{\"line\":96.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":1.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":true},{\"item\":\"tests-present\",\"passed\":true}]}\n```\n\n### Example envelope (coverage below + DoD gap)\n\n```json\n{\"passed\":false,\"failures\":[\"coverage: line 88.0 \u003C 95\",\"dod: changelog-entry missing\"],\"coverageDelta\":{\"line\":88.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":-7.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":false},{\"item\":\"tests-present\",\"passed\":true}]}\n```\n\n## Exit Codes\n\n| Code | Name | Condition | Message Format |\n| :--- | :--- | :--- | :--- |\n| 0 | SUCCESS | Envelope emitted with `passed=true` | — |\n| 1 | BRANCH_NOT_FOUND | Target branch does not exist locally or on `origin` | `Branch \u003Cname> not found` |\n| 2 | MVN_TEST_FAILED | Build tool returned non-zero before coverage could be parsed | `Test suite failed` |\n| 3 | COVERAGE_BELOW_THRESHOLD | Envelope emitted with `passed=false` due to coverage | `Coverage below threshold: line=\u003CL>, branch=\u003CB>` |\n| 4 | JACOCO_REPORT_MISSING | Coverage CSV not generated (build completed but no `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`) | `JaCoCo report not found at \u003Cpath>` |\n| 64 | EX_USAGE | Unknown or malformed flag | `usage: --epic-id \u003Cid> [--branch \u003Cname>] [--coverage-threshold-line N] [--coverage-threshold-branch N]` |\n\nWhen `passed=false` is driven purely by DoD gaps (not coverage, not\ntest-failure), the exit code is `0` and the caller MUST branch off\n`passed`. The non-zero exit is reserved for infrastructure-level\nfailures (missing branch, build failure, missing report). This keeps\nthe envelope the single source of truth for the orchestrator.\n\n## Workflow\n\n### Step 1 — Argument parsing and path resolution\n\nParse the four flags; reject unknown and missing required flags with\nexit `64`. Resolve canonical paths:\n\n```bash\nepic_id=\"$(printf '%04d' \"${raw_epic_id}\")\"\nbranch=\"${branch:-epic\u002F${epic_id}}\"\nepic_dir=\"ai\u002Fepics\u002Fepic-${epic_id}\"\njacoco_csv=\"target\u002Fsite\u002Fjacoco\u002Fjacoco.csv\"\n```\n\n### Step 2 — Branch existence + checkout\n\n```bash\nif ! git rev-parse --verify \"${branch}\" >\u002Fdev\u002Fnull 2>&1 \\\n   && ! git rev-parse --verify \"origin\u002F${branch}\" >\u002Fdev\u002Fnull 2>&1; then\n    echo \"Branch ${branch} not found\" >&2\n    exit 1\nfi\n\noriginal_branch=\"$(git symbolic-ref --short HEAD 2>\u002Fdev\u002Fnull || echo DETACHED)\"\ngit checkout \"${branch}\" >\u002Fdev\u002Fnull 2>&1 || {\n    echo \"Branch ${branch} checkout failed\" >&2\n    exit 1\n}\ntrap 'git checkout \"${original_branch}\" >\u002Fdev\u002Fnull 2>&1 || true' EXIT\n```\n\nThe `trap` ensures the caller's working tree is restored even if a\nlater step aborts.\n\n### Step 3 — Run mvn clean test + jacoco:report\n\n```bash\nmvn clean test jacoco:report -q\nmvn_exit=$?\nif [ \"${mvn_exit}\" -ne 0 ]; then\n    echo \"Test suite failed (exit=${mvn_exit})\" >&2\n    exit 2\nfi\n```\n\nNon-Maven stacks use their own equivalents (listed in the full\nprotocol); the skill auto-detects the build tool by probing `pom.xml`,\n`build.gradle(.kts)`, `package.json`, `Cargo.toml`, `go.mod`,\n`pyproject.toml`. When no build tool is detected, the skill logs\n`test: no build tool detected; skipping` to stderr, emits `passed=true`\nfor the test gate (degraded but non-blocking), and continues to\nStep 4 best-effort.\n\n### Step 4 — Parse filtered coverage (JaCoCo CSV)\n\nRead `target\u002Fsite\u002Fjacoco\u002Fjacoco.csv`. The JaCoCo CSV schema is\n(header, then one row per class):\n\n```\nGROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,...\n```\n\nSum `LINE_COVERED` and `LINE_MISSED` across all rows; compute:\n\n```\nline_pct = round(line_covered \u002F (line_covered + line_missed) * 100, 1)\nbranch_pct = round(branch_covered \u002F (branch_covered + branch_missed) * 100, 1)\n```\n\nCompare against `--coverage-threshold-line` and\n`--coverage-threshold-branch` (inclusive: `>=` passes). When the CSV\nis absent (build completed but report not generated), exit `4`\n(`JACOCO_REPORT_MISSING`) with no envelope.\n\nWhen coverage is below threshold, append\n`coverage: line \u003Cactual> \u003C \u003Cthreshold>` and\u002For\n`coverage: branch \u003Cactual> \u003C \u003Cthreshold>` to `failures`, compute\n`lineDelta` \u002F `branchDelta` as `actual - threshold` (negative when\nbelow), set `passed=false`, exit `3`.\n\n### Step 5 — DoD checklist (declarative, extensible)\n\nThe DoD checklist is a declarative list of boolean predicates\nembedded in the skill. Each predicate is deterministic and read-only.\nDefault catalogue (v1):\n\n| Item | Predicate | Failure Message |\n| :--- | :--- | :--- |\n| `all-tasks-done` | Every `- [ ]` checkbox in `ai\u002Fepics\u002Fepic-\u003Cid>\u002Fstory-*.md` Section 8 is either `- [x]` OR the story `**Status:**` is `Concluida` | `dod: \u003CN> task(s) not marked DONE` |\n| `changelog-entry` | `CHANGELOG.md` contains at least one `### Added` \u002F `### Fixed` \u002F `### Changed` entry under `## [Unreleased]` OR under a version header newer than the previous release tag | `dod: changelog-entry missing` |\n| `tests-present` | Every `src\u002Fmain\u002F**\u002F*.{java,kt,ts,py,go,rs}` file touched on this branch (diff vs `main`) has at least one corresponding test file under `src\u002Ftest\u002F` matching the class-name convention | `dod: \u003CN> file(s) without corresponding test` |\n| `adr-references-resolvable` | Every `adr\u002FADR-NNNN-*.md` referenced in story markdowns actually exists | `dod: \u003CN> ADR reference(s) unresolved` |\n| `story-status-concluida` | Every `ai\u002Fepics\u002Fepic-\u003Cid>\u002Fstory-*.md` has `**Status:** Concluida` (or `Concluída`, accent-agnostic) | `dod: \u003CN> story(ies) not Concluida` |\n\nExtension contract: additional predicates are appended to the\ncatalogue in the full-protocol reference; the envelope schema is\nstable (each predicate maps to exactly one `dodChecklist` entry).\nPredicates MUST be pure: no network I\u002FO, no git write, no mutation.\n\n### Step 6 — Assemble and emit envelope\n\nCompose the JSON envelope via `jq -nc`. The exit code is the lowest\napplicable (0 success; 1 branch missing; 2 test failure; 3 coverage\nbelow; 4 missing report).\n\n```bash\njq -nc \\\n  --argjson passed \"${passed_bool}\" \\\n  --argjson failures \"${failures_json}\" \\\n  --argjson coverageDelta \"${coverage_json}\" \\\n  --argjson dodChecklist \"${dod_json}\" \\\n  '{passed:$passed, failures:$failures,\n    coverageDelta:$coverageDelta, dodChecklist:$dodChecklist}'\n```\n\n## Examples\n\n### Example 1 — Happy path: gate passes on clean epic branch\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope:\n\n```json\n{\"passed\":true,\"failures\":[],\"coverageDelta\":{\"line\":96.0,\"branch\":91.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":1.0,\"branchDelta\":1.0},\"dodChecklist\":[{\"item\":\"all-tasks-done\",\"passed\":true},{\"item\":\"changelog-entry\",\"passed\":true},{\"item\":\"tests-present\",\"passed\":true},{\"item\":\"adr-references-resolvable\",\"passed\":true},{\"item\":\"story-status-concluida\",\"passed\":true}]}\n```\n\nExit: 0.\n\n### Example 2 — Coverage below threshold\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope includes `\"passed\":false` and\n`\"coverage: line 88.0 \u003C 95\"` in `failures`; `coverageDelta.lineDelta=-7.0`.\nExit: 3.\n\n### Example 3 — Test failure\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nStderr: `Test suite failed (exit=\u003CN>)`. Exit: 2. No envelope\nemitted.\n\n### Example 4 — Branch not found\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 9999\")\n```\n\nStderr: `Branch epic\u002F9999 not found`. Exit: 1. No envelope emitted.\n\n### Example 5 — Boundary: coverage exactly on threshold\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049\")\n```\n\nEnvelope `\"coverageDelta\":{\"line\":95.0,\"branch\":90.0,\"lineThreshold\":95,\"branchThreshold\":90,\"lineDelta\":0.0,\"branchDelta\":0.0,...}` → `passed=true` (inclusive).\nExit: 0.\n\n### Example 6 — Custom thresholds (per-epic override)\n\n```bash\nSkill(skill: \"x-internal-verify-epic-integrity\",\n      args: \"--epic-id 0049 --coverage-threshold-line 80 --coverage-threshold-branch 75\")\n```\n\nEnvelope reports `lineThreshold=80, branchThreshold=75`. Use case:\nmeta-epics touching only documentation\u002Fgenerator resources override\nthe project-wide defaults.\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\nNo file is created or modified. The skill is **strictly read-only**\nagainst the project source tree (enforced by `allowed-tools: Bash`\nfrontmatter — no `Write` \u002F `Edit` available). It DOES execute Maven,\nwhich mutates `target\u002F` — that is the build tool's responsibility,\nnot a state mutation in the sense of `x-internal-ops\u002F*`.\n\n## Error Handling\n\n| Scenario | Action |\n| :--- | :--- |\n| Missing required flag (`--epic-id`) | Print `usage:` banner to stderr; exit 64 |\n| Unknown flag | Print `unknown flag \u003Cname>; usage:`; exit 64 |\n| Threshold outside `[0, 100]` | Print `threshold must be in [0,100]`; exit 64 |\n| `jq` absent on PATH | Print `dependency missing: jq`; exit 127 |\n| `pom.xml` \u002F build config absent | Print `no build tool detected`; emit `test: no build tool detected` in failures; continue Steps 4–5 best-effort |\n| Coverage CSV unreadable | Emit `coverage: report unreadable (\u003Creason>)` in failures; `passed=false`; exit 4 |\n| Test process segfaults \u002F OOM | Exit 2 with `Test suite failed (\u003Csignal>)`; no envelope |\n| Checkout fails (dirty working tree) | Exit 1 with `Branch \u003Cname> checkout failed: \u003Cgit stderr>`; caller expected to stash first |\n| Story file missing during DoD check | Append `dod: story file \u003Cid> missing` to failures; `passed=false`; exit 0 |\n| CHANGELOG.md absent | Append `dod: changelog-entry missing (CHANGELOG.md absent)` to failures; `passed=false`; exit 0 |\n| `mvn` absent on PATH (Maven project) | Print `dependency missing: mvn`; exit 127 |\n\n## Performance Contract\n\nTarget: \u003C 5 minutes for a medium epic (~10 stories, ~50 classes in\naggregate) on a laptop-class machine. Breakdown budget:\n\n| Step | Target |\n| :--- | :--- |\n| Argument parse + branch validation | \u003C 200 ms |\n| Checkout | \u003C 500 ms |\n| `mvn clean test jacoco:report` | \u003C 4 min |\n| Coverage CSV parse | \u003C 300 ms |\n| DoD checklist evaluation | \u003C 10 s |\n| Envelope assembly | \u003C 50 ms |\n\nLarge epics (20+ stories, 200+ classes) may exceed the total; the\nfull-protocol reference documents an opt-in `--skip-clean` knob that\nreuses prior `target\u002F` when safe.\n\n## Testing\n\nThe story ships the following acceptance test scenarios, mirroring\nSection 7 of story-0049-0010:\n\n1. **Degenerate — gate passes on a clean branch.** All DoD items\n   pass, coverage line=96 \u002F branch=91 → `passed=true`, exit 0.\n2. **Failure — coverage below threshold.** Line=88 with threshold=95 →\n   `passed=false`, exit 3, `failures` contains\n   `\"coverage: line 88.0 \u003C 95\"`.\n3. **Failure — test suite failure.** `mvn test` exits non-zero →\n   exit 2, no envelope.\n4. **Error — branch not found.** `--epic-id 9999` with no such\n   branch → exit 1, no envelope.\n5. **Boundary — coverage exactly on threshold.** Line=95, Branch=90 →\n   `passed=true`, exit 0 (inclusive).\n\nGoldens live under the smoke test resource path (see `Files:` of\nTASK-0049-0010-005). Coverage requirement: ≥ 95% line \u002F ≥ 90% branch\nacross the invoking Bash codepaths.\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 layout)\nso `Skill(skill: \"x-internal-...\")` invocations from other skills\nresolve 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 — Phase 1.7 \u002F Phase 4 in\n`x-implement-epic` — is the correct aggregation boundary). Passive\nhooks still capture `tool.call` for the underlying `Bash` invocations\n(git, Maven, jq).\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), and ADR-0011\n(Slim-SKILL \u002F Fat-Reference Split).\n\n## Integration Notes\n\n| Skill | Relationship | Context |\n| :--- | :--- | :--- |\n| `x-implement-epic` | caller (primary) | Phase 1.7 \u002F Phase 4 carve-out: the skill's stdout envelope replaces the ~180 inline lines that currently live in `references\u002Fintegrity-gate.md` and the Phase 4 orchestrator body — Phase 4 shrinks to ~80 lines (story-level metric per story-0049-0018) |\n| `x-internal-verify-story` | peer | Sibling `internal\u002Fplan\u002F` skill; runs the equivalent gate at story scope (coverage filtered to story's files, cross-file consistency, AC mapping). `x-internal-verify-epic-integrity` runs at the epic\u002Fphase scope — aggregate coverage, aggregate DoD |\n| `x-internal-build-epic-plan` | peer | Sibling `internal\u002Fplan\u002F` skill; computes the epic DAG + phase ordering upstream (Phase 0). This skill consumes the `epic\u002F\u003Cid>` branch AFTER all phase stories are merged |\n| `x-internal-write-report` | downstream | Consumes this skill's envelope to render the phase-completion report `phase-report-epic-XXXX.md` via `_TEMPLATE-PHASE-COMPLETION-REPORT.md` |\n| `x-internal-update-status` | downstream | Consumes `passed` to transition phase status and trigger the semantic version bump (when `passed=true`) per RULE-013 |\n| `x-evaluate-parallelism` | indirect | Runs BEFORE this skill at Phase 1.5 to validate parallelism constraints; its output does not feed the integrity gate |\n\nDownstream stories that depend on this carve-out:\n- **story-0049-0018** (refactor `x-implement-epic`) consumes the\n  envelope and deletes the inline Phase 4 block.\n\nFull workflow detail (argument-parser rejection matrix, JaCoCo CSV\nschema with worked parsing example, build-tool-native equivalents for\nGradle \u002F npm \u002F cargo \u002F go \u002F pytest, DoD-predicate catalogue with\nextension examples, `--skip-clean` optimisation semantics, and the\ncoverage-aggregation formula for multi-module Maven projects) lives in\n[`references\u002Ffull-protocol.md`](references\u002Ffull-protocol.md) per\nADR-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","--epic-id \u003CXXXX> [--branch \u003Cname>] [--coverage-threshold-line \u003CN>] [--coverage-threshold-branch \u003CN>]","medium",[],"main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-clickhouse\u002F.claude\u002Fskills\u002Fx-internal-verify-epic-integrity",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-verify-epic-integrity",{"tool":45,"command":46},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-verify-epic-integrity",{"tool":48,"command":49},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-internal-verify-epic-integrity","安装技能，技能地址：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-epic-integrity\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Ffull-protocol.md","REFERENCE","参考文档",13207,"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-epic-integrity\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",[],[]]