[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758WEFCEXEYHZ2CS0Y7DQB3":3,"skill-same:01M758WEFCEXEYHZ2CS0Y7DQB3":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M758WEFCEXEYHZ2CS0Y7DQB3","tdd",null,"Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.","joeloverbeck\u002Fcontinuity-loom","joeloverbeck","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F120873?v=4","01M758KCBJ0GWAPGN74C9NJF8T","01M758KCCNQ8F0YS327T45F7C0",0,"GPL-3.0","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\nTDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle — consult them before and during the loop, not after.\n\n**Orientation.** For a single feature or bug fix, the operative guidance is *What a good test is*, *Seams*, *Anti-patterns*, and *Rules of the loop* below. The preflight, acceptance-manifest, shared-boundary-table, atom\u002Fsequence-map, and closeout hard-stops between here and those sections apply when the work is a PRD or multi-issue family — typically when this skill runs under the `implement` skill; that closeout contract lives in [closeout-evidence.md](closeout-evidence.md).\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore the first red test, record whether `CONTEXT.md` exists and was read, identify every applicable ADR or principle document, and give each one an explicit authority disposition: aligned with a concrete basis, covered by an approved amendment or exception with a durable reference, or reasoned N\u002FA.\n\nUse this preflight before writing the first red test:\n\n```markdown\nTDD preflight:\n- CONTEXT.md status: \u003Cread \u002F absent \u002F N\u002FA>\n- ADRs\u002Fprinciples\u002Fdocs status: \u003Caligned because authorities and concrete basis \u002F approved amendment or exception with durable authority reference \u002F conflict - blocked because ... \u002F N\u002FA because ...>\n- Pre-red evidence reference: \u003Cfile-backed or tracker-backed ledger plus heading or row anchor by default; exact conversation block plus anchor only while it remains inspectable; chronology proof that this preflight and table precede the first red command>\n- Agreed seams: \u003Cissue\u002FPRD-stated seams restated \u002F user-confirmed seams \u002F confirmation needed>\n- Authoritative acceptance manifest: \u003Cpath generated from saved exact issue JSON \u002F N\u002FA because one non-PRD issue has no shared or parent boundary>\n- Row plan: \u003Cred-first seams>; \u003Cno-runnable criteria>; \u003Cevidence-only browser\u002Fmanual\u002Fexternal seams>\n- Acceptance atom map: \u003Ceach exact criterion mapped to authoritative atoms and required proof surfaces, with every named value in a quantified range listed unless the source permits sampling \u002F all criteria atomic, with proof surfaces named \u002F blocked because ...>\n- Acceptance sequence map: \u003Ceach order\u002Ftransition\u002Ftimeline-sensitive criterion mapped to the ordered events and proof that observes their order; stateful re-entry and terminal paths mapped on one active instance; overlapping async invocation either prevented or mapped through attempt A remains pending -> attempt B settles -> attempt A settles \u002F all rows use sequence N\u002FA because their criteria are not sequence-sensitive \u002F blocked because ...>\n- Proof server plan: \u003Cconfigured API\u002FUI ports plus owner-check command; unrelated pre-existing owners and isolated proof-owned ports\u002Fproxy plan \u002F configured ports verified free \u002F N\u002FA because no browser\u002Fmanual proof server applies>\n- Shared-boundary table stub: \u003Ccreated before first red test \u002F N\u002FA>; \u003Cevery in-scope issue has a row or exceptions named>\n- Existing expectation rewrite checkpoint: \u003Cnone yet \u002F row will be added immediately if an existing test, fixture, snapshot, route\u002Fschema expectation, or artifact assertion is edited after a failing command>\n- User confirmation needed: \u003Cyes\u002Fno, and why>\n```\n\nAuthority-conformance pre-red hard stop: reading an authority is not a conformance result. For every applicable authority, record `aligned` with the exact basis or record an `approved amendment` or `approved exception` with a durable authority reference. If the requested behavior conflicts with an authority, stop and obtain the exact amendment, exception, or scope correction; do not run the first red command while any authority conflict is unresolved. `N\u002FA` requires a reason. Carry the same disposition into every affected compact row and the closeout gate.\n\nAcceptance-source inventory hard stop: for a parent PRD, child issue family, or named multi-issue set, save the exact issue JSON and generate the authoritative acceptance manifest with `.claude\u002Fskills\u002Fimplement\u002Fscripts\u002Fbuild-acceptance-manifest.mjs` before the first red command. The preflight and compact-table row plan must account for every generated parent section check, individual `USN`, AC check, and Principles check. A broad range such as `US1-US36` does not replace the individual story-to-seam map; use exact keyed rows or an adjacent keyed map for every story. Reuse the same manifest for TDD closeout, review, and implementation closeout rather than rebuilding scope from prose.\n\nShared-boundary pre-red hard stop: when the work covers multiple issues, one PRD with child issues, or one implementation boundary shared by several acceptance rows, paste the compact evidence table immediately below the preflight before any red command. A prose row plan is not enough. Mark each row as `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only`; if the table is genuinely N\u002FA, name the exception in the `Shared-boundary table stub` field before proceeding.\n\nAcceptance-atom and sequence pre-red hard stop: before the first red command, resolve every composite term in the issue or PRD through its authoritative parent\u002Fchild definition, implementation decision, glossary, or named contract. In `Acceptance atom map`, list every required atom and map each atom to every promised proof surface. In `Acceptance sequence map`, identify every order-, transition-, or timeline-sensitive criterion and list the ordered events plus the proof surface that observes their order. For example, if `provenance` means `actor + timestamp + flow step` across `API + report + browser`, the map and eventual evidence must name all six obligations rather than only `provenance`; if acceptance requires Proposal → staging → Pressure, it must preserve that order rather than proving the three states independently. A quantified range such as “two through five” requires proof at every named value unless the source explicitly permits boundary or representative sampling. A lifecycle or renderer term such as “controlled rerender,” “resume,” or “transition” requires one active instance plus the triggering action and observer that prove continuity; two independent snapshots or server renders are not equivalent. For an ephemeral draft, provenance report, modal workflow, or other stateful interaction, map re-entry while state is active and every applicable terminal path: success, failure, cancel, discard, persistence, baseline restoration, and the action that retains, clears, or re-enables the session. For a user-triggered async action that can be invoked before its earlier promise settles, either prove the action prevents overlap or map `attempt A remains pending -> attempt B settles -> attempt A settles`, including mixed success\u002Ffailure orderings and the observer that proves newest-attempt ownership. A row may group atoms, surfaces, or ordered events only when its assertion or evidence directly proves every grouped obligation; otherwise split the row. Carry the exact criterion plus `atoms:`, `proof surfaces:`, and `sequence:` into each row's `Acceptance covered` cell, using `atoms: atomic` only when the authoritative criterion truly has one indivisible obligation and `sequence: N\u002FA because the criterion is not sequence-sensitive` only when order cannot affect acceptance.\n\nCoverage-only admissibility hard stop: before classifying a row as `coverage-only existing behavior`, map the exact acceptance criteria to materially distinct public seams. A route, action, refresh, request, API, or rendered-state behavior needs its own row unless one assertion directly observes every grouped condition. Run the criterion-specific public assertion or probe before any production change and record its concrete green command\u002Fevidence plus the exact acceptance reference. If the assertion fails, classify the seam as `red-first`; if it has not run yet, leave the row `TBD` rather than claiming coverage-only behavior.\n\nExisting expectation rewrite checkpoint: if an existing test, fixture, snapshot, route\u002Fschema expectation, or artifact assertion fails after an intended contract change and you edit that existing expected value, update the compact evidence table immediately before continuing. Use an `existing contract-change expectation` row, start `Red command\u002Ffailure` with `existing contract-change expectation in \u003Ctest file> because ...` plus the failing command\u002Fassertion, cite the authorizing spec\u002Fissue\u002Fworked example in `Acceptance covered`, and keep the full existing-test closeout rule under [Rules of the loop](#rules-of-the-loop) from becoming a last-minute validator repair.\n\nFor shared-boundary issue families, paste this compact evidence table stub before the first red test; do not substitute a prose-only row plan. The red and green cells can be `TBD` while work is still in progress, but every in-scope issue and agreed seam must already have a row with a `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only` classification.\n\n```markdown\n| Issue | CONTEXT.md status | ADRs\u002Fprinciples\u002Fdocs status | Seam | Red command\u002Ffailure | Green command or evidence | Acceptance covered | Review fix \u002F red-first skip reason |\n|---|---|---|---|---|---|---|---|\n| #N | \u003Cread \u002F absent \u002F N\u002FA> | \u003Caligned because authorities and basis \u002F approved amendment or exception with durable reference \u002F N\u002FA because ...> | \u003Cred-first \u002F existing contract-change expectation \u002F static contract check + browser evidence \u002F coverage-only existing behavior \u002F no-runnable \u002F evidence-only seam> | \u003Ccommand plus expected failure \u002F partial red - wrong reason \u002F coverage-only existing behavior; red-first N\u002FA because behavior already existed and no production code changed \u002F N\u002FA \u002F explicit skip reason \u002F TBD> | \u003Cpassing command \u002F browser route-action-result \u002F external\u002Fcold proof artifact or audit-row citation \u002F artifact path \u002F N\u002FA \u002F TBD> | \u003Cexact criterion or checkbox; atoms: authoritative atoms or atomic, including every named range value; proof surfaces: surface for each atom; sequence: ordered events plus same-instance action and observer, including applicable stateful re-entry\u002Fterminal paths and async settlement order \u002F N\u002FA because criterion is not sequence-sensitive> | \u003CN\u002FA \u002F review-fix evidence \u002F partial-red follow-up \u002F red-first skip reason> |\n```\n\nWhen the repo `implement` skill owns the surrounding workflow, keep this table or equivalent fields in the implementation ledger before review and carry them into the final closeout sink before tracker mutation. Do not wait until closeout pressure to reconstruct TDD evidence from prose-only command notes.\n\nFor parent\u002Fchild issue families, named multi-issue sets, and other long or compaction-prone runs, create a file-backed or tracker-backed ledger before the first red command and append the exact preflight, compact table, and command chronology there. Conversation-only evidence is durable only while the exact preflight block, compact rows, and chronology remain inspectable verbatim; a context-compaction summary or reconstructed recollection does not qualify.\n\nImplement-owned pre-red hard stop: when this skill is invoked under the repo `implement` skill, do not run the first red command until either the `TDD preflight:` block and compact table stub above are pasted, or the visible implementation ledger explicitly states that it contains each required TDD preflight field and compact-table row. The preflight must fill `Pre-red evidence reference:` with the durable sink and exact heading or row anchor; keep the first red command in that same sink after the anchor, or record another inspectable chronology proof. For parent PRDs, child families, and named issue sets, that visible state must include the authoritative acceptance-manifest path and a row or keyed-map destination for every generated check. If this gate was missed, stop before more implementation or review and paste the literal `TDD recovery addendum:` block from [closeout-evidence.md](closeout-evidence.md). Its four required fields inventory the missed pre-red gates, recovered authoritative-manifest coverage, reconstructed red\u002Fgreen evidence by issue\u002Fseam, and final preservation sink; an anchored reference without that block is not recovery evidence.\n\nBefore handing work to review, drafting a pre-close audit, or mutating the tracker, read [closeout-evidence.md](closeout-evidence.md). It owns the validator command, interim\u002Ffinal durable-sink gates, parent-rollup template, and tracker-mutation stop; do not reconstruct those contracts from memory.\n\n## What a good test is\n\nTests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — \"user can checkout with valid cart\" tells you exactly what capability exists — and survives refactors because it doesn't care about internal structure.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Seams — where tests go\n\nA **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.\n\n**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything — agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.\n\nIf a PRD or issue explicitly names proof seams, those count as pre-agreed after you restate them in the implementation ledger. Ask the user only when the seam is absent, ambiguous, or conflicts with the codebase's actual public interfaces.\n\nWhen seam confirmation is needed, ask: \"What's the public interface, and which seams should we test?\"\n\nStatic\u002Fsource-level contract checks are exceptional. Use them only when an explicit acceptance criterion names a forbidden or required source contract, such as a route string, import, schema key, or generated artifact path. Label the evidence as a static contract check, keep the expected value tied to the spec, and pair it with a public behavior test or browser smoke when the feature is user-visible.\n\nDo not use source-file string checks merely to automate browser-visible UI acceptance. For visible UI behavior, use a public UI\u002Frendered DOM test or evidence-only browser smoke unless the acceptance criterion names a source-level contract.\n\nWhen writing a static contract check, target the smallest source construct that proves the contract. Avoid whole-file regex spans that can cross unrelated regions or match incidental text. After the red run, confirm the failure names the intended forbidden or required contract rather than a broader accidental match.\n\nWhen a static contract check is paired with browser proof, label the compact-table `Seam` cell as `static contract check + browser evidence`. Put the failing source-level contract command in `Red command\u002Ffailure`, and put both the passing focused command and the browser route\u002Faction\u002Fartifact in `Green command or evidence`.\n\n## Anti-patterns\n\n- **Implementation-coupled** — mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.\n- **Tautological** — the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth — a known-good literal, a worked example, the spec.\n- **Horizontal slicing** — writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead — one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.\n\nShared-boundary red-command hard stop: for shared-boundary issue families, do not run the first broad or shared-boundary red command until the compact evidence table stub is visible in the conversation, implementation ledger, or durable scratchpad. The stub must have one row per in-scope issue and agreed seam, or an explicit exception\u002Fclarification for each missing seam. A prose-only row plan is not enough.\n\n## Rules of the loop\n\n- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.\n- **Stateful interaction adversaries belong in the tracer.** When behavior owns an ephemeral draft, provenance report, modal, retry state, or other session-like state, exercise re-entry while state is active and every applicable terminal path before declaring green. Prove the original baseline and ownership survive rejected\u002Frepeated entry, and prove exactly which success, failure, cancel, discard, or persistence outcome retains, clears, restores, or re-enables the state.\n- **Async completion order is user-visible behavior.** When the same user action can overlap an earlier in-flight call, either disable or guard re-invocation and test that public behavior, or control the boundary promises so attempt A remains pending, attempt B settles, then attempt A settles. Assert the final public state for both older-success\u002Fnewer-failure and older-failure\u002Fnewer-success orderings; call counts or internal tokens are not the oracle.\n- **Bootstrap red is not behavior red.** A focused command that fails only because the intended test file does not exist (for example, `no test files found`) can seed the loop only as `bootstrap red`. Before implementing behavior, follow it with the smallest failing assertion for the agreed seam, or record an explicit red-first skip reason if a true assertion red is impossible. Do not report a missing-test-file failure as proof that the behavior contract went red.\n- **Review findings restart the loop.** If review reveals missing behavior after the implementation is already green, add or adjust the smallest assertion first and run it red before fixing. If the code was already fixed to protect the tree or unblock verification, record that red-first was skipped and why. A review-fix evidence row that says only `fixed and covered` is not enough; it must include the red command\u002Ffailure or an explicit `red-first skipped because ...` reason.\n- **Standards-only review fixes do not need fake behavior reds.** If review finds a Standards-only, ADR-only, or conformance-only problem and the fix does not change acceptance behavior, record `red-first skipped because Standards-only\u002Fconformance-only fix did not change behavior`, rerun the affected focused and root gates, and refresh browser\u002Fmanual evidence only when the touched files affect a covered route, action, browser-consumed API shape, fixture, or data setup.\n- **Schema-heavy fixture setup is a precondition, not the behavior red.** When a tracer uses persisted records, temporary databases, serialized DTOs, or another setup surface with runtime-required fields, construct it through the public typed builder or parser and run the smallest setup-only probe when practical before the intended behavior red. A setup\u002Fschema failure does not count as the behavior red: record `partial red - wrong reason: fixture\u002Fsetup failed because ...`, repair only the fixture precondition, then rerun until the assertion fails for the intended acceptance behavior.\n- **Dependency state is a precondition, not a behavior red.** When a package manifest or lockfile changes, run the dependency install or synchronization command required by the root guidance before treating a focused or canonical command as red\u002Fgreen evidence. Classify missing-module, missing-binary, or workspace-link failures observed before synchronization as setup-only, repair the install, and rerun the original command.\n- **Cross-workspace build freshness is a precondition, not a behavior red.** Before interpreting a focused consumer test across a workspace boundary, establish whether the consumer resolves the upstream workspace's current source or built output. When it resolves built output, refresh the affected upstream workspace build before the baseline or red run and again after changing public exports, DTOs, or other consumed build artifacts. Record a stale-build failure as `partial red - wrong reason: stale upstream workspace build because ...`, refresh that build, and rerun the exact focused command before recording red or green behavior evidence.\n- **Robustness harnesses are assurance after behavior green.** When acceptance requires mutation, scoped coverage, property, metamorphic, or golden assurance, use `docs\u002FACTIVE-DOCS.md` to select and read the active development-assurance authority; in this repo that authority is `docs\u002Fspecs\u002Frobustness-testing.md`. Do not count runner, plugin-discovery, sandbox, symlink-traversal, or other harness setup failures as behavior red. Record the original command and failure, verify installed runner and plugin versions against the manifest and lockfile, preserve the exact changed-source, product, test, and mutation scopes, and justify exclusions only for proven non-product or non-test infrastructure. After behavior green, run the closest equivalent assurance command and the repository's canonical result gate; report the assurance step blocked when equivalence cannot be demonstrated.\n- **Copied stateful fixtures require consistent snapshots.** Create a copied database, world file, or other stateful fixture with an application-consistent snapshot mechanism, then probe the expected identity and state before using it for a red, green, or evidence-only row. For Worldloom SQLite files that may have live WAL state, use SQLite `.backup` or an explicit checkpoint-aware copy rather than raw `cp`; classify a failed, empty, or stale copy as superseded evidence.\n- **Authority-sensitive fixture identity stays explicit.** When an acceptance criterion, user instruction, or repository policy forbids publishing a machine-local fixture path, keep the path private and record `fixture paths withheld because \u003Cauthority and reason>; logical fixture \u003Cstable ID>; content SHA-256 \u003C64 hexadecimal characters>; provenance \u003Cgenerated, derived, or copied-source statement>` in the shared current-evidence inventory. Do not disguise a withheld path as `none` or `none published because`; the logical identity, content hash, and provenance preserve reproducibility without disclosing the path.\n- **Wrong-reason red is only partial red.** If a red command for a review fix fails because of a missing file, a generic invariant, an unrelated assertion, or any reason that does not prove the intended behavior is wrong, record `partial red - wrong reason: \u003Creason>`, then add or adjust the smallest assertion that fails for the intended behavior before patching. If no intended-behavior red is possible, record an explicit `red-first skipped because ...` reason.\n- **Unexpected green can be wrong-surface coverage.** If a new or adjusted assertion passes before the intended behavior fix, pause before counting it as proof. Verify the assertion observes the intended public route, panel, action, or source construct, not a legacy surface, nearby component, broad HTML\u002Fsource span, or incidental text. If the assertion was too broad, tighten it and run again until it fails for the intended missing behavior; record coverage-only proof only after confirming the behavior already truly exists.\n- **Coverage-only review fixes are different from behavior fixes.** If review reveals missing proof or coverage, but the behavior already exists, add the smallest assertion and run it. If it passes without a code change, record `coverage-only review fix; red-first N\u002FA because behavior already existed and no code changed`. If it fails, treat the finding as missing behavior and restart the red → green loop.\n- **Coverage-only existing behavior rows are initial-implementation proof rows, not review fixes.** If an issue requires proof for behavior that already exists and the new assertion passes before any production change, record `coverage-only existing behavior; red-first N\u002FA because behavior already existed and no production code changed`, cite the public seam and acceptance criterion, and verify the assertion observes the intended route, action, API, or source construct. If the assertion fails, treat it as missing behavior and restart the red → green loop. Do not use this phrase for review findings; use `coverage-only review fix` there.\n- **Review-fix evidence and freshness.** When review creates or changes a TDD row, use the canonical keyed review-fix map and freshness rules in [closeout-evidence.md](closeout-evidence.md). Give every finding one unique `RF-N` row, repeat that ID in the exact compact TDD row it updates, and keep each finding's red, green, durability, freshness, backend-currentness, and identity evidence together. A transient browser\u002Fmanual red must include `Regression durability:`; do not leave review-fix proof as prose-only notes or bundle several findings into one unkeyed entry.\n- **Record the loop.** For each slice, append lightweight evidence of the red command and expected failure, then the green command, to the durable sink named by `Pre-red evidence reference:` so line order or another recorded anchor preserves chronology. If red-first is skipped, say why. For focused commands, check the output confirms the intended file, seam, or assertion actually ran; if a package script does not forward file arguments cleanly, invoke the underlying runner directly.\n- **Existing-test failures after intended contract changes are regression evidence.** If an existing test fails after an intended behavior, schema, route, or artifact contract changes, record the failing command before editing the test. Update the expectation only when the spec, issue, or worked example authorizes the new behavior; otherwise fix the implementation. Rerun the focused command and any broader gate that exposed the failure. In the compact evidence table, put the failing existing-test command in `Red command\u002Ffailure` for the affected seam, or use a dedicated `existing contract-change expectation` row when the failure spans several acceptance rows. Reserve `Review fix \u002F red-first skip reason` for review findings, coverage-only review fixes, and explicit red-first skips. Closeout stop: if any existing test expectation was edited after a failing command, add an `existing contract-change expectation` row before the TDD closeout preflight; if none were edited, record `Existing-test contract-change rows: none`.\n- **Existing-test contract-change row means expectation rewrite.** Do not use `existing-test contract-change rows` merely because new assertions were added to an existing test file. It applies only when an existing expectation, snapshot, fixture assertion, route\u002Fschema expectation, or equivalent contract assertion was changed after a failing command and the issue\u002Fspec authorizes the new expected behavior. In that case, the compact table must include a row whose `Seam` cell is exactly `existing contract-change expectation`; otherwise record `Existing-test contract-change rows: none`.\n- **Docs-only and no-runnable criteria stay explicit.** If an acceptance criterion is a document deliverable, review\u002Fconformance claim, or otherwise has no runnable public seam, do not invent a test seam. Record red and green as `N\u002FA`, cite the review\u002Fconformance evidence, and carry the no-runnable reason in the compact evidence table.\n- **Browser\u002Fmanual evidence can be evidence-only.** If acceptance requires browser-visible, manual, screenshot, walkthrough, or other evidence that is not itself a red-first automated seam, record it as an evidence-only row instead of forcing a fake failing test. Set red to `N\u002FA` or an explicit red-first skip reason, and record the browser route, action path, observed outcome, artifact path, or walkthrough result in the green\u002Fevidence field. Record console error\u002Fwarning state next to the evidence or in the closeout preflight. Before starting or attaching to any proof server, inspect the configured API\u002FUI ports and their owning processes; record unrelated pre-existing owners without stopping or reusing them, then either prove the configured ports free or choose isolated proof-owned ports and align the UI proxy\u002FAPI base. Record the proof-owned session name, URL, command, or PID before relying on it; during cleanup, stop only proof-owned processes and state whether each was stopped, intentionally left running, or unrelated and pre-existing. When browser proof consumes a backend, reachability alone is not proof that the process serves the current code: record the server command and watch\u002Freload mode, confirm process and port ownership from the browser proof's execution context, restart or reload after relevant server\u002FAPI changes unless current-code reload is demonstrated, and run the smallest expected-shape API field or behavior probe before the final UI assertion. If currentness is uncertain or a stale process caused an error, restart the proof-owned backend and use a clean browser session. When browser proof uses a copied stateful fixture, record its snapshot method and source plus the expected-state probe that proved the copy current before the final UI assertion. If the proof spans hot reload\u002FHMR, reused browser sessions, agent-induced setup\u002Frequest errors, or unexplained console errors or warnings, treat it as preliminary and rerun a clean browser session on the final tree, or explicitly classify the console output as unrelated with evidence. For dense app screens or long single-page snapshots, keep evidence bounded: prefer targeted DOM\u002Ftext assertions, concise excerpts, and screenshots over full-page snapshot dumps. If later edits touch a route, UI action, browser-consumed API shape, fixture, or data setup covered by an evidence-only row, rerun the evidence on the final tree or record an explicit stale\u002Fblocked reason before closeout. If a later behavior-changing UI edit is outside the evidence-only route\u002Faction path, `not affected` is acceptable only when the closeout names the changed path, explains why the evidence route\u002Faction path and browser-consumed API\u002Ffixtures were untouched, and reruns targeted proof for the changed path.\n- **Published current evidence survives cleanup truthfully.** Before deleting proof-owned fixtures, scripts, packets, or artifacts, compare them with the published `Current evidence identities:` inventory and closeout references. A published current artifact is not safe to remove until closeout is complete and its retained-or-removed disposition is recorded. If it is removed after publication, update the durable evidence so it does not imply that the local artifact remains inspectable; retain the command\u002Fresult or tracker-hosted evidence needed to support the claim.\n- **Issue-level browser\u002Fmanual N\u002FA stays explicit.** If exact issue or PRD acceptance says browser\u002Fmanual proof is N\u002FA because the browser contract, routes, rendered behavior, validation response, fixtures, and action path are unchanged, do not create a fake evidence-only row. Record the exact issue\u002FPRD rationale in the row plan or compact table context, and carry it into closeout as `Evidence-only rows freshness: none - browser\u002Fmanual N\u002FA because ...` or an adjacent explicit N\u002FA note. Browser\u002Fmanual proof is still required for any changed browser-consumed surface or UI\u002Fbrowser-visible criterion that is not covered by the explicit N\u002FA.\n- **External\u002Fcold proof can be evidence-only.** If acceptance requires a cold external LLM, fresh subagent, packet-read, credentialed service, nonlocal probe, or other proof outside repo-local tests, record it as an evidence-only row or cite a per-criterion audit row in the same durable sink. Set red to `N\u002FA` or an explicit red-first skip reason, and record the exact packet\u002Fartifact\u002Freport path, subagent\u002Fprobe result, blocker, or same-sink audit-row citation in `Green command or evidence`. Do not let a focused test command stand in for external proof it did not exercise.\n- **One slice at a time.** One seam, one test, one minimal implementation per cycle. When a vertical slice legitimately spans several public seams, write the smallest tracer-bullet test at each seam, keep the issue\u002Faudit mapping explicit, and avoid bulk tests that are not tied to an acceptance criterion.\n- **Shared-boundary issue families still need tracer bullets.** When PRD child issues share one implementation boundary and separate red-green cycles would be artificial, write the smallest red tracer at each agreed seam, record the red failures by seam and issue, then implement the shared boundary while keeping the acceptance mapping explicit.\n- **Inventory shared-boundary seams before broad red tests.** Before writing the first broad tracer for a shared-boundary issue family, list every agreed seam and mark each one as `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only`. Instantiate the compact evidence table stub before the first red test: one row per in-scope issue and agreed seam, with `TBD` allowed only in command\u002Fevidence cells that cannot exist yet. Use that inventory as the row plan for the compact evidence table; if a seam cannot be classified, stop and clarify the seam before writing tests.\n- **Shared-boundary closeout hard stop.** Do not enter closeout for a shared-boundary issue family until the canonical compact evidence table in [closeout-evidence.md](closeout-evidence.md) has one row per agreed seam, or an explicit red-first skip reason for each seam that could not reasonably go red first.\n- **Implementation closeout consumes TDD evidence.** Before review, pre-close audit, issue closure, or parent PRD closeout, follow [closeout-evidence.md](closeout-evidence.md) and preserve the interim\u002Ffinal durable-sink fields there; do not rely on prose-only red\u002Fgreen notes surviving compaction.\n\n- **Refactoring is not part of the loop.** Incidental cleanup belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle. When the requested work is itself a behavior-preserving refactor with observable or static acceptance criteria, the loop can use a red tracer for the required contract plus behavior-preservation tests at the agreed seams.\n","# Test-Driven Development\n\nTDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle — consult them before and during the loop, not after.\n\n**Orientation.** For a single feature or bug fix, the operative guidance is *What a good test is*, *Seams*, *Anti-patterns*, and *Rules of the loop* below. The preflight, acceptance-manifest, shared-boundary-table, atom\u002Fsequence-map, and closeout hard-stops between here and those sections apply when the work is a PRD or multi-issue family — typically when this skill runs under the `implement` skill; that closeout contract lives in [closeout-evidence.md](closeout-evidence.md).\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore the first red test, record whether `CONTEXT.md` exists and was read, identify every applicable ADR or principle document, and give each one an explicit authority disposition: aligned with a concrete basis, covered by an approved amendment or exception with a durable reference, or reasoned N\u002FA.\n\nUse this preflight before writing the first red test:\n\n```markdown\nTDD preflight:\n- CONTEXT.md status: \u003Cread \u002F absent \u002F N\u002FA>\n- ADRs\u002Fprinciples\u002Fdocs status: \u003Caligned because authorities and concrete basis \u002F approved amendment or exception with durable authority reference \u002F conflict - blocked because ... \u002F N\u002FA because ...>\n- Pre-red evidence reference: \u003Cfile-backed or tracker-backed ledger plus heading or row anchor by default; exact conversation block plus anchor only while it remains inspectable; chronology proof that this preflight and table precede the first red command>\n- Agreed seams: \u003Cissue\u002FPRD-stated seams restated \u002F user-confirmed seams \u002F confirmation needed>\n- Authoritative acceptance manifest: \u003Cpath generated from saved exact issue JSON \u002F N\u002FA because one non-PRD issue has no shared or parent boundary>\n- Row plan: \u003Cred-first seams>; \u003Cno-runnable criteria>; \u003Cevidence-only browser\u002Fmanual\u002Fexternal seams>\n- Acceptance atom map: \u003Ceach exact criterion mapped to authoritative atoms and required proof surfaces, with every named value in a quantified range listed unless the source permits sampling \u002F all criteria atomic, with proof surfaces named \u002F blocked because ...>\n- Acceptance sequence map: \u003Ceach order\u002Ftransition\u002Ftimeline-sensitive criterion mapped to the ordered events and proof that observes their order; stateful re-entry and terminal paths mapped on one active instance; overlapping async invocation either prevented or mapped through attempt A remains pending -> attempt B settles -> attempt A settles \u002F all rows use sequence N\u002FA because their criteria are not sequence-sensitive \u002F blocked because ...>\n- Proof server plan: \u003Cconfigured API\u002FUI ports plus owner-check command; unrelated pre-existing owners and isolated proof-owned ports\u002Fproxy plan \u002F configured ports verified free \u002F N\u002FA because no browser\u002Fmanual proof server applies>\n- Shared-boundary table stub: \u003Ccreated before first red test \u002F N\u002FA>; \u003Cevery in-scope issue has a row or exceptions named>\n- Existing expectation rewrite checkpoint: \u003Cnone yet \u002F row will be added immediately if an existing test, fixture, snapshot, route\u002Fschema expectation, or artifact assertion is edited after a failing command>\n- User confirmation needed: \u003Cyes\u002Fno, and why>\n```\n\nAuthority-conformance pre-red hard stop: reading an authority is not a conformance result. For every applicable authority, record `aligned` with the exact basis or record an `approved amendment` or `approved exception` with a durable authority reference. If the requested behavior conflicts with an authority, stop and obtain the exact amendment, exception, or scope correction; do not run the first red command while any authority conflict is unresolved. `N\u002FA` requires a reason. Carry the same disposition into every affected compact row and the closeout gate.\n\nAcceptance-source inventory hard stop: for a parent PRD, child issue family, or named multi-issue set, save the exact issue JSON and generate the authoritative acceptance manifest with `.claude\u002Fskills\u002Fimplement\u002Fscripts\u002Fbuild-acceptance-manifest.mjs` before the first red command. The preflight and compact-table row plan must account for every generated parent section check, individual `USN`, AC check, and Principles check. A broad range such as `US1-US36` does not replace the individual story-to-seam map; use exact keyed rows or an adjacent keyed map for every story. Reuse the same manifest for TDD closeout, review, and implementation closeout rather than rebuilding scope from prose.\n\nShared-boundary pre-red hard stop: when the work covers multiple issues, one PRD with child issues, or one implementation boundary shared by several acceptance rows, paste the compact evidence table immediately below the preflight before any red command. A prose row plan is not enough. Mark each row as `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only`; if the table is genuinely N\u002FA, name the exception in the `Shared-boundary table stub` field before proceeding.\n\nAcceptance-atom and sequence pre-red hard stop: before the first red command, resolve every composite term in the issue or PRD through its authoritative parent\u002Fchild definition, implementation decision, glossary, or named contract. In `Acceptance atom map`, list every required atom and map each atom to every promised proof surface. In `Acceptance sequence map`, identify every order-, transition-, or timeline-sensitive criterion and list the ordered events plus the proof surface that observes their order. For example, if `provenance` means `actor + timestamp + flow step` across `API + report + browser`, the map and eventual evidence must name all six obligations rather than only `provenance`; if acceptance requires Proposal → staging → Pressure, it must preserve that order rather than proving the three states independently. A quantified range such as “two through five” requires proof at every named value unless the source explicitly permits boundary or representative sampling. A lifecycle or renderer term such as “controlled rerender,” “resume,” or “transition” requires one active instance plus the triggering action and observer that prove continuity; two independent snapshots or server renders are not equivalent. For an ephemeral draft, provenance report, modal workflow, or other stateful interaction, map re-entry while state is active and every applicable terminal path: success, failure, cancel, discard, persistence, baseline restoration, and the action that retains, clears, or re-enables the session. For a user-triggered async action that can be invoked before its earlier promise settles, either prove the action prevents overlap or map `attempt A remains pending -> attempt B settles -> attempt A settles`, including mixed success\u002Ffailure orderings and the observer that proves newest-attempt ownership. A row may group atoms, surfaces, or ordered events only when its assertion or evidence directly proves every grouped obligation; otherwise split the row. Carry the exact criterion plus `atoms:`, `proof surfaces:`, and `sequence:` into each row's `Acceptance covered` cell, using `atoms: atomic` only when the authoritative criterion truly has one indivisible obligation and `sequence: N\u002FA because the criterion is not sequence-sensitive` only when order cannot affect acceptance.\n\nCoverage-only admissibility hard stop: before classifying a row as `coverage-only existing behavior`, map the exact acceptance criteria to materially distinct public seams. A route, action, refresh, request, API, or rendered-state behavior needs its own row unless one assertion directly observes every grouped condition. Run the criterion-specific public assertion or probe before any production change and record its concrete green command\u002Fevidence plus the exact acceptance reference. If the assertion fails, classify the seam as `red-first`; if it has not run yet, leave the row `TBD` rather than claiming coverage-only behavior.\n\nExisting expectation rewrite checkpoint: if an existing test, fixture, snapshot, route\u002Fschema expectation, or artifact assertion fails after an intended contract change and you edit that existing expected value, update the compact evidence table immediately before continuing. Use an `existing contract-change expectation` row, start `Red command\u002Ffailure` with `existing contract-change expectation in \u003Ctest file> because ...` plus the failing command\u002Fassertion, cite the authorizing spec\u002Fissue\u002Fworked example in `Acceptance covered`, and keep the full existing-test closeout rule under [Rules of the loop](#rules-of-the-loop) from becoming a last-minute validator repair.\n\nFor shared-boundary issue families, paste this compact evidence table stub before the first red test; do not substitute a prose-only row plan. The red and green cells can be `TBD` while work is still in progress, but every in-scope issue and agreed seam must already have a row with a `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only` classification.\n\n```markdown\n| Issue | CONTEXT.md status | ADRs\u002Fprinciples\u002Fdocs status | Seam | Red command\u002Ffailure | Green command or evidence | Acceptance covered | Review fix \u002F red-first skip reason |\n|---|---|---|---|---|---|---|---|\n| #N | \u003Cread \u002F absent \u002F N\u002FA> | \u003Caligned because authorities and basis \u002F approved amendment or exception with durable reference \u002F N\u002FA because ...> | \u003Cred-first \u002F existing contract-change expectation \u002F static contract check + browser evidence \u002F coverage-only existing behavior \u002F no-runnable \u002F evidence-only seam> | \u003Ccommand plus expected failure \u002F partial red - wrong reason \u002F coverage-only existing behavior; red-first N\u002FA because behavior already existed and no production code changed \u002F N\u002FA \u002F explicit skip reason \u002F TBD> | \u003Cpassing command \u002F browser route-action-result \u002F external\u002Fcold proof artifact or audit-row citation \u002F artifact path \u002F N\u002FA \u002F TBD> | \u003Cexact criterion or checkbox; atoms: authoritative atoms or atomic, including every named range value; proof surfaces: surface for each atom; sequence: ordered events plus same-instance action and observer, including applicable stateful re-entry\u002Fterminal paths and async settlement order \u002F N\u002FA because criterion is not sequence-sensitive> | \u003CN\u002FA \u002F review-fix evidence \u002F partial-red follow-up \u002F red-first skip reason> |\n```\n\nWhen the repo `implement` skill owns the surrounding workflow, keep this table or equivalent fields in the implementation ledger before review and carry them into the final closeout sink before tracker mutation. Do not wait until closeout pressure to reconstruct TDD evidence from prose-only command notes.\n\nFor parent\u002Fchild issue families, named multi-issue sets, and other long or compaction-prone runs, create a file-backed or tracker-backed ledger before the first red command and append the exact preflight, compact table, and command chronology there. Conversation-only evidence is durable only while the exact preflight block, compact rows, and chronology remain inspectable verbatim; a context-compaction summary or reconstructed recollection does not qualify.\n\nImplement-owned pre-red hard stop: when this skill is invoked under the repo `implement` skill, do not run the first red command until either the `TDD preflight:` block and compact table stub above are pasted, or the visible implementation ledger explicitly states that it contains each required TDD preflight field and compact-table row. The preflight must fill `Pre-red evidence reference:` with the durable sink and exact heading or row anchor; keep the first red command in that same sink after the anchor, or record another inspectable chronology proof. For parent PRDs, child families, and named issue sets, that visible state must include the authoritative acceptance-manifest path and a row or keyed-map destination for every generated check. If this gate was missed, stop before more implementation or review and paste the literal `TDD recovery addendum:` block from [closeout-evidence.md](closeout-evidence.md). Its four required fields inventory the missed pre-red gates, recovered authoritative-manifest coverage, reconstructed red\u002Fgreen evidence by issue\u002Fseam, and final preservation sink; an anchored reference without that block is not recovery evidence.\n\nBefore handing work to review, drafting a pre-close audit, or mutating the tracker, read [closeout-evidence.md](closeout-evidence.md). It owns the validator command, interim\u002Ffinal durable-sink gates, parent-rollup template, and tracker-mutation stop; do not reconstruct those contracts from memory.\n\n## What a good test is\n\nTests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification — \"user can checkout with valid cart\" tells you exactly what capability exists — and survives refactors because it doesn't care about internal structure.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Seams — where tests go\n\nA **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.\n\n**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything — agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.\n\nIf a PRD or issue explicitly names proof seams, those count as pre-agreed after you restate them in the implementation ledger. Ask the user only when the seam is absent, ambiguous, or conflicts with the codebase's actual public interfaces.\n\nWhen seam confirmation is needed, ask: \"What's the public interface, and which seams should we test?\"\n\nStatic\u002Fsource-level contract checks are exceptional. Use them only when an explicit acceptance criterion names a forbidden or required source contract, such as a route string, import, schema key, or generated artifact path. Label the evidence as a static contract check, keep the expected value tied to the spec, and pair it with a public behavior test or browser smoke when the feature is user-visible.\n\nDo not use source-file string checks merely to automate browser-visible UI acceptance. For visible UI behavior, use a public UI\u002Frendered DOM test or evidence-only browser smoke unless the acceptance criterion names a source-level contract.\n\nWhen writing a static contract check, target the smallest source construct that proves the contract. Avoid whole-file regex spans that can cross unrelated regions or match incidental text. After the red run, confirm the failure names the intended forbidden or required contract rather than a broader accidental match.\n\nWhen a static contract check is paired with browser proof, label the compact-table `Seam` cell as `static contract check + browser evidence`. Put the failing source-level contract command in `Red command\u002Ffailure`, and put both the passing focused command and the browser route\u002Faction\u002Fartifact in `Green command or evidence`.\n\n## Anti-patterns\n\n- **Implementation-coupled** — mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.\n- **Tautological** — the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth — a known-good literal, a worked example, the spec.\n- **Horizontal slicing** — writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead — one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.\n\nShared-boundary red-command hard stop: for shared-boundary issue families, do not run the first broad or shared-boundary red command until the compact evidence table stub is visible in the conversation, implementation ledger, or durable scratchpad. The stub must have one row per in-scope issue and agreed seam, or an explicit exception\u002Fclarification for each missing seam. A prose-only row plan is not enough.\n\n## Rules of the loop\n\n- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.\n- **Stateful interaction adversaries belong in the tracer.** When behavior owns an ephemeral draft, provenance report, modal, retry state, or other session-like state, exercise re-entry while state is active and every applicable terminal path before declaring green. Prove the original baseline and ownership survive rejected\u002Frepeated entry, and prove exactly which success, failure, cancel, discard, or persistence outcome retains, clears, restores, or re-enables the state.\n- **Async completion order is user-visible behavior.** When the same user action can overlap an earlier in-flight call, either disable or guard re-invocation and test that public behavior, or control the boundary promises so attempt A remains pending, attempt B settles, then attempt A settles. Assert the final public state for both older-success\u002Fnewer-failure and older-failure\u002Fnewer-success orderings; call counts or internal tokens are not the oracle.\n- **Bootstrap red is not behavior red.** A focused command that fails only because the intended test file does not exist (for example, `no test files found`) can seed the loop only as `bootstrap red`. Before implementing behavior, follow it with the smallest failing assertion for the agreed seam, or record an explicit red-first skip reason if a true assertion red is impossible. Do not report a missing-test-file failure as proof that the behavior contract went red.\n- **Review findings restart the loop.** If review reveals missing behavior after the implementation is already green, add or adjust the smallest assertion first and run it red before fixing. If the code was already fixed to protect the tree or unblock verification, record that red-first was skipped and why. A review-fix evidence row that says only `fixed and covered` is not enough; it must include the red command\u002Ffailure or an explicit `red-first skipped because ...` reason.\n- **Standards-only review fixes do not need fake behavior reds.** If review finds a Standards-only, ADR-only, or conformance-only problem and the fix does not change acceptance behavior, record `red-first skipped because Standards-only\u002Fconformance-only fix did not change behavior`, rerun the affected focused and root gates, and refresh browser\u002Fmanual evidence only when the touched files affect a covered route, action, browser-consumed API shape, fixture, or data setup.\n- **Schema-heavy fixture setup is a precondition, not the behavior red.** When a tracer uses persisted records, temporary databases, serialized DTOs, or another setup surface with runtime-required fields, construct it through the public typed builder or parser and run the smallest setup-only probe when practical before the intended behavior red. A setup\u002Fschema failure does not count as the behavior red: record `partial red - wrong reason: fixture\u002Fsetup failed because ...`, repair only the fixture precondition, then rerun until the assertion fails for the intended acceptance behavior.\n- **Dependency state is a precondition, not a behavior red.** When a package manifest or lockfile changes, run the dependency install or synchronization command required by the root guidance before treating a focused or canonical command as red\u002Fgreen evidence. Classify missing-module, missing-binary, or workspace-link failures observed before synchronization as setup-only, repair the install, and rerun the original command.\n- **Cross-workspace build freshness is a precondition, not a behavior red.** Before interpreting a focused consumer test across a workspace boundary, establish whether the consumer resolves the upstream workspace's current source or built output. When it resolves built output, refresh the affected upstream workspace build before the baseline or red run and again after changing public exports, DTOs, or other consumed build artifacts. Record a stale-build failure as `partial red - wrong reason: stale upstream workspace build because ...`, refresh that build, and rerun the exact focused command before recording red or green behavior evidence.\n- **Robustness harnesses are assurance after behavior green.** When acceptance requires mutation, scoped coverage, property, metamorphic, or golden assurance, use `docs\u002FACTIVE-DOCS.md` to select and read the active development-assurance authority; in this repo that authority is `docs\u002Fspecs\u002Frobustness-testing.md`. Do not count runner, plugin-discovery, sandbox, symlink-traversal, or other harness setup failures as behavior red. Record the original command and failure, verify installed runner and plugin versions against the manifest and lockfile, preserve the exact changed-source, product, test, and mutation scopes, and justify exclusions only for proven non-product or non-test infrastructure. After behavior green, run the closest equivalent assurance command and the repository's canonical result gate; report the assurance step blocked when equivalence cannot be demonstrated.\n- **Copied stateful fixtures require consistent snapshots.** Create a copied database, world file, or other stateful fixture with an application-consistent snapshot mechanism, then probe the expected identity and state before using it for a red, green, or evidence-only row. For Worldloom SQLite files that may have live WAL state, use SQLite `.backup` or an explicit checkpoint-aware copy rather than raw `cp`; classify a failed, empty, or stale copy as superseded evidence.\n- **Authority-sensitive fixture identity stays explicit.** When an acceptance criterion, user instruction, or repository policy forbids publishing a machine-local fixture path, keep the path private and record `fixture paths withheld because \u003Cauthority and reason>; logical fixture \u003Cstable ID>; content SHA-256 \u003C64 hexadecimal characters>; provenance \u003Cgenerated, derived, or copied-source statement>` in the shared current-evidence inventory. Do not disguise a withheld path as `none` or `none published because`; the logical identity, content hash, and provenance preserve reproducibility without disclosing the path.\n- **Wrong-reason red is only partial red.** If a red command for a review fix fails because of a missing file, a generic invariant, an unrelated assertion, or any reason that does not prove the intended behavior is wrong, record `partial red - wrong reason: \u003Creason>`, then add or adjust the smallest assertion that fails for the intended behavior before patching. If no intended-behavior red is possible, record an explicit `red-first skipped because ...` reason.\n- **Unexpected green can be wrong-surface coverage.** If a new or adjusted assertion passes before the intended behavior fix, pause before counting it as proof. Verify the assertion observes the intended public route, panel, action, or source construct, not a legacy surface, nearby component, broad HTML\u002Fsource span, or incidental text. If the assertion was too broad, tighten it and run again until it fails for the intended missing behavior; record coverage-only proof only after confirming the behavior already truly exists.\n- **Coverage-only review fixes are different from behavior fixes.** If review reveals missing proof or coverage, but the behavior already exists, add the smallest assertion and run it. If it passes without a code change, record `coverage-only review fix; red-first N\u002FA because behavior already existed and no code changed`. If it fails, treat the finding as missing behavior and restart the red → green loop.\n- **Coverage-only existing behavior rows are initial-implementation proof rows, not review fixes.** If an issue requires proof for behavior that already exists and the new assertion passes before any production change, record `coverage-only existing behavior; red-first N\u002FA because behavior already existed and no production code changed`, cite the public seam and acceptance criterion, and verify the assertion observes the intended route, action, API, or source construct. If the assertion fails, treat it as missing behavior and restart the red → green loop. Do not use this phrase for review findings; use `coverage-only review fix` there.\n- **Review-fix evidence and freshness.** When review creates or changes a TDD row, use the canonical keyed review-fix map and freshness rules in [closeout-evidence.md](closeout-evidence.md). Give every finding one unique `RF-N` row, repeat that ID in the exact compact TDD row it updates, and keep each finding's red, green, durability, freshness, backend-currentness, and identity evidence together. A transient browser\u002Fmanual red must include `Regression durability:`; do not leave review-fix proof as prose-only notes or bundle several findings into one unkeyed entry.\n- **Record the loop.** For each slice, append lightweight evidence of the red command and expected failure, then the green command, to the durable sink named by `Pre-red evidence reference:` so line order or another recorded anchor preserves chronology. If red-first is skipped, say why. For focused commands, check the output confirms the intended file, seam, or assertion actually ran; if a package script does not forward file arguments cleanly, invoke the underlying runner directly.\n- **Existing-test failures after intended contract changes are regression evidence.** If an existing test fails after an intended behavior, schema, route, or artifact contract changes, record the failing command before editing the test. Update the expectation only when the spec, issue, or worked example authorizes the new behavior; otherwise fix the implementation. Rerun the focused command and any broader gate that exposed the failure. In the compact evidence table, put the failing existing-test command in `Red command\u002Ffailure` for the affected seam, or use a dedicated `existing contract-change expectation` row when the failure spans several acceptance rows. Reserve `Review fix \u002F red-first skip reason` for review findings, coverage-only review fixes, and explicit red-first skips. Closeout stop: if any existing test expectation was edited after a failing command, add an `existing contract-change expectation` row before the TDD closeout preflight; if none were edited, record `Existing-test contract-change rows: none`.\n- **Existing-test contract-change row means expectation rewrite.** Do not use `existing-test contract-change rows` merely because new assertions were added to an existing test file. It applies only when an existing expectation, snapshot, fixture assertion, route\u002Fschema expectation, or equivalent contract assertion was changed after a failing command and the issue\u002Fspec authorizes the new expected behavior. In that case, the compact table must include a row whose `Seam` cell is exactly `existing contract-change expectation`; otherwise record `Existing-test contract-change rows: none`.\n- **Docs-only and no-runnable criteria stay explicit.** If an acceptance criterion is a document deliverable, review\u002Fconformance claim, or otherwise has no runnable public seam, do not invent a test seam. Record red and green as `N\u002FA`, cite the review\u002Fconformance evidence, and carry the no-runnable reason in the compact evidence table.\n- **Browser\u002Fmanual evidence can be evidence-only.** If acceptance requires browser-visible, manual, screenshot, walkthrough, or other evidence that is not itself a red-first automated seam, record it as an evidence-only row instead of forcing a fake failing test. Set red to `N\u002FA` or an explicit red-first skip reason, and record the browser route, action path, observed outcome, artifact path, or walkthrough result in the green\u002Fevidence field. Record console error\u002Fwarning state next to the evidence or in the closeout preflight. Before starting or attaching to any proof server, inspect the configured API\u002FUI ports and their owning processes; record unrelated pre-existing owners without stopping or reusing them, then either prove the configured ports free or choose isolated proof-owned ports and align the UI proxy\u002FAPI base. Record the proof-owned session name, URL, command, or PID before relying on it; during cleanup, stop only proof-owned processes and state whether each was stopped, intentionally left running, or unrelated and pre-existing. When browser proof consumes a backend, reachability alone is not proof that the process serves the current code: record the server command and watch\u002Freload mode, confirm process and port ownership from the browser proof's execution context, restart or reload after relevant server\u002FAPI changes unless current-code reload is demonstrated, and run the smallest expected-shape API field or behavior probe before the final UI assertion. If currentness is uncertain or a stale process caused an error, restart the proof-owned backend and use a clean browser session. When browser proof uses a copied stateful fixture, record its snapshot method and source plus the expected-state probe that proved the copy current before the final UI assertion. If the proof spans hot reload\u002FHMR, reused browser sessions, agent-induced setup\u002Frequest errors, or unexplained console errors or warnings, treat it as preliminary and rerun a clean browser session on the final tree, or explicitly classify the console output as unrelated with evidence. For dense app screens or long single-page snapshots, keep evidence bounded: prefer targeted DOM\u002Ftext assertions, concise excerpts, and screenshots over full-page snapshot dumps. If later edits touch a route, UI action, browser-consumed API shape, fixture, or data setup covered by an evidence-only row, rerun the evidence on the final tree or record an explicit stale\u002Fblocked reason before closeout. If a later behavior-changing UI edit is outside the evidence-only route\u002Faction path, `not affected` is acceptable only when the closeout names the changed path, explains why the evidence route\u002Faction path and browser-consumed API\u002Ffixtures were untouched, and reruns targeted proof for the changed path.\n- **Published current evidence survives cleanup truthfully.** Before deleting proof-owned fixtures, scripts, packets, or artifacts, compare them with the published `Current evidence identities:` inventory and closeout references. A published current artifact is not safe to remove until closeout is complete and its retained-or-removed disposition is recorded. If it is removed after publication, update the durable evidence so it does not imply that the local artifact remains inspectable; retain the command\u002Fresult or tracker-hosted evidence needed to support the claim.\n- **Issue-level browser\u002Fmanual N\u002FA stays explicit.** If exact issue or PRD acceptance says browser\u002Fmanual proof is N\u002FA because the browser contract, routes, rendered behavior, validation response, fixtures, and action path are unchanged, do not create a fake evidence-only row. Record the exact issue\u002FPRD rationale in the row plan or compact table context, and carry it into closeout as `Evidence-only rows freshness: none - browser\u002Fmanual N\u002FA because ...` or an adjacent explicit N\u002FA note. Browser\u002Fmanual proof is still required for any changed browser-consumed surface or UI\u002Fbrowser-visible criterion that is not covered by the explicit N\u002FA.\n- **External\u002Fcold proof can be evidence-only.** If acceptance requires a cold external LLM, fresh subagent, packet-read, credentialed service, nonlocal probe, or other proof outside repo-local tests, record it as an evidence-only row or cite a per-criterion audit row in the same durable sink. Set red to `N\u002FA` or an explicit red-first skip reason, and record the exact packet\u002Fartifact\u002Freport path, subagent\u002Fprobe result, blocker, or same-sink audit-row citation in `Green command or evidence`. Do not let a focused test command stand in for external proof it did not exercise.\n- **One slice at a time.** One seam, one test, one minimal implementation per cycle. When a vertical slice legitimately spans several public seams, write the smallest tracer-bullet test at each seam, keep the issue\u002Faudit mapping explicit, and avoid bulk tests that are not tied to an acceptance criterion.\n- **Shared-boundary issue families still need tracer bullets.** When PRD child issues share one implementation boundary and separate red-green cycles would be artificial, write the smallest red tracer at each agreed seam, record the red failures by seam and issue, then implement the shared boundary while keeping the acceptance mapping explicit.\n- **Inventory shared-boundary seams before broad red tests.** Before writing the first broad tracer for a shared-boundary issue family, list every agreed seam and mark each one as `red-first`, `existing contract-change expectation`, `static contract check + browser evidence`, `coverage-only existing behavior`, `no-runnable`, or `evidence-only`. Instantiate the compact evidence table stub before the first red test: one row per in-scope issue and agreed seam, with `TBD` allowed only in command\u002Fevidence cells that cannot exist yet. Use that inventory as the row plan for the compact evidence table; if a seam cannot be classified, stop and clarify the seam before writing tests.\n- **Shared-boundary closeout hard stop.** Do not enter closeout for a shared-boundary issue family until the canonical compact evidence table in [closeout-evidence.md](closeout-evidence.md) has one row per agreed seam, or an explicit red-first skip reason for each seam that could not reasonably go red first.\n- **Implementation closeout consumes TDD evidence.** Before review, pre-close audit, issue closure, or parent PRD closeout, follow [closeout-evidence.md](closeout-evidence.md) and preserve the interim\u002Ffinal durable-sink fields there; do not rely on prose-only red\u002Fgreen notes surviving compaction.\n\n- **Refactoring is not part of the loop.** Incidental cleanup belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle. When the requested work is itself a behavior-preserving refactor with observable or static acceptance criteria, the loop can use a red tracer for the required contract plus behavior-preservation tests at the agreed seams.\n",{"name":5,"description":7},"main","bb13c72ec4134361fec0b0584913aee821330c02","reports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck","2026-11-10 23:00:02",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add joeloverbeck\u002Fcontinuity-loom --skill tdd",{"tool":35,"command":36},"bunx","bunx skills add joeloverbeck\u002Fcontinuity-loom --skill tdd",{"tool":38,"command":39},"pnpm","pnpm dlx skills add joeloverbeck\u002Fcontinuity-loom --skill tdd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002FSKILL.md",true,[43,49,53,59,63,67],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"closeout-evidence.md","REFERENCE","参考文档",49357,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Fcloseout-evidence.md",{"path":50,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":51,"sourceHtmlUrl":52},"mocking.md",3036,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Fmocking.md",{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"scripts\u002Ftdd-evidence-contract.mjs","SCRIPT","脚本",11272,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Fscripts\u002Ftdd-evidence-contract.mjs",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"scripts\u002Fvalidate-tdd-closeout-body.mjs",61438,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Fscripts\u002Fvalidate-tdd-closeout-body.mjs",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"scripts\u002Fvalidate-tdd-closeout-body.test.mjs",51318,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Fscripts\u002Fvalidate-tdd-closeout-body.test.mjs",{"path":68,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":69,"sourceHtmlUrl":70},"tests.md",7120,"https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftdd\u002Freviews\u002Frev_c08a5b3e-c82c-42b6-8958-8c636dba5e3c\u002Fcandidate\u002Ftests.md",[72,79,84,89,96,101],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M758XG3F9AESCQBKYQX0GPSD","triage","Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftriage\u002Freviews\u002Frev_a4ce832d-b023-4fa0-8d5d-382e558791d8\u002Fcandidate\u002FSKILL.md",[],[],{"skillNo":80,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M758XDY39PNPRY8FSXVE8SZN","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftriage\u002Fdecontamination\u002Fdec_2d4305f8-ee96-4376-a267-061413c4fdd6\u002Fcandidate\u002FSKILL.md",[],[],{"skillNo":85,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M758XB4XZ6N5XP8XZXWVMVQ0","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Ftriage\u002Fdecontamination\u002Fdec_2d4305f8-ee96-4376-a267-061413c4fdd6\u002Fbaseline\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M758X7WRCGV9BM5RNEGH4MSX","to-prd","Turn the current conversation into a PRD and publish it to the project issue tracker — no requirements interview, just synthesis of what you've already discussed; the seam confirmation is the sole checkpoint.","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Fto-prd\u002Fdecontamination\u002Fdec_581ad8e4-4f9d-4aad-a6ee-59eeec05c8a4\u002Fpre-land-backup\u002FSKILL.md",[],[],{"skillNo":97,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":18},"01M758X55QJQTVHH1MWHJF2BBZ","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Fto-prd\u002Fdecontamination\u002Fdec_581ad8e4-4f9d-4aad-a6ee-59eeec05c8a4\u002Fcandidate\u002FSKILL.md",[],[],{"skillNo":102,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":18},"01M758X1Z0F2YRRHNTR3ZCY02C","https:\u002F\u002Fgithub.com\u002Fjoeloverbeck\u002Fcontinuity-loom\u002Fblob\u002Fmain\u002Freports\u002Fskill-evidence\u002Fto-prd\u002Fdecontamination\u002Fdec_581ad8e4-4f9d-4aad-a6ee-59eeec05c8a4\u002Fbaseline\u002FSKILL.md",[],[]]