[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6K3EQQ6ADH3G2RMYK6XE26E":3,"skill-same:01M6K3EQQ6ADH3G2RMYK6XE26E":74},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":54,"install":55,"resources":67},"01M6K3EQQ6ADH3G2RMYK6XE26E","writing-system-tests",null,"Use BEFORE implementing any feature that has stories in .docs\u002Fstories\u002F — generates failing acceptance specs from acceptance criteria as the RED phase of TDD. Generates HTTP\u002Frequest-level acceptance tests for headless\u002FAPI projects, end-to-end UI tests for projects with a frontend, using the project's own test framework and directory conventions.","jstoup111\u002Fai-conductor","jstoup111","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1585332?v=4","01M6K374Y0VEFPVCT2KPBAN4HC","James Stoup","01M6K3751X0GFKNBD0198F50XN",7,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-tests\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"system","tests","writing system tests","writing","request","phase","gating","failing","framework","ui","directory","claims","api","acceptance","frontend","implementing","end","project","headless","projects","2026-11-10 10:12:30",false,"---\nname: writing-system-tests\ndisable-model-invocation: true\ndescription: \"Use BEFORE implementing any feature that has stories in .docs\u002Fstories\u002F — generates failing acceptance specs from acceptance criteria as the RED phase of TDD. Generates HTTP\u002Frequest-level acceptance tests for headless\u002FAPI projects, end-to-end UI tests for projects with a frontend, using the project's own test framework and directory conventions.\"\nenforcement: gating\nphase: build\nrequires: [verify-claims]\n---\n\n# Writing Acceptance Tests\n\n## Overview\n\nGenerate failing acceptance specs from user stories in `.docs\u002Fstories\u002F*.md`. Each acceptance\ncriterion (happy AND negative paths) receives a concrete coverage disposition. Only the criteria\nthat need acceptance\u002Fsystem coverage become generated specs; those specs are written BEFORE\nimplementation and are the RED phase of BDD.\n\n**Correctness gate:** a test encodes an expected-behavior claim. Per the `\u002Fverify-claims` protocol,\nif a spec rests on an assumption about what \"correct\" means that is not pinned by the story's\nacceptance criteria, the FR, or the ADR, surface it with its confidence and HARD-BLOCK for operator\napproval (HALT if autonomous) rather than freezing a guess into a passing\u002Ffailing assertion.\n\nThis skill is **language- and framework-agnostic.** It describes *what* acceptance tests to\nwrite and *why*; the concrete syntax, test runner, file layout, and fixture mechanism come\nfrom the project's own conventions. Detect those from the loaded tech-context (see\n`tech-context\u002F`) or from the existing test suite, and follow them — exactly as the `\u002Ftdd` skill\ndefers to \"stack test conventions.\"\n\n**Detect project shape and generate the right kind of acceptance test:**\n\n| Project Shape | Acceptance Test Type | Exercises |\n|---|---|---|\n| Headless \u002F API (no UI) | HTTP \u002F request-level acceptance tests | HTTP requests, status codes, serialized (JSON\u002FXML\u002Fetc.) responses |\n| Has a frontend \u002F full-stack | End-to-end (E2E) \u002F UI tests | A real UI driver — browser, native, or TUI — navigation and user-visible assertions |\n\n**The test framework and paths are the project's, not this skill's.** Place and name specs per\nthe project's conventions. Illustrative mappings (adapt to whatever the project actually uses):\n\n| Stack | HTTP-level acceptance | E2E \u002F UI |\n|---|---|---|\n| Ruby + RSpec | `spec\u002Fintegration\u002F` (`type: :request`) | `spec\u002Fsystem\u002F` (Capybara) |\n| Python + pytest | `tests\u002Fintegration\u002F` (httpx\u002Frequests) | `tests\u002Fe2e\u002F` (Playwright\u002FSelenium) |\n| JS\u002FTS + Jest\u002FVitest | `test\u002Fintegration\u002F` (supertest) | `test\u002Fe2e\u002F` (Playwright\u002FCypress) |\n| Go | `*_integration_test.go` (`net\u002Fhttp\u002Fhttptest`) | `e2e\u002F` (chromedp\u002Frod) |\n\n## Process\n\n### Stacked-Child Scope\n\nWhen this step is dispatched for a stacked feature's active child, the dispatch supplies the child\nidentifier `\u003Ck>`, its owned stories and criteria, and (except for the first child) the supplied\nparent closure tip. Cover **only the supplied owned stories**: derive dispositions, search for\nexisting proof, generate or copy specs, and select the RED run only for those stories and their\ncriteria. Do not use another child's stories or criteria to fill, omit, or justify this child's\ncoverage.\n\nFor that child, write the RED marker at\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-red.json` and its run contract at\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-run.json`. These files belong to the supplied child;\ndo not read, replace, or reuse another child's evidence.\n\nIf an owned spec already passes because the supplied parent closure tip already contains the\nbehavior, do not manufacture a failure. Record the genuine run and its `prior-child-green`\nexception in the child RED marker. Set the exception attribution to the **supplied parent closure\ntip** so the engine can verify that the earlier child, rather than an ungrounded assumption,\nexplains the passing result. All other execution requirements still apply.\n\nFor a feature with no active child, retain the flat behavior: cover its feature stories and write\n`.pipeline\u002Facceptance-specs-red.json` and `.pipeline\u002Facceptance-specs-run.json` unchanged.\n\n### 1. Detect Project Type\n\nFirst, determine the **test framework, runner, and directory layout** from the loaded\ntech-context or, if none, by inspecting the existing test suite (test directories, config files\nlike `package.json`\u002F`pyproject.toml`\u002F`Gemfile`\u002F`go.mod`, and how current tests are written).\nMatch those conventions — do not impose a foreign layout.\n\nThen determine **project shape** to pick the acceptance test type:\n\n- A frontend exists (server-rendered templates, an SPA, a mobile\u002Fdesktop UI, or a TUI) →\n  **Full-stack** → end-to-end \u002F UI tests driven through a real UI driver.\n- No UI; a service, API, library, or CLI only → **Headless** → HTTP\u002Frequest-level acceptance\n  tests (or, for a library\u002FCLI, public-interface \u002F command-invocation acceptance tests).\n\n### 2. Check for Missing Acceptance Specs\n\nFor **every** happy and negative criterion in every story, record one concrete coverage\ndisposition before writing a spec. This applies on both the product and technical tracks:\n\n- **`existing-sufficient-test`** — a named existing behavioral test already proves the criterion\n  at a sufficient layer. Cite its path and test name\u002Fline.\n- **`planned-lower-layer-test`** — a named behavioral test assigned to the implementation task\n  will prove the criterion sufficiently below the acceptance layer. Cite the plan task and the\n  intended request\u002Fendpoint, command\u002Fpublic-interface, or unit\u002Fdomain test.\n- **`acceptance-system-spec`** — this pass will write and execute an acceptance\u002Fsystem spec for a\n  distinct multi-step externally observable flow that cannot be proven sufficiently below. Cite\n  the target spec and flow.\n\nThe disposition is about the behavior and its failure boundary, not the directory label of a test.\nA request-level test can be sufficient for a public command or endpoint contract; a test under an\n`integration` directory is not automatically acceptance coverage. Negative permutations remain at\nthe lower layer when that layer proves the observable failure sufficiently. Do not elevate each\nnegative permutation merely to populate an acceptance suite.\n\nEvery criterion must have exactly one disposition and its cited proof or assigned test. If a\ncriterion has neither existing proof nor a specific planned\u002Fgenerated test, block this step and\nreport the criterion; do not silently omit it or create a speculative spec. Ordinary changes to\nskill prose and the existence, creation, or modification of a production file do not themselves\ncreate behavioral criteria or require a test.\n\nRecord the criterion dispositions and citations in this step's report. On the product track, the\nFR table in §3e additionally maps the same record to approved functional requirements; it does not\nreplace the all-track criterion check.\n\nOnly after this disposition pass, compare the `acceptance-system-spec` criteria against the\nproject's existing acceptance specs in its established layout. Generate only the uncovered flows.\n\n### 2a. Declared Pattern Replication\n\nWhen the active plan's header resolves a complete `**Pattern-source:**` and\n`**Rename-map:**` declaration, `acceptance_specs` **copies rather than derives** the source\nfeature's acceptance specs. This replacement applies only to a resolved declaration; with no\ndeclaration, derive specs from the stories exactly as this skill otherwise requires.\n\nCopy each source spec to its rename-map-derived target path, applying the map to its filename and\ncontent.\n\nLocate the source feature's acceptance specs using the project's established acceptance-spec\nlayout. For each source spec, apply the ordered Rename-map to both its relative path (including\nthe filename) and its content, then write the resulting target spec. Run those copied specs at\n`acceptance_specs` time before continuing.\n\nBefore writing, enumerate the source acceptance-spec glob and all derived target paths. If the\nsource acceptance spec set is empty, fail closed: report the declared Pattern-source and the\nacceptance-spec glob that found no specs, and never fall back to derivation. If two source specs\nderive the same target-path collision, fail closed before any write rather than overwriting either\ntarget. These are declaration-copy failures, not reasons to resume the ordinary derivation path.\n\nThe copied run earns RED only when its failure includes at least one copied spec failing because\nthe target does not yet exist, with a non-zero failure count and zero errors and zero skips. Record\nthat real result using the existing §6 RED-evidence contract. Never fall back to derivation after a\ndeclaration has resolved: copied specs are the feature's acceptance coverage for this step.\n\nIf all copied specs pass, fail closed and report the passing specs by path. A fully passing copied\nset establishes neither the required missing-target RED failure nor evidence that the copied tests\nexercise the new target; do not treat it as successful RED evidence.\n\n**Find existing sufficient proof:** Before generating, search the existing test suite for each\ncriterion's behavior and failure boundary (for example, function\u002Fmethod names, status codes, and\nerror messages). A keyword hit alone is not proof: confirm the test asserts the expected behavior.\nIf it does — unit, request\u002Fendpoint, command\u002Fpublic-interface, or prior acceptance spec — assign\n`existing-sufficient-test` and do not generate a duplicate.\n\nConcrete search: `grep -rE \"criterion keyword\" \u003Cthe project's test directories>`. Record the\ncriterion's disposition and citation; this record, rather than a count of generated specs, proves\nnothing was missed.\n\n### No Legitimate Acceptance-Spec RED for Already-Existing Behavior\n\nFor a plan-marked verify-only\u002Fverification task, generate at most the documenting acceptance spec\nexplicitly requested by the plan. Outside such a task, no acceptance spec is invented for\nalready-existing behavior just to manufacture a RED result.\n\nIf investigation discovers that behavior already exists but the sealed plan did not mark the task\nverify-only\u002Fverification, follow `\u002Ftdd`'s **No Legitimate RED for Already-Existing Behavior**\ndiscovered-case exit. Do not amend the sealed plan or retain a redundant acceptance spec. This\nboundary never applies to work that adds, changes, or fixes behavior.\n\n**End-to-end internally; fake third parties:** Acceptance specs test the real application entry\npoint and internal system. Do NOT mock internal infrastructure (database, queues, caches,\nbackground jobs). Replace every **third-party external service** (LLM providers, hosted APIs,\nGitHub, payment APIs, email providers, external webhooks, package registries) with a faithful fake\nthrough the production adapter seam. If locally controlled infrastructure is unavailable in the\ntest environment, configure the test environment to provide it — don't mock it away. Calls to a\nreal third party belong only in an explicitly named, opt-in smoke test that is excluded from the\ndefault suite and CI.\n\n### 2.5. Schema Consistency Check\n\nBefore generating specs, compare model\u002Fentity column definitions against migration files:\n- Check that column names in models match column names in migrations (e.g., `external_id` in\n  model vs `external_reference_id` in migration is a mismatch)\n- Check that column types match (e.g., `payload` string vs `request_payload`\u002F`response_payload`\n  split columns)\n- If the project uses fake\u002Fstub column definitions (e.g., `fake_columns.rb`), verify those\n  match the real migration definitions\n\n**Do not generate specs from inconsistent schemas — resolve the mismatch first.** Specs\ngenerated against a mismatched schema will either pass incorrectly or fail for the wrong reason.\n\n### 3. Parse Acceptance Criteria\n\nExtract from each story file:\n- Feature area name (H1 or filename)\n- Story titles (H2)\n- Happy path criteria (Given\u002FWhen\u002FThen under Happy Path heading)\n- Negative path criteria (Given\u002FWhen\u002FThen under Negative Paths heading)\n\n**Both happy AND negative paths need a coverage disposition.** Negative paths are not optional;\nwhen a lower-layer behavioral test is sufficient, assign it there rather than duplicating it above.\n\n**Derive specs from stories, not code.** Extract field names, value types, and expected\nbehaviors from the story acceptance criteria TEXT — not from existing implementation code.\nIf the story says `refresh_token`, the spec must use `refresh_token` even if the current\ncode uses `token`. The spec defines what SHOULD exist, not what DOES exist.\n\n### 3.5. Domain Alignment Check\n\nBefore generating specs, compare field names and context keys used in generated specs against\nthe story language. Flag any spec that uses implementation-derived names instead of\nstory-specified names. This catches cases where code conventions diverge from domain language\n(e.g., builder context key `token` vs story's `refresh_token`, model field `payload` vs\nstory's `request_payload`).\n\n### 3a. Classify Behavioral Scope\n\nFor each criterion, decide the lowest layer that can prove its behavior. Generate an\nacceptance\u002Fsystem spec only when the criterion belongs to a **distinct multi-step externally\nobservable flow** that a lower-layer behavioral test cannot prove sufficiently. Typical examples\nare create → assign → observe an outcome, or configure → invoke → observe an externally visible\nresult. The operations need not be HTTP endpoints; use the project's actual public interface.\n\nSingle operations and their validation\u002Ferror permutations normally receive\n`planned-lower-layer-test` coverage through `\u002Ftdd` — for example, a request\u002Fendpoint, command, or\ndomain test. A multi-step sequence does not automatically need an acceptance spec if a lower-layer\nbehavioral test can already prove the relevant observable flow. Conversely, a multi-step external\nflow that cannot be proven below receives `acceptance-system-spec` even if the project's directory\nname would normally suggest another label.\n\nIf no criterion needs `acceptance-system-spec`, generate no acceptance specs. The disposition\nrecord must still show sufficient existing proof or a specific lower-layer assignment for every\nhappy and negative criterion. This avoids duplicate acceptance coverage without treating any\ncriterion as optional. Record `outcome: \"disposition-only\"` in\n`.pipeline\u002Facceptance-specs-red.json` with an exhaustive `dispositions` array: each record names\none happy or negative criterion and is exactly either `existing-sufficient-test` with a verifiable\ntest `citation`, or `planned-lower-layer-test` with a verifiable plan `citation`, `owningTask`, and\n`layer`. Do not fabricate an acceptance RED run in this case: the assigned lower-layer test must\nproduce its genuine RED evidence during `\u002Ftdd`, and no acceptance run contract or failing-spec\ncommit is written. Whenever this step copies or generates an acceptance\u002Fsystem spec, record\n`outcome: \"specs-generated\"`; §6's executable RED machinery remains mandatory.\n\n### 3b. Replacement Tasks: Drive the REAL Entry Point\n\nWhen a task **replaces or supersedes existing behavior** (the plan says \"replace X\",\n\"supersede Y\", \"swap the old path for the new\"), the new code is only correct if the\nPRODUCTION entry point actually calls it. A unit test that invokes the new function\n*directly* passes even while the live path still calls the old one — the new primitive\nships orphaned (zero production callers).\n\n**Rule:** for any replacement task, assign **≥1 behavioral test at the lowest sufficient layer**\nthat drives the real production entry point (the command \u002F handler \u002F route \u002F loop a user or caller\nactually invokes) — NOT the new unit under test — and asserts the **observable artifact** the\nreplacement is supposed to produce (file written, PR opened, gate enforced, record persisted).\nUse `acceptance-system-spec` only when this is a distinct multi-step externally observable flow\nthat cannot be proven below; otherwise assign a specific lower-layer behavioral test. The test\nmust fail if the entry point is still wired to the OLD behavior.\n\n- Identify the real entry point from the story\u002Fplan (\"when `dispatchEngineer({ kind: 'land' })`\n  lands a spec…\"), not the new helper symbol (\"when `landSpec` is called…\").\n- Assert the side effect, not the return value of the new unit.\n- Pair with the `\u002Fpipeline` batch gate that greps the superseded symbol for zero non-test\n  callers: the acceptance test proves the new path runs; the grep proves the old one is gone.\n\n### 3c. Boundary-Value Checklist for Path \u002F Prefix Guards\n\nAny spec covering a **path, prefix, or canonical-root guard** (an allow\u002Fdeny check on a\nfilesystem path or string prefix) MUST include explicit boundary-value cases. Off-by-one\nnormalization bugs in these guards fail *closed* (reject everything) or *open* (accept a\nsibling) and are invisible to happy-path tests.\n\nGenerate a negative\u002Fboundary case for EACH row:\n\n| Boundary | Example input | Expected |\n|---|---|---|\n| Trailing slash | `\u003Croot>\u002Frepo\u002F` vs canonical `\u003Croot>\u002Frepo` | normalized equal — write allowed |\n| Root path | filesystem root | guarded, never a wildcard |\n| Empty string | `\"\"` | rejected, no crash |\n| Sibling-prefix | `\u003Croot>\u002Frepo-evil` vs allowed `\u003Croot>\u002Frepo` | rejected (prefix ≠ path segment) |\n\nA path-guard spec without these rows is incomplete — treat them as mandatory negative paths.\n\n### 3d. Adversarial Derivation Coverage: Every Call Site, Real Input\n\n§3b (replacement → real entry point) and §3c (path guards → boundary values) are two cases of a\nwider rule. For **any security- or correctness-critical derivation** — a redaction\u002Fsanitizer, an\nauth\u002Fpermission predicate, an identity or path check, a state guard (\"is the tree clean\", \"is this\nthe right session\", \"has this been processed\") — a unit test that exercises the derivation on\n**clean or hand-injected** input passes while the REAL production call site feeds it adversarial\nreal-world input that is never tested. The bug lives in the *wiring between the call site and the\nderivation*, which the derivation's own unit test cannot reach.\n\n**Rule:** for each such derivation, enumerate **EVERY production call site** that invokes it, and\nassign a failing behavioral test **per call site** at the lowest sufficient layer that:\n\n- feeds the **real adversarial input that site actually passes** — a URL carrying a real token, a\n  path with a trailing slash \u002F sibling prefix \u002F traversal segment, a dirty or stale tree state, an\n  empty or boundary value — **not** a clean fixture or a value injected directly into the helper, and\n- asserts the **observable guarantee at that site** — the token never appears in the emitted output,\n  the write is refused, the step HALTs, the duplicate is skipped — **not** the derivation's return\n  value in isolation.\n\nA derivation covered only by its own unit test is incomplete. List the call sites you found\n(`file:line`) in the assigned test file or the PR body so the domain reviewer (TDD) can confirm none were\nmissed.\n\n### 3e. FR Coverage Mapping (Product Track)\n\n**Scope:** this section runs only when both are true — the work is on the **product track**\nand an **approved PRD** exists for the feature. If either condition is false (technical track,\nor no approved PRD), skip this section entirely.\n\n- **If a PRD exists but `Status: Approved` is not in the file:** do NOT build a table from an\n  unapproved FR list — report the task as **FAILED** with the reason \"PRD found but not\n  approved; cannot gate on incomplete FR list.\" This surfaces the missing approval as a\n  pipeline error rather than a silent no-op.\n\nParse the PRD's enumerated functional requirements (the `FR-N` list). Build a coverage table\nwith **exactly one row per FR** — every `FR-N` in the PRD must appear exactly once, and no row\nmay reference an `FR-N` that isn't in the PRD. A table that omits an FR or invents one not\npresent in the PRD is invalid and must be corrected before proceeding.\n\nFor each FR row, derive exactly one disposition from the criterion record's **closed set**:\n\n- **`existing-sufficient-test`** — maps to §2. The FR's behavior is asserted by a cited existing\n  behavioral test at a sufficient layer.\n- **`planned-lower-layer-test`** — maps to §3a. The cited implementation task owns the specific\n  lower-layer behavioral test that will prove the FR.\n- **`acceptance-system-spec`** — the FR is covered by a generated (or declared-copy) acceptance\u002F\n  system spec in this pass (§5a\u002F§5b).\n\nNo disposition outside this closed set (`existing-sufficient-test`,\n`planned-lower-layer-test`, `acceptance-system-spec`) is permitted.\n\n**Citation requirement:** every row must cite the evidence for its disposition:\n- `existing-sufficient-test` → cite the existing test file\u002Fline found by the §2 search.\n- `planned-lower-layer-test` → cite the implementation plan task and intended test.\n- `acceptance-system-spec` → cite the generated spec file (and test name) that covers it.\n\n**Unresolved rows are flagged as errors.** A row is unresolved — and must be flagged rather than\nsilently accepted — if any of the following hold:\n- it has 2 or more dispositions assigned (ambiguous),\n- its disposition isn't one of the three closed-set values,\n- it has no citation.\n\nUnresolved rows block completion of this step; resolve them (re-classify, find the missing\ncitation, or split the ambiguous row) before moving to §4.\n\n### 4. Read App Context\n\nFor each story, read the project's equivalents of:\n- **Routing \u002F endpoint definitions** — the route table, URL config, or handler registration that\n  lists available paths and their names.\n- **Request handlers \u002F controllers** — response formats, auth requirements, middleware\u002Ffilters.\n- **Data models \u002F schema** — validations, relations, enums (for fixture\u002Ffactory setup).\n- **Existing fixtures, factories, or test-data builders** — reuse them, don't duplicate.\n\nIf routes\u002Fmodels don't exist yet (pre-implementation), write tests using the expected paths and\nnames from the stories. Tests will fail with routing\u002Fhandler-not-found, undefined-symbol, or\nmissing-table errors — this is correct RED behavior.\n\n### 5a. Generate HTTP \u002F Request-Level Acceptance Specs (Headless \u002F API Projects)\n\n**File mapping:** `.docs\u002Fstories\u002Flinks.md` → the project's acceptance spec for that area\n(e.g. `spec\u002Fintegration\u002Flinks_spec.rb`, `tests\u002Fintegration\u002Ftest_links.py`,\n`test\u002Fintegration\u002Flinks.test.ts`).\n\nAcceptance test of a multi-step flow, expressed as framework-neutral structure (write it in the\nproject's actual framework and assertion style):\n\n```\nSUITE \"Link lifecycle\":\n  STORY \"Create and use a short link\":\n    HAPPY PATH \"creates a link, redirects via short code, records a click\":\n      POST \u002Flinks  { original_url: \"https:\u002F\u002Fexample.com\" }   (with auth)\n      short_code ← response.body.link.short_code\n      GET \u002F\u003Cshort_code>\n      EXPECT redirect → \"https:\u002F\u002Fexample.com\"\n    NEGATIVE \"expired link\":\n      # create link, advance clock past expiry\n      GET \u002F\u003Cshort_code>  →  EXPECT 410 Gone\n```\n\n**Key distinction: acceptance specs test FLOWS, not endpoints\u002Foperations.**\n\nAn acceptance spec that only hits one endpoint is usually a request\u002Fendpoint test wearing a\ncostume. If it does not prove a distinct multi-step externally observable flow that cannot be\nproven sufficiently below, it belongs in the lower behavioral layer instead.\n\n| Test proves one operation or negative permutation sufficiently | → lower-layer behavioral test |\n| Test proves a distinct multi-step external flow no lower layer can prove | → acceptance\u002Fsystem spec (this skill) |\n| Test verifies model\u002Fdomain logic directly | → unit test |\n\n**This avoids duplication.** Request\u002Fendpoint tests own individual endpoint behavior (status\ncodes, error formats, params validation). Acceptance specs own the story flow (create → use →\nverify outcome). Neither duplicates the other.\n\n**Rules for acceptance specs:**\n- Test multi-step flows that map to stories, not individual endpoints\n- One group per story, one sub-group per happy\u002Fnegative path (per the framework's grouping idiom)\n- Each test is independent — creates its own data via factories\u002Ffixtures\n- Assert outcomes, not intermediate transport details (request\u002Fendpoint tests own those)\n- Auth uses helper methods, not hardcoded tokens\n- Exercise the real internal flow; inject faithful fakes at all third-party adapter boundaries\n- Every generated spec must declare feature coverage in a leading comment line. Where the active\n  stories or plan are available, use resolvable `Covers: S\u003Cn>.\u003Cm>[, task:\u003Cid>]` markers (technical\n  and product tracks alike); the marker must name a criterion in the active stories or a task in the\n  active plan. Criterion ids are positional: `S\u003Cn>.\u003Cm>` is the m-th Given\u002FWhen\u002FThen bullet of Story n,\n  counting happy-path bullets first and then negative-path bullets — story files never carry literal\n  ids. On the product track, also retain `Covers: FR-N[, FR-M]` for PRD coverage reporting.\n  The generated marker must be introduced or updated in the active feature diff. An unchanged bare\n  marker inherited from the review base remains owned by the earlier feature and cannot authorize\n  an active-plan task or criterion merely because its ordinal collides.\n  Do not use a test path as a substitute for a Covers marker.\n\n**Helpers:** Create shared request helpers (e.g. response-body parsing and auth-header\nconstruction) in the project's test-support location if they don't already exist.\n\n### 5b. Generate End-to-End \u002F UI Specs (Full-Stack Projects)\n\nDeclare coverage with the same `Covers:` markers as §5a, including `Covers: FR-N` on the product track.\n\n**File mapping:** `.docs\u002Fstories\u002Fauth.md` → the project's E2E spec for that area\n(e.g. `spec\u002Fsystem\u002Fauth_spec.rb`, `tests\u002Fe2e\u002Ftest_auth.py`, `test\u002Fe2e\u002Fauth.spec.ts`).\n\nE2E test of a user flow, expressed as framework-neutral structure (write it with the project's\nactual UI driver and assertion style):\n\n```\nSUITE \"Authentication\" (driven through a real UI driver):\n  STORY \"User Registration\":\n    HAPPY PATH \"registers with valid email and password\":\n      visit  \u003Cnew registration screen>\n      fill   \"Email\" = \"user@example.com\",  set a valid password\n      submit the form\n      EXPECT visible text \"Welcome\"\n    NEGATIVE \"duplicate email\":\n      seed an existing user with \"taken@example.com\"\n      visit  \u003Cnew registration screen>\n      fill   \"Email\" = \"taken@example.com\",  submit\n      EXPECT visible text \"already taken\"\n```\n\n**Rules for E2E \u002F UI specs:**\n- Every criterion assigned `acceptance-system-spec` gets concrete driver code — no stubs, no\n  `pending`\u002Fskipped placeholders\n- Each test is independent — creates its own data, signs in if needed\n- Do not mock the application stack or locally controlled infrastructure; inject faithful fakes\n  at every third-party adapter boundary\n- Sign-in uses the actual login UI, not a session backdoor\n- Assert on user-visible content and navigated location, not internal DOM\u002Fimplementation details\n\n### 6. Run and Verify RED (Generated or Copied Acceptance\u002FSystem Specs)\n\nRun only the generated or copied specs needed to establish this feature's RED evidence through\n`ai-conductor scoped-run \u003Cselectors...>`. Select the specific spec files; do not run the whole\nacceptance directory or a full\u002Faggregate suite. The `test_suite` step owns configured suite\nverification after implementation.\n\nConfirm tests fail for the **right reasons**. This is critical:\n\n**Acceptable pre-implementation failures** (the thing under test doesn't exist yet):\n- Routing\u002Fhandler-not-found, undefined symbol\u002Fname, missing table\u002Fmigration\n- `404 Not Found` — endpoint not implemented\n\n**Unacceptable failures (fix the spec):**\n- Test passes when it shouldn't, or fails with a wrong error (e.g., a validation error like\n  \"can't be blank\" when the spec expects \"not found\")\n- Syntax errors or typos in the spec\n\n**A test that fails for the wrong reason is not RED — it's broken.**\n\n**A skipped, deselected, or collection-errored spec is not RED either.** If the runner reports your\nnew specs as SKIPPED (e.g. a `pytest.importorskip` \u002F `skipif` for a missing testcontainer, service,\nor dependency), DESELECTED, or ERRORING at import\u002Fcollection, they never executed — a silent no-op,\nnot a failing test. Two rules follow:\n\n- **Run the command that actually includes the new specs.** Never scope the RED run to a unit-only\n  subset (e.g. `pytest tests\u002F` when the specs live under `spec\u002Fintegration\u002F`, or `npm test -- test\u002Funit`).\n  Select the generated or copied spec files themselves.\n- **Bring up the infrastructure the specs need** (containers, DB, Redis, services, env) so they\n  execute and FAIL for the right reason. A spec that only runs in CI but is skipped locally\u002Fin the\n  daemon is a gate hole: the build will be declared GREEN while the specs never ran, and CI (which\n  has the infra) then fails.\n\n**Record the RED evidence (gating, `specs-generated` only).** After the RED run, write\n`.pipeline\u002Facceptance-specs-red.json` for a feature with no active child, or\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-red.json` for the supplied active child, capturing the\nREAL result of running the feature's or child's own specs, so the harness can verify they actually\nexecuted — not merely that spec files exist on disk:\n\n```json\n{\n  \"outcome\": \"specs-generated\",\n  \"command\": \"cd backend && pytest spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\",\n  \"targetSpecs\": [\"spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\"],\n  \"executed\": 5,\n  \"passed\": 0,\n  \"failed\": 5,\n  \"skipped\": 0,\n  \"errors\": 0,\n  \"failingTests\": [\n    {\n      \"name\": \"returns the archived filing\",\n      \"reason\": \"the archive endpoint is not implemented\"\n    }\n  ],\n  \"ranAt\": \"2026-08-10T12:00:00.000Z\",\n  \"intentRationale\": \"The failing endpoint proves the requested archive behavior is not implemented.\",\n  \"summary\": \"5 failed in 12.3s\"\n}\n```\n\nCounts are for the feature's own specs from the run above (`executed` = passed + failed). The\n`acceptance_specs` gate REJECTS the step unless this file shows `failed >= 1`, `skipped == 0`,\n`errors == 0`, and `executed >= 1`. A run where the new specs were skipped, deselected, or errored\nat collection does not establish RED and will not pass the gate. The marker must also identify at\nleast one failing test with its failure reason, record when the run occurred (`ranAt`), and state\nwhy the observed failure proves the feature remains unimplemented (`intentRationale`). This is\ngitignored run evidence, not a committed design artifact.\n\n#### Record the FR coverage evidence (gating)\n\n**Scope:** this subsection runs only for product-track work with an approved PRD (the same\ncondition as §3e). If the work is technical-track or no approved PRD exists, skip this\nsubsection entirely — no evidence file is written, no error.\n\n**Finalize the §3e table.** Before writing the evidence file, verify every row is actually\ncorrect, not just internally consistent:\n- For each `existing-sufficient-test` or `acceptance-system-spec` row, confirm the cited spec\u002Ftest\n  file **exists on disk** and, for `acceptance-system-spec` rows, **contains the FR identifier** — run\n  `grep -E \"FR-N\"` (substituting the real FR number) against the cited file and confirm a match.\n- For each `planned-lower-layer-test` row, confirm the cited implementation task and intended test\n  are present in the plan.\n- Re-check that every `FR-N` in the PRD has exactly one row, no invented rows exist, and every\n  disposition is one of the closed set (`existing-sufficient-test`,\n  `planned-lower-layer-test`, `acceptance-system-spec`).\n\n**Write `.pipeline\u002Ffr-coverage.md`** with this format:\n\n```markdown\n# FR Coverage — \u003Cfeature-stem>\n\nPRD: .docs\u002Fspecs\u002F\u003Cfeature-stem>.md\nDate: \u003CYYYY-MM-DD>\n\n| FR   | Disposition    | Evidence                                              |\n|------|----------------|--------------------------------------------------------|\n| FR-1 | acceptance-system-spec  | spec\u002Fintegration\u002Flinks_spec.rb — \"expired link\" |\n| FR-2 | planned-lower-layer-test | plan Task 4 — request test for invalid link input |\n| FR-3 | existing-sufficient-test | spec\u002Frequests\u002Flinks_spec.rb:42                   |\n\nCoverage: COMPLETE\n```\n\nThe verdict line is the last line of the file:\n- **`Coverage: COMPLETE`** — every FR in the PRD has exactly one row, a valid disposition, a\n  citation, and the citation was verified to exist (and, where applicable, to contain the FR\n  identifier or match the story file).\n- **`Coverage: INCOMPLETE — unresolved: FR-N, FR-M...`** — list every FR that failed\n  verification, in ascending order, comma-separated.\n\n**GATE.** If any FR is unresolved (missing row, invented row, bad or duplicate disposition,\nmissing or unverifiable citation) or `.pipeline\u002Ffr-coverage.md` cannot be written, the step MUST\nNOT report success — output the failure reason listing every unresolved FR with its cause and\nstop (a hard stop under the daemon, not a logged warning).\n\nOn complete resolution, report the task as PASS with the evidence file written and the verdict\n\"Coverage: COMPLETE\".\n\nFor `disposition-only`, write only this outcome record instead; it must contain no RED counters,\nrun command, target specs, exception, or other generated-spec fields:\n\n```json\n{\n  \"outcome\": \"disposition-only\",\n  \"dispositions\": [\n    {\n      \"criterion\": \"happy: reports the persisted result\",\n      \"disposition\": \"existing-sufficient-test\",\n      \"citation\": \"test\u002Fengine\u002Fresult.test.ts:42\"\n    },\n    {\n      \"criterion\": \"negative: rejects a missing result\",\n      \"disposition\": \"planned-lower-layer-test\",\n      \"citation\": \".docs\u002Fplans\u002F\u003Cfeature-stem>.md:88\",\n      \"owningTask\": \"Task 5\",\n      \"layer\": \"engine\"\n    }\n  ]\n}\n```\n\n#### Record the run contract (deterministic RED backstop, `specs-generated` only)\n\n**Write `.pipeline\u002Facceptance-specs-run.json` before reporting complete for a feature with no\nactive child; write `.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-run.json` for the supplied active\nchild.** It is the exact, machine-replayable command the engine uses to redrive RED later.\n\nShape — exactly three fields, matching the command actually run in this step:\n\n```json\n{\n  \"command\": \"cd backend && pytest spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\",\n  \"cwd\": \"backend\",\n  \"targetSpecs\": [\"spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\"]\n}\n```\n\n- `command` — the full shell command used to run this feature's own specs (same command as the\n  RED run above).\n- `cwd` — the working directory the command must be run from, relative to the repo root\n  (`\".\"` if the command is run from the repo root itself).\n- `targetSpecs` — the spec file(s)\u002Fpath(s) the command targets, matching `targetSpecs` in\n  `acceptance-specs-red.json`.\n\nThe command's output must finish with exactly one machine-readable evidence line so the engine can\nreplay it without guessing framework-specific text:\n\n```text\nACCEPTANCE_RED_EVIDENCE: {\"executed\":5,\"passed\":0,\"failed\":5,\"skipped\":0,\"errors\":0,\"failingTests\":[{\"name\":\"returns the archived filing\",\"reason\":\"the archive endpoint is not implemented\"}],\"intentRationale\":\"The failing endpoint proves the requested archive behavior is not implemented.\"}\n```\n\nA command that does not emit valid evidence is refused. Write this file **after** the RED run\nsucceeds and **before** reporting the step complete.\n\n### Stubbing Rules for Pre-Implementation Specs\n\n- Stub at **system boundaries only**: randomness sources, the clock\u002Fcurrent time, external API\n  clients, environment variables\u002Fconfig.\n- Never stub internal methods (private callbacks, service internals) — they don't exist yet and\n  coupling to them breaks on implementation.\n- Example of a correct boundary stub: freeze the clock, or pin the random generator to a known\n  value, using the framework's idiomatic stub\u002Fmock facility.\n\n### 7. Commit the Failing Tests (`specs-generated` only)\n\n```bash\ngit add \u003Cacceptance test dir> \u003Ctest support dir>   # paths per the project's layout\ngit commit -m \"test: add failing acceptance specs for [feature area]\"\n```\n\nFor `specs-generated`, failing tests get committed. They represent the acceptance criteria and\nimplementation (via `\u002Fpipeline` or `\u002Ftdd`) makes them pass. For `disposition-only`, do not commit\nan acceptance spec; the cited lower-layer task owns its genuine RED test and commit.\n\n## Verify\n\n- [ ] Every story's happy AND negative criterion has exactly one cited disposition:\n      `existing-sufficient-test`, `planned-lower-layer-test`, or `acceptance-system-spec`\n- [ ] Acceptance specs generated only for the assigned distinct multi-step externally observable\n      flows that cannot be proven sufficiently below\n- [ ] `.pipeline\u002Facceptance-specs-red.json` declares `specs-generated` or `disposition-only`\n- [ ] When `specs-generated`, an acceptance\u002Fsystem spec was EXECUTED, not just written —\n      a spec that never ran does not establish RED\n- [ ] When `specs-generated`, the real RED run's results are\n      recorded to `.pipeline\u002Facceptance-specs-red.json`\n      (command, targetSpecs, executed\u002Fpassed\u002Ffailed\u002Fskipped\u002Ferrors counts, failing-test identity,\n      `ranAt`, and `intentRationale`) — the\n      completion gate validates this file and rejects runs where the feature's own\n      specs were skipped, deselected, or errored at collection\n- [ ] When `specs-generated`, failures are for the RIGHT reason (missing implementation), not\n      import\u002Fsyntax\u002Fcollection errors\n- [ ] When `specs-generated`, specs use the project's own test framework and directory conventions\n- [ ] When `specs-generated`, the run contract is written to `.pipeline\u002Facceptance-specs-run.json` (command, cwd,\n      targetSpecs) before reporting complete — the deterministic RED backstop the engine's\n      self-heal runner consumes when the RED evidence marker is missing or misplaced\n","# Writing Acceptance Tests\n\n## Overview\n\nGenerate failing acceptance specs from user stories in `.docs\u002Fstories\u002F*.md`. Each acceptance\ncriterion (happy AND negative paths) receives a concrete coverage disposition. Only the criteria\nthat need acceptance\u002Fsystem coverage become generated specs; those specs are written BEFORE\nimplementation and are the RED phase of BDD.\n\n**Correctness gate:** a test encodes an expected-behavior claim. Per the `\u002Fverify-claims` protocol,\nif a spec rests on an assumption about what \"correct\" means that is not pinned by the story's\nacceptance criteria, the FR, or the ADR, surface it with its confidence and HARD-BLOCK for operator\napproval (HALT if autonomous) rather than freezing a guess into a passing\u002Ffailing assertion.\n\nThis skill is **language- and framework-agnostic.** It describes *what* acceptance tests to\nwrite and *why*; the concrete syntax, test runner, file layout, and fixture mechanism come\nfrom the project's own conventions. Detect those from the loaded tech-context (see\n`tech-context\u002F`) or from the existing test suite, and follow them — exactly as the `\u002Ftdd` skill\ndefers to \"stack test conventions.\"\n\n**Detect project shape and generate the right kind of acceptance test:**\n\n| Project Shape | Acceptance Test Type | Exercises |\n|---|---|---|\n| Headless \u002F API (no UI) | HTTP \u002F request-level acceptance tests | HTTP requests, status codes, serialized (JSON\u002FXML\u002Fetc.) responses |\n| Has a frontend \u002F full-stack | End-to-end (E2E) \u002F UI tests | A real UI driver — browser, native, or TUI — navigation and user-visible assertions |\n\n**The test framework and paths are the project's, not this skill's.** Place and name specs per\nthe project's conventions. Illustrative mappings (adapt to whatever the project actually uses):\n\n| Stack | HTTP-level acceptance | E2E \u002F UI |\n|---|---|---|\n| Ruby + RSpec | `spec\u002Fintegration\u002F` (`type: :request`) | `spec\u002Fsystem\u002F` (Capybara) |\n| Python + pytest | `tests\u002Fintegration\u002F` (httpx\u002Frequests) | `tests\u002Fe2e\u002F` (Playwright\u002FSelenium) |\n| JS\u002FTS + Jest\u002FVitest | `test\u002Fintegration\u002F` (supertest) | `test\u002Fe2e\u002F` (Playwright\u002FCypress) |\n| Go | `*_integration_test.go` (`net\u002Fhttp\u002Fhttptest`) | `e2e\u002F` (chromedp\u002Frod) |\n\n## Process\n\n### Stacked-Child Scope\n\nWhen this step is dispatched for a stacked feature's active child, the dispatch supplies the child\nidentifier `\u003Ck>`, its owned stories and criteria, and (except for the first child) the supplied\nparent closure tip. Cover **only the supplied owned stories**: derive dispositions, search for\nexisting proof, generate or copy specs, and select the RED run only for those stories and their\ncriteria. Do not use another child's stories or criteria to fill, omit, or justify this child's\ncoverage.\n\nFor that child, write the RED marker at\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-red.json` and its run contract at\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-run.json`. These files belong to the supplied child;\ndo not read, replace, or reuse another child's evidence.\n\nIf an owned spec already passes because the supplied parent closure tip already contains the\nbehavior, do not manufacture a failure. Record the genuine run and its `prior-child-green`\nexception in the child RED marker. Set the exception attribution to the **supplied parent closure\ntip** so the engine can verify that the earlier child, rather than an ungrounded assumption,\nexplains the passing result. All other execution requirements still apply.\n\nFor a feature with no active child, retain the flat behavior: cover its feature stories and write\n`.pipeline\u002Facceptance-specs-red.json` and `.pipeline\u002Facceptance-specs-run.json` unchanged.\n\n### 1. Detect Project Type\n\nFirst, determine the **test framework, runner, and directory layout** from the loaded\ntech-context or, if none, by inspecting the existing test suite (test directories, config files\nlike `package.json`\u002F`pyproject.toml`\u002F`Gemfile`\u002F`go.mod`, and how current tests are written).\nMatch those conventions — do not impose a foreign layout.\n\nThen determine **project shape** to pick the acceptance test type:\n\n- A frontend exists (server-rendered templates, an SPA, a mobile\u002Fdesktop UI, or a TUI) →\n  **Full-stack** → end-to-end \u002F UI tests driven through a real UI driver.\n- No UI; a service, API, library, or CLI only → **Headless** → HTTP\u002Frequest-level acceptance\n  tests (or, for a library\u002FCLI, public-interface \u002F command-invocation acceptance tests).\n\n### 2. Check for Missing Acceptance Specs\n\nFor **every** happy and negative criterion in every story, record one concrete coverage\ndisposition before writing a spec. This applies on both the product and technical tracks:\n\n- **`existing-sufficient-test`** — a named existing behavioral test already proves the criterion\n  at a sufficient layer. Cite its path and test name\u002Fline.\n- **`planned-lower-layer-test`** — a named behavioral test assigned to the implementation task\n  will prove the criterion sufficiently below the acceptance layer. Cite the plan task and the\n  intended request\u002Fendpoint, command\u002Fpublic-interface, or unit\u002Fdomain test.\n- **`acceptance-system-spec`** — this pass will write and execute an acceptance\u002Fsystem spec for a\n  distinct multi-step externally observable flow that cannot be proven sufficiently below. Cite\n  the target spec and flow.\n\nThe disposition is about the behavior and its failure boundary, not the directory label of a test.\nA request-level test can be sufficient for a public command or endpoint contract; a test under an\n`integration` directory is not automatically acceptance coverage. Negative permutations remain at\nthe lower layer when that layer proves the observable failure sufficiently. Do not elevate each\nnegative permutation merely to populate an acceptance suite.\n\nEvery criterion must have exactly one disposition and its cited proof or assigned test. If a\ncriterion has neither existing proof nor a specific planned\u002Fgenerated test, block this step and\nreport the criterion; do not silently omit it or create a speculative spec. Ordinary changes to\nskill prose and the existence, creation, or modification of a production file do not themselves\ncreate behavioral criteria or require a test.\n\nRecord the criterion dispositions and citations in this step's report. On the product track, the\nFR table in §3e additionally maps the same record to approved functional requirements; it does not\nreplace the all-track criterion check.\n\nOnly after this disposition pass, compare the `acceptance-system-spec` criteria against the\nproject's existing acceptance specs in its established layout. Generate only the uncovered flows.\n\n### 2a. Declared Pattern Replication\n\nWhen the active plan's header resolves a complete `**Pattern-source:**` and\n`**Rename-map:**` declaration, `acceptance_specs` **copies rather than derives** the source\nfeature's acceptance specs. This replacement applies only to a resolved declaration; with no\ndeclaration, derive specs from the stories exactly as this skill otherwise requires.\n\nCopy each source spec to its rename-map-derived target path, applying the map to its filename and\ncontent.\n\nLocate the source feature's acceptance specs using the project's established acceptance-spec\nlayout. For each source spec, apply the ordered Rename-map to both its relative path (including\nthe filename) and its content, then write the resulting target spec. Run those copied specs at\n`acceptance_specs` time before continuing.\n\nBefore writing, enumerate the source acceptance-spec glob and all derived target paths. If the\nsource acceptance spec set is empty, fail closed: report the declared Pattern-source and the\nacceptance-spec glob that found no specs, and never fall back to derivation. If two source specs\nderive the same target-path collision, fail closed before any write rather than overwriting either\ntarget. These are declaration-copy failures, not reasons to resume the ordinary derivation path.\n\nThe copied run earns RED only when its failure includes at least one copied spec failing because\nthe target does not yet exist, with a non-zero failure count and zero errors and zero skips. Record\nthat real result using the existing §6 RED-evidence contract. Never fall back to derivation after a\ndeclaration has resolved: copied specs are the feature's acceptance coverage for this step.\n\nIf all copied specs pass, fail closed and report the passing specs by path. A fully passing copied\nset establishes neither the required missing-target RED failure nor evidence that the copied tests\nexercise the new target; do not treat it as successful RED evidence.\n\n**Find existing sufficient proof:** Before generating, search the existing test suite for each\ncriterion's behavior and failure boundary (for example, function\u002Fmethod names, status codes, and\nerror messages). A keyword hit alone is not proof: confirm the test asserts the expected behavior.\nIf it does — unit, request\u002Fendpoint, command\u002Fpublic-interface, or prior acceptance spec — assign\n`existing-sufficient-test` and do not generate a duplicate.\n\nConcrete search: `grep -rE \"criterion keyword\" \u003Cthe project's test directories>`. Record the\ncriterion's disposition and citation; this record, rather than a count of generated specs, proves\nnothing was missed.\n\n### No Legitimate Acceptance-Spec RED for Already-Existing Behavior\n\nFor a plan-marked verify-only\u002Fverification task, generate at most the documenting acceptance spec\nexplicitly requested by the plan. Outside such a task, no acceptance spec is invented for\nalready-existing behavior just to manufacture a RED result.\n\nIf investigation discovers that behavior already exists but the sealed plan did not mark the task\nverify-only\u002Fverification, follow `\u002Ftdd`'s **No Legitimate RED for Already-Existing Behavior**\ndiscovered-case exit. Do not amend the sealed plan or retain a redundant acceptance spec. This\nboundary never applies to work that adds, changes, or fixes behavior.\n\n**End-to-end internally; fake third parties:** Acceptance specs test the real application entry\npoint and internal system. Do NOT mock internal infrastructure (database, queues, caches,\nbackground jobs). Replace every **third-party external service** (LLM providers, hosted APIs,\nGitHub, payment APIs, email providers, external webhooks, package registries) with a faithful fake\nthrough the production adapter seam. If locally controlled infrastructure is unavailable in the\ntest environment, configure the test environment to provide it — don't mock it away. Calls to a\nreal third party belong only in an explicitly named, opt-in smoke test that is excluded from the\ndefault suite and CI.\n\n### 2.5. Schema Consistency Check\n\nBefore generating specs, compare model\u002Fentity column definitions against migration files:\n- Check that column names in models match column names in migrations (e.g., `external_id` in\n  model vs `external_reference_id` in migration is a mismatch)\n- Check that column types match (e.g., `payload` string vs `request_payload`\u002F`response_payload`\n  split columns)\n- If the project uses fake\u002Fstub column definitions (e.g., `fake_columns.rb`), verify those\n  match the real migration definitions\n\n**Do not generate specs from inconsistent schemas — resolve the mismatch first.** Specs\ngenerated against a mismatched schema will either pass incorrectly or fail for the wrong reason.\n\n### 3. Parse Acceptance Criteria\n\nExtract from each story file:\n- Feature area name (H1 or filename)\n- Story titles (H2)\n- Happy path criteria (Given\u002FWhen\u002FThen under Happy Path heading)\n- Negative path criteria (Given\u002FWhen\u002FThen under Negative Paths heading)\n\n**Both happy AND negative paths need a coverage disposition.** Negative paths are not optional;\nwhen a lower-layer behavioral test is sufficient, assign it there rather than duplicating it above.\n\n**Derive specs from stories, not code.** Extract field names, value types, and expected\nbehaviors from the story acceptance criteria TEXT — not from existing implementation code.\nIf the story says `refresh_token`, the spec must use `refresh_token` even if the current\ncode uses `token`. The spec defines what SHOULD exist, not what DOES exist.\n\n### 3.5. Domain Alignment Check\n\nBefore generating specs, compare field names and context keys used in generated specs against\nthe story language. Flag any spec that uses implementation-derived names instead of\nstory-specified names. This catches cases where code conventions diverge from domain language\n(e.g., builder context key `token` vs story's `refresh_token`, model field `payload` vs\nstory's `request_payload`).\n\n### 3a. Classify Behavioral Scope\n\nFor each criterion, decide the lowest layer that can prove its behavior. Generate an\nacceptance\u002Fsystem spec only when the criterion belongs to a **distinct multi-step externally\nobservable flow** that a lower-layer behavioral test cannot prove sufficiently. Typical examples\nare create → assign → observe an outcome, or configure → invoke → observe an externally visible\nresult. The operations need not be HTTP endpoints; use the project's actual public interface.\n\nSingle operations and their validation\u002Ferror permutations normally receive\n`planned-lower-layer-test` coverage through `\u002Ftdd` — for example, a request\u002Fendpoint, command, or\ndomain test. A multi-step sequence does not automatically need an acceptance spec if a lower-layer\nbehavioral test can already prove the relevant observable flow. Conversely, a multi-step external\nflow that cannot be proven below receives `acceptance-system-spec` even if the project's directory\nname would normally suggest another label.\n\nIf no criterion needs `acceptance-system-spec`, generate no acceptance specs. The disposition\nrecord must still show sufficient existing proof or a specific lower-layer assignment for every\nhappy and negative criterion. This avoids duplicate acceptance coverage without treating any\ncriterion as optional. Record `outcome: \"disposition-only\"` in\n`.pipeline\u002Facceptance-specs-red.json` with an exhaustive `dispositions` array: each record names\none happy or negative criterion and is exactly either `existing-sufficient-test` with a verifiable\ntest `citation`, or `planned-lower-layer-test` with a verifiable plan `citation`, `owningTask`, and\n`layer`. Do not fabricate an acceptance RED run in this case: the assigned lower-layer test must\nproduce its genuine RED evidence during `\u002Ftdd`, and no acceptance run contract or failing-spec\ncommit is written. Whenever this step copies or generates an acceptance\u002Fsystem spec, record\n`outcome: \"specs-generated\"`; §6's executable RED machinery remains mandatory.\n\n### 3b. Replacement Tasks: Drive the REAL Entry Point\n\nWhen a task **replaces or supersedes existing behavior** (the plan says \"replace X\",\n\"supersede Y\", \"swap the old path for the new\"), the new code is only correct if the\nPRODUCTION entry point actually calls it. A unit test that invokes the new function\n*directly* passes even while the live path still calls the old one — the new primitive\nships orphaned (zero production callers).\n\n**Rule:** for any replacement task, assign **≥1 behavioral test at the lowest sufficient layer**\nthat drives the real production entry point (the command \u002F handler \u002F route \u002F loop a user or caller\nactually invokes) — NOT the new unit under test — and asserts the **observable artifact** the\nreplacement is supposed to produce (file written, PR opened, gate enforced, record persisted).\nUse `acceptance-system-spec` only when this is a distinct multi-step externally observable flow\nthat cannot be proven below; otherwise assign a specific lower-layer behavioral test. The test\nmust fail if the entry point is still wired to the OLD behavior.\n\n- Identify the real entry point from the story\u002Fplan (\"when `dispatchEngineer({ kind: 'land' })`\n  lands a spec…\"), not the new helper symbol (\"when `landSpec` is called…\").\n- Assert the side effect, not the return value of the new unit.\n- Pair with the `\u002Fpipeline` batch gate that greps the superseded symbol for zero non-test\n  callers: the acceptance test proves the new path runs; the grep proves the old one is gone.\n\n### 3c. Boundary-Value Checklist for Path \u002F Prefix Guards\n\nAny spec covering a **path, prefix, or canonical-root guard** (an allow\u002Fdeny check on a\nfilesystem path or string prefix) MUST include explicit boundary-value cases. Off-by-one\nnormalization bugs in these guards fail *closed* (reject everything) or *open* (accept a\nsibling) and are invisible to happy-path tests.\n\nGenerate a negative\u002Fboundary case for EACH row:\n\n| Boundary | Example input | Expected |\n|---|---|---|\n| Trailing slash | `\u003Croot>\u002Frepo\u002F` vs canonical `\u003Croot>\u002Frepo` | normalized equal — write allowed |\n| Root path | filesystem root | guarded, never a wildcard |\n| Empty string | `\"\"` | rejected, no crash |\n| Sibling-prefix | `\u003Croot>\u002Frepo-evil` vs allowed `\u003Croot>\u002Frepo` | rejected (prefix ≠ path segment) |\n\nA path-guard spec without these rows is incomplete — treat them as mandatory negative paths.\n\n### 3d. Adversarial Derivation Coverage: Every Call Site, Real Input\n\n§3b (replacement → real entry point) and §3c (path guards → boundary values) are two cases of a\nwider rule. For **any security- or correctness-critical derivation** — a redaction\u002Fsanitizer, an\nauth\u002Fpermission predicate, an identity or path check, a state guard (\"is the tree clean\", \"is this\nthe right session\", \"has this been processed\") — a unit test that exercises the derivation on\n**clean or hand-injected** input passes while the REAL production call site feeds it adversarial\nreal-world input that is never tested. The bug lives in the *wiring between the call site and the\nderivation*, which the derivation's own unit test cannot reach.\n\n**Rule:** for each such derivation, enumerate **EVERY production call site** that invokes it, and\nassign a failing behavioral test **per call site** at the lowest sufficient layer that:\n\n- feeds the **real adversarial input that site actually passes** — a URL carrying a real token, a\n  path with a trailing slash \u002F sibling prefix \u002F traversal segment, a dirty or stale tree state, an\n  empty or boundary value — **not** a clean fixture or a value injected directly into the helper, and\n- asserts the **observable guarantee at that site** — the token never appears in the emitted output,\n  the write is refused, the step HALTs, the duplicate is skipped — **not** the derivation's return\n  value in isolation.\n\nA derivation covered only by its own unit test is incomplete. List the call sites you found\n(`file:line`) in the assigned test file or the PR body so the domain reviewer (TDD) can confirm none were\nmissed.\n\n### 3e. FR Coverage Mapping (Product Track)\n\n**Scope:** this section runs only when both are true — the work is on the **product track**\nand an **approved PRD** exists for the feature. If either condition is false (technical track,\nor no approved PRD), skip this section entirely.\n\n- **If a PRD exists but `Status: Approved` is not in the file:** do NOT build a table from an\n  unapproved FR list — report the task as **FAILED** with the reason \"PRD found but not\n  approved; cannot gate on incomplete FR list.\" This surfaces the missing approval as a\n  pipeline error rather than a silent no-op.\n\nParse the PRD's enumerated functional requirements (the `FR-N` list). Build a coverage table\nwith **exactly one row per FR** — every `FR-N` in the PRD must appear exactly once, and no row\nmay reference an `FR-N` that isn't in the PRD. A table that omits an FR or invents one not\npresent in the PRD is invalid and must be corrected before proceeding.\n\nFor each FR row, derive exactly one disposition from the criterion record's **closed set**:\n\n- **`existing-sufficient-test`** — maps to §2. The FR's behavior is asserted by a cited existing\n  behavioral test at a sufficient layer.\n- **`planned-lower-layer-test`** — maps to §3a. The cited implementation task owns the specific\n  lower-layer behavioral test that will prove the FR.\n- **`acceptance-system-spec`** — the FR is covered by a generated (or declared-copy) acceptance\u002F\n  system spec in this pass (§5a\u002F§5b).\n\nNo disposition outside this closed set (`existing-sufficient-test`,\n`planned-lower-layer-test`, `acceptance-system-spec`) is permitted.\n\n**Citation requirement:** every row must cite the evidence for its disposition:\n- `existing-sufficient-test` → cite the existing test file\u002Fline found by the §2 search.\n- `planned-lower-layer-test` → cite the implementation plan task and intended test.\n- `acceptance-system-spec` → cite the generated spec file (and test name) that covers it.\n\n**Unresolved rows are flagged as errors.** A row is unresolved — and must be flagged rather than\nsilently accepted — if any of the following hold:\n- it has 2 or more dispositions assigned (ambiguous),\n- its disposition isn't one of the three closed-set values,\n- it has no citation.\n\nUnresolved rows block completion of this step; resolve them (re-classify, find the missing\ncitation, or split the ambiguous row) before moving to §4.\n\n### 4. Read App Context\n\nFor each story, read the project's equivalents of:\n- **Routing \u002F endpoint definitions** — the route table, URL config, or handler registration that\n  lists available paths and their names.\n- **Request handlers \u002F controllers** — response formats, auth requirements, middleware\u002Ffilters.\n- **Data models \u002F schema** — validations, relations, enums (for fixture\u002Ffactory setup).\n- **Existing fixtures, factories, or test-data builders** — reuse them, don't duplicate.\n\nIf routes\u002Fmodels don't exist yet (pre-implementation), write tests using the expected paths and\nnames from the stories. Tests will fail with routing\u002Fhandler-not-found, undefined-symbol, or\nmissing-table errors — this is correct RED behavior.\n\n### 5a. Generate HTTP \u002F Request-Level Acceptance Specs (Headless \u002F API Projects)\n\n**File mapping:** `.docs\u002Fstories\u002Flinks.md` → the project's acceptance spec for that area\n(e.g. `spec\u002Fintegration\u002Flinks_spec.rb`, `tests\u002Fintegration\u002Ftest_links.py`,\n`test\u002Fintegration\u002Flinks.test.ts`).\n\nAcceptance test of a multi-step flow, expressed as framework-neutral structure (write it in the\nproject's actual framework and assertion style):\n\n```\nSUITE \"Link lifecycle\":\n  STORY \"Create and use a short link\":\n    HAPPY PATH \"creates a link, redirects via short code, records a click\":\n      POST \u002Flinks  { original_url: \"https:\u002F\u002Fexample.com\" }   (with auth)\n      short_code ← response.body.link.short_code\n      GET \u002F\u003Cshort_code>\n      EXPECT redirect → \"https:\u002F\u002Fexample.com\"\n    NEGATIVE \"expired link\":\n      # create link, advance clock past expiry\n      GET \u002F\u003Cshort_code>  →  EXPECT 410 Gone\n```\n\n**Key distinction: acceptance specs test FLOWS, not endpoints\u002Foperations.**\n\nAn acceptance spec that only hits one endpoint is usually a request\u002Fendpoint test wearing a\ncostume. If it does not prove a distinct multi-step externally observable flow that cannot be\nproven sufficiently below, it belongs in the lower behavioral layer instead.\n\n| Test proves one operation or negative permutation sufficiently | → lower-layer behavioral test |\n| Test proves a distinct multi-step external flow no lower layer can prove | → acceptance\u002Fsystem spec (this skill) |\n| Test verifies model\u002Fdomain logic directly | → unit test |\n\n**This avoids duplication.** Request\u002Fendpoint tests own individual endpoint behavior (status\ncodes, error formats, params validation). Acceptance specs own the story flow (create → use →\nverify outcome). Neither duplicates the other.\n\n**Rules for acceptance specs:**\n- Test multi-step flows that map to stories, not individual endpoints\n- One group per story, one sub-group per happy\u002Fnegative path (per the framework's grouping idiom)\n- Each test is independent — creates its own data via factories\u002Ffixtures\n- Assert outcomes, not intermediate transport details (request\u002Fendpoint tests own those)\n- Auth uses helper methods, not hardcoded tokens\n- Exercise the real internal flow; inject faithful fakes at all third-party adapter boundaries\n- Every generated spec must declare feature coverage in a leading comment line. Where the active\n  stories or plan are available, use resolvable `Covers: S\u003Cn>.\u003Cm>[, task:\u003Cid>]` markers (technical\n  and product tracks alike); the marker must name a criterion in the active stories or a task in the\n  active plan. Criterion ids are positional: `S\u003Cn>.\u003Cm>` is the m-th Given\u002FWhen\u002FThen bullet of Story n,\n  counting happy-path bullets first and then negative-path bullets — story files never carry literal\n  ids. On the product track, also retain `Covers: FR-N[, FR-M]` for PRD coverage reporting.\n  The generated marker must be introduced or updated in the active feature diff. An unchanged bare\n  marker inherited from the review base remains owned by the earlier feature and cannot authorize\n  an active-plan task or criterion merely because its ordinal collides.\n  Do not use a test path as a substitute for a Covers marker.\n\n**Helpers:** Create shared request helpers (e.g. response-body parsing and auth-header\nconstruction) in the project's test-support location if they don't already exist.\n\n### 5b. Generate End-to-End \u002F UI Specs (Full-Stack Projects)\n\nDeclare coverage with the same `Covers:` markers as §5a, including `Covers: FR-N` on the product track.\n\n**File mapping:** `.docs\u002Fstories\u002Fauth.md` → the project's E2E spec for that area\n(e.g. `spec\u002Fsystem\u002Fauth_spec.rb`, `tests\u002Fe2e\u002Ftest_auth.py`, `test\u002Fe2e\u002Fauth.spec.ts`).\n\nE2E test of a user flow, expressed as framework-neutral structure (write it with the project's\nactual UI driver and assertion style):\n\n```\nSUITE \"Authentication\" (driven through a real UI driver):\n  STORY \"User Registration\":\n    HAPPY PATH \"registers with valid email and password\":\n      visit  \u003Cnew registration screen>\n      fill   \"Email\" = \"user@example.com\",  set a valid password\n      submit the form\n      EXPECT visible text \"Welcome\"\n    NEGATIVE \"duplicate email\":\n      seed an existing user with \"taken@example.com\"\n      visit  \u003Cnew registration screen>\n      fill   \"Email\" = \"taken@example.com\",  submit\n      EXPECT visible text \"already taken\"\n```\n\n**Rules for E2E \u002F UI specs:**\n- Every criterion assigned `acceptance-system-spec` gets concrete driver code — no stubs, no\n  `pending`\u002Fskipped placeholders\n- Each test is independent — creates its own data, signs in if needed\n- Do not mock the application stack or locally controlled infrastructure; inject faithful fakes\n  at every third-party adapter boundary\n- Sign-in uses the actual login UI, not a session backdoor\n- Assert on user-visible content and navigated location, not internal DOM\u002Fimplementation details\n\n### 6. Run and Verify RED (Generated or Copied Acceptance\u002FSystem Specs)\n\nRun only the generated or copied specs needed to establish this feature's RED evidence through\n`ai-conductor scoped-run \u003Cselectors...>`. Select the specific spec files; do not run the whole\nacceptance directory or a full\u002Faggregate suite. The `test_suite` step owns configured suite\nverification after implementation.\n\nConfirm tests fail for the **right reasons**. This is critical:\n\n**Acceptable pre-implementation failures** (the thing under test doesn't exist yet):\n- Routing\u002Fhandler-not-found, undefined symbol\u002Fname, missing table\u002Fmigration\n- `404 Not Found` — endpoint not implemented\n\n**Unacceptable failures (fix the spec):**\n- Test passes when it shouldn't, or fails with a wrong error (e.g., a validation error like\n  \"can't be blank\" when the spec expects \"not found\")\n- Syntax errors or typos in the spec\n\n**A test that fails for the wrong reason is not RED — it's broken.**\n\n**A skipped, deselected, or collection-errored spec is not RED either.** If the runner reports your\nnew specs as SKIPPED (e.g. a `pytest.importorskip` \u002F `skipif` for a missing testcontainer, service,\nor dependency), DESELECTED, or ERRORING at import\u002Fcollection, they never executed — a silent no-op,\nnot a failing test. Two rules follow:\n\n- **Run the command that actually includes the new specs.** Never scope the RED run to a unit-only\n  subset (e.g. `pytest tests\u002F` when the specs live under `spec\u002Fintegration\u002F`, or `npm test -- test\u002Funit`).\n  Select the generated or copied spec files themselves.\n- **Bring up the infrastructure the specs need** (containers, DB, Redis, services, env) so they\n  execute and FAIL for the right reason. A spec that only runs in CI but is skipped locally\u002Fin the\n  daemon is a gate hole: the build will be declared GREEN while the specs never ran, and CI (which\n  has the infra) then fails.\n\n**Record the RED evidence (gating, `specs-generated` only).** After the RED run, write\n`.pipeline\u002Facceptance-specs-red.json` for a feature with no active child, or\n`.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-red.json` for the supplied active child, capturing the\nREAL result of running the feature's or child's own specs, so the harness can verify they actually\nexecuted — not merely that spec files exist on disk:\n\n```json\n{\n  \"outcome\": \"specs-generated\",\n  \"command\": \"cd backend && pytest spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\",\n  \"targetSpecs\": [\"spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\"],\n  \"executed\": 5,\n  \"passed\": 0,\n  \"failed\": 5,\n  \"skipped\": 0,\n  \"errors\": 0,\n  \"failingTests\": [\n    {\n      \"name\": \"returns the archived filing\",\n      \"reason\": \"the archive endpoint is not implemented\"\n    }\n  ],\n  \"ranAt\": \"2026-08-10T12:00:00.000Z\",\n  \"intentRationale\": \"The failing endpoint proves the requested archive behavior is not implemented.\",\n  \"summary\": \"5 failed in 12.3s\"\n}\n```\n\nCounts are for the feature's own specs from the run above (`executed` = passed + failed). The\n`acceptance_specs` gate REJECTS the step unless this file shows `failed >= 1`, `skipped == 0`,\n`errors == 0`, and `executed >= 1`. A run where the new specs were skipped, deselected, or errored\nat collection does not establish RED and will not pass the gate. The marker must also identify at\nleast one failing test with its failure reason, record when the run occurred (`ranAt`), and state\nwhy the observed failure proves the feature remains unimplemented (`intentRationale`). This is\ngitignored run evidence, not a committed design artifact.\n\n#### Record the FR coverage evidence (gating)\n\n**Scope:** this subsection runs only for product-track work with an approved PRD (the same\ncondition as §3e). If the work is technical-track or no approved PRD exists, skip this\nsubsection entirely — no evidence file is written, no error.\n\n**Finalize the §3e table.** Before writing the evidence file, verify every row is actually\ncorrect, not just internally consistent:\n- For each `existing-sufficient-test` or `acceptance-system-spec` row, confirm the cited spec\u002Ftest\n  file **exists on disk** and, for `acceptance-system-spec` rows, **contains the FR identifier** — run\n  `grep -E \"FR-N\"` (substituting the real FR number) against the cited file and confirm a match.\n- For each `planned-lower-layer-test` row, confirm the cited implementation task and intended test\n  are present in the plan.\n- Re-check that every `FR-N` in the PRD has exactly one row, no invented rows exist, and every\n  disposition is one of the closed set (`existing-sufficient-test`,\n  `planned-lower-layer-test`, `acceptance-system-spec`).\n\n**Write `.pipeline\u002Ffr-coverage.md`** with this format:\n\n```markdown\n# FR Coverage — \u003Cfeature-stem>\n\nPRD: .docs\u002Fspecs\u002F\u003Cfeature-stem>.md\nDate: \u003CYYYY-MM-DD>\n\n| FR   | Disposition    | Evidence                                              |\n|------|----------------|--------------------------------------------------------|\n| FR-1 | acceptance-system-spec  | spec\u002Fintegration\u002Flinks_spec.rb — \"expired link\" |\n| FR-2 | planned-lower-layer-test | plan Task 4 — request test for invalid link input |\n| FR-3 | existing-sufficient-test | spec\u002Frequests\u002Flinks_spec.rb:42                   |\n\nCoverage: COMPLETE\n```\n\nThe verdict line is the last line of the file:\n- **`Coverage: COMPLETE`** — every FR in the PRD has exactly one row, a valid disposition, a\n  citation, and the citation was verified to exist (and, where applicable, to contain the FR\n  identifier or match the story file).\n- **`Coverage: INCOMPLETE — unresolved: FR-N, FR-M...`** — list every FR that failed\n  verification, in ascending order, comma-separated.\n\n**GATE.** If any FR is unresolved (missing row, invented row, bad or duplicate disposition,\nmissing or unverifiable citation) or `.pipeline\u002Ffr-coverage.md` cannot be written, the step MUST\nNOT report success — output the failure reason listing every unresolved FR with its cause and\nstop (a hard stop under the daemon, not a logged warning).\n\nOn complete resolution, report the task as PASS with the evidence file written and the verdict\n\"Coverage: COMPLETE\".\n\nFor `disposition-only`, write only this outcome record instead; it must contain no RED counters,\nrun command, target specs, exception, or other generated-spec fields:\n\n```json\n{\n  \"outcome\": \"disposition-only\",\n  \"dispositions\": [\n    {\n      \"criterion\": \"happy: reports the persisted result\",\n      \"disposition\": \"existing-sufficient-test\",\n      \"citation\": \"test\u002Fengine\u002Fresult.test.ts:42\"\n    },\n    {\n      \"criterion\": \"negative: rejects a missing result\",\n      \"disposition\": \"planned-lower-layer-test\",\n      \"citation\": \".docs\u002Fplans\u002F\u003Cfeature-stem>.md:88\",\n      \"owningTask\": \"Task 5\",\n      \"layer\": \"engine\"\n    }\n  ]\n}\n```\n\n#### Record the run contract (deterministic RED backstop, `specs-generated` only)\n\n**Write `.pipeline\u002Facceptance-specs-run.json` before reporting complete for a feature with no\nactive child; write `.pipeline\u002Fchildren\u002F\u003Ck>\u002Facceptance-specs-run.json` for the supplied active\nchild.** It is the exact, machine-replayable command the engine uses to redrive RED later.\n\nShape — exactly three fields, matching the command actually run in this step:\n\n```json\n{\n  \"command\": \"cd backend && pytest spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\",\n  \"cwd\": \"backend\",\n  \"targetSpecs\": [\"spec\u002Fintegration\u002Ftest_017_sec_edgar_acceptance.py\"]\n}\n```\n\n- `command` — the full shell command used to run this feature's own specs (same command as the\n  RED run above).\n- `cwd` — the working directory the command must be run from, relative to the repo root\n  (`\".\"` if the command is run from the repo root itself).\n- `targetSpecs` — the spec file(s)\u002Fpath(s) the command targets, matching `targetSpecs` in\n  `acceptance-specs-red.json`.\n\nThe command's output must finish with exactly one machine-readable evidence line so the engine can\nreplay it without guessing framework-specific text:\n\n```text\nACCEPTANCE_RED_EVIDENCE: {\"executed\":5,\"passed\":0,\"failed\":5,\"skipped\":0,\"errors\":0,\"failingTests\":[{\"name\":\"returns the archived filing\",\"reason\":\"the archive endpoint is not implemented\"}],\"intentRationale\":\"The failing endpoint proves the requested archive behavior is not implemented.\"}\n```\n\nA command that does not emit valid evidence is refused. Write this file **after** the RED run\nsucceeds and **before** reporting the step complete.\n\n### Stubbing Rules for Pre-Implementation Specs\n\n- Stub at **system boundaries only**: randomness sources, the clock\u002Fcurrent time, external API\n  clients, environment variables\u002Fconfig.\n- Never stub internal methods (private callbacks, service internals) — they don't exist yet and\n  coupling to them breaks on implementation.\n- Example of a correct boundary stub: freeze the clock, or pin the random generator to a known\n  value, using the framework's idiomatic stub\u002Fmock facility.\n\n### 7. Commit the Failing Tests (`specs-generated` only)\n\n```bash\ngit add \u003Cacceptance test dir> \u003Ctest support dir>   # paths per the project's layout\ngit commit -m \"test: add failing acceptance specs for [feature area]\"\n```\n\nFor `specs-generated`, failing tests get committed. They represent the acceptance criteria and\nimplementation (via `\u002Fpipeline` or `\u002Ftdd`) makes them pass. For `disposition-only`, do not commit\nan acceptance spec; the cited lower-layer task owns its genuine RED test and commit.\n\n## Verify\n\n- [ ] Every story's happy AND negative criterion has exactly one cited disposition:\n      `existing-sufficient-test`, `planned-lower-layer-test`, or `acceptance-system-spec`\n- [ ] Acceptance specs generated only for the assigned distinct multi-step externally observable\n      flows that cannot be proven sufficiently below\n- [ ] `.pipeline\u002Facceptance-specs-red.json` declares `specs-generated` or `disposition-only`\n- [ ] When `specs-generated`, an acceptance\u002Fsystem spec was EXECUTED, not just written —\n      a spec that never ran does not establish RED\n- [ ] When `specs-generated`, the real RED run's results are\n      recorded to `.pipeline\u002Facceptance-specs-red.json`\n      (command, targetSpecs, executed\u002Fpassed\u002Ffailed\u002Fskipped\u002Ferrors counts, failing-test identity,\n      `ranAt`, and `intentRationale`) — the\n      completion gate validates this file and rejects runs where the feature's own\n      specs were skipped, deselected, or errored at collection\n- [ ] When `specs-generated`, failures are for the RIGHT reason (missing implementation), not\n      import\u002Fsyntax\u002Fcollection errors\n- [ ] When `specs-generated`, specs use the project's own test framework and directory conventions\n- [ ] When `specs-generated`, the run contract is written to `.pipeline\u002Facceptance-specs-run.json` (command, cwd,\n      targetSpecs) before reporting complete — the deterministic RED backstop the engine's\n      self-heal runner consumes when the RED evidence marker is missing or misplaced\n",{"name":5,"phase":44,"requires":45,"description":7,"enforcement":25,"disable-model-invocation":47},"build",[46],"verify-claims",true,"main","60310a111655e2d63b87223befba464932465487","skills\u002Fwriting-system-tests",2,"https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor","https:\u002F\u002Fgithub.com\u002Fjstoup111","2026-11-14 14:59:43",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":47},[57,60,63],{"tool":58,"command":59},"npx","npx skills add jstoup111\u002Fai-conductor --skill writing-system-tests",{"tool":61,"command":62},"bunx","bunx skills add jstoup111\u002Fai-conductor --skill writing-system-tests",{"tool":64,"command":65},"pnpm","pnpm dlx skills add jstoup111\u002Fai-conductor --skill writing-system-tests","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-tests\u002FSKILL.md",[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"agents\u002Fopenai.yaml","REFERENCE","参考文档",43,"https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-tests\u002Fagents\u002Fopenai.yaml",[75,93,119,138,155,176],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":39},"01M70YKSA2H7Q9WSRD1ECEGY20","build-review-dependency-hygiene","Judge whether a feature diff adds unnecessary, insufficiently pinned, or license-incompatible dependencies.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fbuild-review-dependency-hygiene\u002FSKILL.md",[],[44,82,83,84,85,86,87,88,89,90,91,92,25],"dependency hygiene","dependency","hygiene","build review dependency hygiene","review","feature","diff","dependencies","license","true","judge",{"skillNo":94,"name":46,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M6K3EHR0QQ1QY1S9RC6D1WTD","Use only when an active workflow is about to rely on a nontrivial factual claim or assumption for a spec, plan, ADR, finding, or code decision. Do not invoke for casual questions, status reports, restatements, or trivially verifiable mechanics.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fverify-claims\u002FSKILL.md",[],[99,30,100,101,102,103,104,105,91,106,107,108,109,110,111,112,113,114,115,116,117,25,118],"verify claims","verify","do","adr","for","decision","claim","mechanics","only","use","workflow","code","reports","plan","active","questions","about","spec","invoke","when",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6K3ED4NF5DJA2Y35MH2JCRC","tdd","Use when implementing any feature or bugfix. Five-step cycle: RED → DOMAIN → GREEN → DOMAIN → COMMIT. Enforces test-first development with domain integrity review at every phase boundary.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Ftdd\u002FSKILL.md",[],[121,126,127,128,34,129,86,130,131,132,133,87,134,91,108,135,136,137,118,24],"green","cycle","structural","commit","at","bugfix","integrity","domain","development","with","test","test-first",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":39},"01M6K3E6PEXBXYY2K8TSRTN1JT","stories","Use only within active engineer\u002Fconduct DECIDE after architecture approval, when a committed `.docs\u002Fstories` acceptance artifact is required. Do not invoke for general user-story examples, requirements discussion, or direct implementation requests.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fstories\u002FSKILL.md",[],[140,145,101,103,146,147,148,91,107,108,32,149,150,151,30,152,100,153,113,154,117,25,118],"conduct","decide","engineer","general","requirements","architecture","examples","artifact","requests","implementation",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":39},"01M6K3E1HE7267YKFJQ3YFCGW5","stack-land","Use when an operator needs to land reviewed manual changes on the correct closed child of a stacked feature. Operator-invoked only: inspect ownership, propose the safe child with evidence, and require confirmation before opening the landing.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fstack-land\u002FSKILL.md",[],[162,163,164,135,30,165,166,167,100,87,168,169,170,171,172,91,173,107,108,174,118,175],"stack","land","stack land","evidence","child","changes","inspect","manual","correct","landing","safe","operator","confirmation","advisory",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":182,"publishedAt":39},"01M6K3DX3DTQ5MY3XDKDQ8K4JE","simplify","Use only at an active pipeline batch boundary after code has changed. Reviews current-batch duplication, complexity, over-engineering, and domain-modelling defects; do not invoke for ordinary refactors, code review, or requests that merely ask for simpler prose or code.","https:\u002F\u002Fgithub.com\u002Fjstoup111\u002Fai-conductor\u002Fblob\u002Fmain\u002Fskills\u002Fsimplify\u002FSKILL.md",[],[178,183,101,184,133,103,185,186,187,107,108,188,189,110,190,86,191,153,117,25],"complexity","reviews","pipeline","defects","code review","false","ask","batch","boundary"]