[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71G1P8M1ZC4Y77WQB99QZQN":3,"skill-same:01M71G1P8M1ZC4Y77WQB99QZQN":73},{"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":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":14,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":72},"01M71G1P8M1ZC4Y77WQB99QZQN","author-typescript-test",null,"ALWAYS invoke this skill when writing or fixing tests for TypeScript. NEVER write or fix TypeScript tests without this skill.","outcomeeng\u002Fplugins","outcomeeng","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257335685?v=4","01M71FRVRF36XYR3HRSCGFHK2R","Outcome Engineering","01M71FRVS4BZG17DWANFJ7EPNY",1,"MIT","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Ftypescript\u002Fskills\u002Fauthor-typescript-test\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"typescript","author typescript test","author","test","invoke","use","writing","npx","tests","grep","edit","fix","eslint","node","write","tool","read","for","vitest","never","2026-11-10 10:12:30",false,"---\nname: author-typescript-test\ndescription: >-\n  ALWAYS invoke this skill when writing or fixing tests for TypeScript.\n  NEVER write or fix TypeScript tests without this skill.\nargument-hint: \"\u003Cfull-spx-node-path>\"\narguments: node_path\nallowed-tools: Read, Glob, Grep, Write, Edit, {{! tool('use_skill') !}}, Bash(npx tsc:*), Bash(npx eslint:*), Bash(npx vitest:*)\n---\n\n{!% require_skill 'typescript:typescript-code-standards' %!}\n\n{!% require_skill 'typescript:typescript-test-standards' %!}\n\n{!% require_skill 'product-tree:test' %!}\n\n\u003Cobjective>\nTypeScript test files that supply evidence for a node specification's assertions.\n\u003C\u002Fobjective>\n\n\u003Cinput_contract>\n`$node_path` is the full `spx\u002F...` path to the governing node. If `$node_path` is empty, stop and report that the governing node path is required before test evidence can be written or repaired.\n\u003C\u002Finput_contract>\n\n\u003Cmode_detection>\n**Determine the current mode:**\n\n1. **WRITE mode** - Tests do not exist yet, or starting fresh\n   - Check: Glob `$node_path\u002Ftests\u002F*.ts`; no matches or only scaffold files means WRITE mode\n   - Action: Follow full workflow below\n\n2. **FIX mode** - Tests exist but were rejected by reviewer\n   - Check: Recent `\u002Faudit-typescript-test` output shows `REJECTED` with specific failing rows or findings\n   - Action: Read the rejection, fix the specific issues, re-run tests\n\n**Always check which mode before proceeding.**\n\u003C\u002Fmode_detection>\n\n\u003Cquick_start>\n**Input:** Governing node path from `$node_path`\n\n**Output:** Test files written to `$node_path\u002Ftests\u002F` directory\n\n**Prerequisites:** Standards and the `\u002Ftest` router are pre-loaded above. After `\u002Fverify` selects test, `\u002Ftest` chooses the assertion type and level; this skill implements those decisions in TypeScript.\n\n**Command placeholders:** Resolve `\u003Cproduct-test-command>`, `\u003Cproduct-typecheck-command>`, `\u003Cproduct-lint-command>`, and optional `\u003Cproduct-lint-fix-command>` from repository docs, package scripts, Makefile, Justfile, or local agent instructions. When sources conflict, use this priority: local agent instructions, repository docs, Justfile, Makefile, package scripts, raw tool fallback. Fallback examples for repos without wrappers: `npx vitest run`, `npx tsc --noEmit`, `npx eslint src\u002F test\u002F`, and `npx eslint src\u002F test\u002F --fix`. If a wrapper rejects a path suffix, run the closest supported focused command and record the exact command used.\n\n`allowed-tools` preapproves only the listed raw-tool fallbacks. A repository-canonical wrapper outside those patterns uses the runtime's normal per-call approval path; NEVER select a fallback merely to avoid that approval.\n\n**Workflow:**\n\n```\nCheck mode -> WRITE or FIX -> Execute -> Verify -> Report\n```\n\n\u003C\u002Fquick_start>\n\n\u003Cwrite_mode_workflow>\n\n**WRITE Mode: Creating New Tests**\n\n**Step 1: Load Context**\n\nRequire a live `\u003CPRODUCT_TREE_FOUNDATION>` marker; use skill `product-tree:understand` when it is absent. Use skill `product-tree:contextualize` with the full node path and require the matching live `\u003CPRODUCT_TREE_CONTEXT>` marker before reading test bodies or writing evidence. Use that context rather than reconstructing ancestor, sibling, or decision reads with shell commands.\n\nExtract from the spec:\n\n- **Assertions** - Typed assertions to verify\n- **Test Strategy** - Which levels are specified\n- **Harnesses** - Any referenced test harnesses\n\n**Step 2: Determine Evidence and Level**\n\nFor each assertion, apply the `\u002Ftest` methodology:\n\n| Evidence location               | Minimum level |\n| ------------------------------- | ------------- |\n| Pure computation\u002Falgorithm      | `l1`          |\n| File I\u002FO with temp dirs         | `l1`          |\n| Standard dev tools (git, curl)  | `l1`          |\n| Product-specific binary         | `l2`          |\n| Database, Docker                | `l2`          |\n| Real credentials, external APIs | `l3`          |\n\n**Step 3: Apply the source-contract-first gate**\n\nRead the assertion, the existing or planned test, and the TypeScript code under test. State the production contract the evidence exercises. If the source does not expose the needed type, enum, constructor, schema, parser entry point, registry, route, command, dependency boundary, or observable behavior, fix the source contract before writing test predicates.\n\nDo not patch a predicate around a reviewer example, copy source literals into tests, hide values in fixtures or generators, or replace the behavior under test with a mock.\n\n**Step 4: Write Test Files**\n\nCreate test files following `\u002Ftypescript-test-standards`:\n\n**Mandatory elements:**\n\n- File naming: `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`\n- Type annotations on all interfaces and function parameters\n- No test-file `const`, `let`, `var`, fixture-parameter, or property-parameter declarations; import source-owned values from production modules and call harnesses or generators inline\n- Property-based tests for parsers\u002Fserializers\u002Fmath (`assertProperty(parserRoundtripProperty())`)\n- No `vi.mock()` or `vi.fn()` replacing the dependency under test -- use typed DI interfaces\n- Vitest as default runner; `playwright` runner token when needed\n\n**Step 5: Verify Tests Fail (RED)**\n\n```bash\n# Resolve from repo docs or scripts; fallback: npx vitest run\n\u003Cproduct-test-command> $node_path\u002Ftests\u002F\n```\n\nIf the canonical wrapper rejects a path suffix, run the closest supported focused command and record the exact command used. For example, use a wrapper-provided filter flag, a package script that accepts `--`, or the full product test command when no focused form exists.\n\nTests should FAIL with import errors or assertion errors (implementation does not exist yet).\n\n**Step 6: Handle Specified Nodes**\n\nIf the implementation module does not exist yet, tests fail on import -- breaking the quality gate. Add the portion of `$node_path` relative to `spx\u002F` to `spx\u002FEXCLUDE` using the repository's file-editing tool.\n\nThe `spx` CLI reads this file and skips excluded nodes when running `spx test passing`. Remove the entry from `spx\u002FEXCLUDE` when implementation begins.\n\n\u003C\u002Fwrite_mode_workflow>\n\n\u003Cliteral_reuse_remediation>\n\n**Literal-Reuse Findings: What They Mean and How to Fix Them**\n\nThe literal checker (`spx validation literal`) reports two finding kinds:\n\n- `[reuse]` — a string\u002Fnumber in a test file also appears in a source file\n- `[dupe]` — the same string\u002Fnumber appears in two or more test files\n\n**These findings are a test quality signal, not a naming problem.**\n\nWhen a specific value like `\"src\u002Ffoo.ts\"` appears in three test files, those three tests are asserting that the code handles exactly that path. They confirm the author's expectation about one hand-picked input. They reveal nothing about inputs the author didn't think of.\n\n**The WRONG fix: shared constants (\"literal laundering\")**\n\n```typescript\n\u002F\u002F ❌ REJECTED: moving the hardcoded string to a constant changes nothing\nconst FIXTURE_SOURCE_PATH = \"src\u002Ffoo.ts\";\nexpect(result).toBe(FIXTURE_SOURCE_PATH);\n```\n\nThis is literal laundering. The test now uses a named constant, but it still asserts on a single specific value chosen by the test author. The bug-finding surface is identical — zero.\n\nShared test-owned constants that group hardcoded values (`TEST_FIXTURES`, `SAMPLE_PATHS`, etc.) are the same antipattern at scale.\n\n**The RIGHT fix: source contracts and domain generators**\n\nEvery string or number in a test represents either source-owned protocol data or an input domain. Identify the owner first.\n\nWhen the value is source-owned, improve the code under test so the owner exports a registry, typed constructor, or source-owned constant, then import that source API directly. When the value is test input with a real domain, use or create an `fc.Arbitrary` for it:\n\n```typescript\nimport { arbitrarySourceFilePath } from \"@testing\u002Fgenerators\u002Fpaths\";\nimport { assertProperty } from \"@testing\u002Fharnesses\u002Fproperties\";\nimport { sourcePathProcessingProperty } from \"@testing\u002Fharnesses\u002Fproperties\u002Fsource-paths\";\n\nassertProperty(\n  sourcePathProcessingProperty(arbitrarySourceFilePath(), processPath),\n);\n```\n\n**Decision table for literal-reuse findings**\n\n| Finding                                                | What the value represents                                | Fix                                                                   |\n| ------------------------------------------------------ | -------------------------------------------------------- | --------------------------------------------------------------------- |\n| Value also appears in `src\u002F`                           | Source-owned constant (command name, status token, etc.) | Import the constant from the production module                        |\n| Value is a source-owned singleton shape                | Source contract                                          | Export a typed constructor or registry from source, then import it    |\n| Value is variable input data (path, name, ID, content) | Domain value                                             | Use or create an `fc.Arbitrary` in `testing\u002Fgenerators\u002F`              |\n| Value is an expected output                            | Derived from input                                       | Compute it from the input inside the property test                    |\n| Value is a specific error message that IS the contract | Exact error text                                         | Allowed only in compliance tests that assert the exact message format |\n\n**When no generator exists for the domain**\n\nCreate one only when the domain has meaningful variability or composition. The generator lives in `testing\u002Fgenerators\u002F{domain}.ts` and is imported via `@testing\u002Fgenerators\u002F{domain}`.\n\nDo not create a generator that only returns `fc.constant(...)` for a singleton object. Improve the source module so it owns that constructor, then import it directly.\n\n**The only valid hardcoded strings in test files**\n\n- `describe` \u002F `it` block titles\n- Exact error message text in compliance tests where the format IS the contract (not a guess)\n- Import paths\n\nEverything else is source-owned data (import it), source-owned construction (export and import it), or variable input data (generate it).\n\n\u003C\u002Fliteral_reuse_remediation>\n\n\u003Cfix_mode_workflow>\n\n**FIX Mode: Fixing Rejected Tests**\n\n**Step 1: Read Rejection Feedback**\n\nFind the most recent `\u002Faudit-typescript-test` output. Look for:\n\n- Specific file:line locations\n- Issue categories (evidentiary gap, missing property tests, etc.)\n- Required fixes\n\n**Step 2: Apply Fixes**\n\nFor each rejection reason:\n\n| Rejection Category             | Fix Action                                                              |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| Evidentiary gap                | Rewrite test to actually verify the assertion                           |\n| `vi.mock()` detected           | Replace with typed DI interface                                         |\n| `vi.fn()` testing call details | Replace with typed spy class or recording object                        |\n| Missing property tests         | Add `assertProperty(parserRoundtripProperty())` for parsers\u002Fserializers |\n| Source-owned value redefined   | Import from production module instead                                   |\n| Wrong filename axes            | Rename to `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`             |\n| Literal `[dupe]` \u002F `[reuse]`   | See `\u003Cliteral_reuse_remediation>` — generators, not shared constants    |\n\n**Step 3: Verify Fixes**\n\n```bash\n# Run the node tests through the repository's canonical test command; fallback: npx vitest run\n\u003Cproduct-test-command> $node_path\u002Ftests\u002F\n\n# Run the repository's canonical TypeScript validation; fallback: npx tsc --noEmit\n\u003Cproduct-typecheck-command>\n\n# Run the repository's canonical lint validation for the changed files; fallback: npx eslint src\u002F test\u002F\n\u003Cproduct-lint-command> $node_path\u002Ftests\u002F\n```\n\n**Step 4: Report What Was Fixed**\n\n```markdown\n**Tests Fixed**\n\n**Issues Addressed**\n\n| Issue           | Location       | Fix Applied                       |\n| --------------- | -------------- | --------------------------------- |\n| vi.mock() usage | foo.test.ts:15 | Replaced with typed DI interface  |\n| Magic value     | foo.test.ts:23 | Imported STATUS_CODES from module |\n\n**Verification**\n\n- Test command: `\u003Cexact command>` — `\u003Crequired RED or GREEN result>`\n- Type-check command: `\u003Cexact command>` — passed\n- Lint\u002Fformat command: `\u003Cexact command>` — passed\n\nIf a required command cannot pass, report the exact command and blocking cause instead of claiming the tests are ready for re-review.\n```\n\n\u003C\u002Ffix_mode_workflow>\n\n\u003Ctest_writing_checklist>\n\nBefore declaring tests complete:\n\n- [ ] Each spec assertion has at least one test\n- [ ] Assertion type and level match `\u002Ftest` Stage 2\n- [ ] File names use `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`\n- [ ] Test files contain no `const`, `let`, `var`, fixture-parameter, or property-parameter declarations\n- [ ] No `vi.mock()` or `vi.fn()` replacing the dependency under test\n- [ ] Doubles are typed interfaces passed through DI\n- [ ] Property assertions use meaningful `fast-check` properties through a seed-reporting wrapper\n- [ ] Source-owned values imported from production modules\n- [ ] Source-owned singleton shapes come from production constructors, not test constants or constant-only generators\n- [ ] Variable input data comes from generators (`fc.Arbitrary`), not hardcoded constants\n- [ ] No test-owned constant groups like `TEST_FIXTURES`, `SAMPLE_PATHS`, etc.\n- [ ] Tests run and fail for expected reasons (RED phase)\n\n\u003C\u002Ftest_writing_checklist>\n\n\u003Cpatterns_reference>\n\nSee `\u002Ftypescript-test-standards` for:\n\n- **File naming** - Evidence, level, and runner axes\n- **Level tooling** - Vitest vs Playwright, l1\u002Fl2\u002Fl3 infrastructure\n- **Router mapping** - `\u002Ftest` Stage decisions to TypeScript patterns\n- **l1 patterns** - Pure functions, typed factories, temp dirs\n- **Exception implementations** - The 6 exception cases in TypeScript\n- **l2 patterns** - Typed harness factory and usage\n- **l3 patterns** - Credential management, fail-loudly policy\n- **Dependency injection** - Typed interfaces and recording doubles\n- **Property-based testing** - `fast-check` patterns\n- **Test data policy** - Source-owned constants, generators, harnesses, fixtures\n- **Anti-patterns** - What to reject or rewrite\n\nRead the matching level guide from `\u002Ftypescript-test-standards` after choosing a level:\n\n- `\u002Ftypescript-test-standards` `levels\u002Fl1-local-deterministic.md` - pure functions, temp dirs, standard local tools, Stage 5 doubles\n- `\u002Ftypescript-test-standards` `levels\u002Fl2-local-infrastructure.md` - Docker, local services, browsers, and product binaries\n- `\u002Ftypescript-test-standards` `levels\u002Fl3-remote-credentialed.md` - remote services, shared environments, and credentials\n\nAlso check for `spx\u002Flocal\u002Ftypescript-tests.md` at the repository root -- product-specific overrides apply after this reference.\n\n\u003C\u002Fpatterns_reference>\n\n\u003Coutput_format>\n\n**WRITE mode output:**\n\n```markdown\n**Tests Written**\n\n**Node: $node_path**\n\n**Test Files Created**\n\n| File                            | Level | Assertions Covered |\n| ------------------------------- | ----- | ------------------ |\n| `tests\u002Ffoo.scenario.l1.test.ts` | `l1`  | Assertion 1, 2     |\n\n**Test Run (RED Phase)**\n\nTests fail as expected. Ready for review.\n```\n\n**FIX mode output:**\n\n```markdown\n**Tests Fixed**\n\n**Issues Addressed**\n\n| Issue   | Location    | Fix Applied |\n| ------- | ----------- | ----------- |\n| {issue} | {file:line} | {fix}       |\n\n**Verification**\n\n- Test command: `{exact command}` — `{required RED or GREEN result}`\n- Type-check command: `{exact command}` — passed\n- Lint\u002Fformat command: `{exact command}` — passed\n\nThe checklist and every required validation pass. Ready for re-review.\n```\n\n\u003C\u002Foutput_format>\n\n\u003Csuccess_criteria>\n\nTest evidence is ready for review when:\n\n- [ ] Every created or changed test file lives in the governed node's `tests\u002F` directory and is linked from the corresponding spec assertion\n- [ ] The test filenames and assertion mapping follow `\u002Ftypescript-test-standards` and any `spx\u002Flocal\u002Ftypescript-tests.md` overlay loaded for the repository\n- [ ] The product's resolved TypeScript test command demonstrates the required RED or GREEN phase result for the governed node or changeset\n- [ ] FIX mode addresses every supplied reviewer finding with a test change or a stated evidence-based rejection\n- [ ] In FIX mode, the product's resolved TypeScript type-check and lint\u002Fformat commands pass; otherwise the report names each blocked command and its exact blocking cause and does not claim readiness\n\n\u003C\u002Fsuccess_criteria>\n","{!% require_skill 'typescript:typescript-code-standards' %!}\n\n{!% require_skill 'typescript:typescript-test-standards' %!}\n\n{!% require_skill 'product-tree:test' %!}\n\n\u003Cobjective>\nTypeScript test files that supply evidence for a node specification's assertions.\n\u003C\u002Fobjective>\n\n\u003Cinput_contract>\n`$node_path` is the full `spx\u002F...` path to the governing node. If `$node_path` is empty, stop and report that the governing node path is required before test evidence can be written or repaired.\n\u003C\u002Finput_contract>\n\n\u003Cmode_detection>\n**Determine the current mode:**\n\n1. **WRITE mode** - Tests do not exist yet, or starting fresh\n   - Check: Glob `$node_path\u002Ftests\u002F*.ts`; no matches or only scaffold files means WRITE mode\n   - Action: Follow full workflow below\n\n2. **FIX mode** - Tests exist but were rejected by reviewer\n   - Check: Recent `\u002Faudit-typescript-test` output shows `REJECTED` with specific failing rows or findings\n   - Action: Read the rejection, fix the specific issues, re-run tests\n\n**Always check which mode before proceeding.**\n\u003C\u002Fmode_detection>\n\n\u003Cquick_start>\n**Input:** Governing node path from `$node_path`\n\n**Output:** Test files written to `$node_path\u002Ftests\u002F` directory\n\n**Prerequisites:** Standards and the `\u002Ftest` router are pre-loaded above. After `\u002Fverify` selects test, `\u002Ftest` chooses the assertion type and level; this skill implements those decisions in TypeScript.\n\n**Command placeholders:** Resolve `\u003Cproduct-test-command>`, `\u003Cproduct-typecheck-command>`, `\u003Cproduct-lint-command>`, and optional `\u003Cproduct-lint-fix-command>` from repository docs, package scripts, Makefile, Justfile, or local agent instructions. When sources conflict, use this priority: local agent instructions, repository docs, Justfile, Makefile, package scripts, raw tool fallback. Fallback examples for repos without wrappers: `npx vitest run`, `npx tsc --noEmit`, `npx eslint src\u002F test\u002F`, and `npx eslint src\u002F test\u002F --fix`. If a wrapper rejects a path suffix, run the closest supported focused command and record the exact command used.\n\n`allowed-tools` preapproves only the listed raw-tool fallbacks. A repository-canonical wrapper outside those patterns uses the runtime's normal per-call approval path; NEVER select a fallback merely to avoid that approval.\n\n**Workflow:**\n\n```\nCheck mode -> WRITE or FIX -> Execute -> Verify -> Report\n```\n\n\u003C\u002Fquick_start>\n\n\u003Cwrite_mode_workflow>\n\n**WRITE Mode: Creating New Tests**\n\n**Step 1: Load Context**\n\nRequire a live `\u003CPRODUCT_TREE_FOUNDATION>` marker; use skill `product-tree:understand` when it is absent. Use skill `product-tree:contextualize` with the full node path and require the matching live `\u003CPRODUCT_TREE_CONTEXT>` marker before reading test bodies or writing evidence. Use that context rather than reconstructing ancestor, sibling, or decision reads with shell commands.\n\nExtract from the spec:\n\n- **Assertions** - Typed assertions to verify\n- **Test Strategy** - Which levels are specified\n- **Harnesses** - Any referenced test harnesses\n\n**Step 2: Determine Evidence and Level**\n\nFor each assertion, apply the `\u002Ftest` methodology:\n\n| Evidence location               | Minimum level |\n| ------------------------------- | ------------- |\n| Pure computation\u002Falgorithm      | `l1`          |\n| File I\u002FO with temp dirs         | `l1`          |\n| Standard dev tools (git, curl)  | `l1`          |\n| Product-specific binary         | `l2`          |\n| Database, Docker                | `l2`          |\n| Real credentials, external APIs | `l3`          |\n\n**Step 3: Apply the source-contract-first gate**\n\nRead the assertion, the existing or planned test, and the TypeScript code under test. State the production contract the evidence exercises. If the source does not expose the needed type, enum, constructor, schema, parser entry point, registry, route, command, dependency boundary, or observable behavior, fix the source contract before writing test predicates.\n\nDo not patch a predicate around a reviewer example, copy source literals into tests, hide values in fixtures or generators, or replace the behavior under test with a mock.\n\n**Step 4: Write Test Files**\n\nCreate test files following `\u002Ftypescript-test-standards`:\n\n**Mandatory elements:**\n\n- File naming: `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`\n- Type annotations on all interfaces and function parameters\n- No test-file `const`, `let`, `var`, fixture-parameter, or property-parameter declarations; import source-owned values from production modules and call harnesses or generators inline\n- Property-based tests for parsers\u002Fserializers\u002Fmath (`assertProperty(parserRoundtripProperty())`)\n- No `vi.mock()` or `vi.fn()` replacing the dependency under test -- use typed DI interfaces\n- Vitest as default runner; `playwright` runner token when needed\n\n**Step 5: Verify Tests Fail (RED)**\n\n```bash\n# Resolve from repo docs or scripts; fallback: npx vitest run\n\u003Cproduct-test-command> $node_path\u002Ftests\u002F\n```\n\nIf the canonical wrapper rejects a path suffix, run the closest supported focused command and record the exact command used. For example, use a wrapper-provided filter flag, a package script that accepts `--`, or the full product test command when no focused form exists.\n\nTests should FAIL with import errors or assertion errors (implementation does not exist yet).\n\n**Step 6: Handle Specified Nodes**\n\nIf the implementation module does not exist yet, tests fail on import -- breaking the quality gate. Add the portion of `$node_path` relative to `spx\u002F` to `spx\u002FEXCLUDE` using the repository's file-editing tool.\n\nThe `spx` CLI reads this file and skips excluded nodes when running `spx test passing`. Remove the entry from `spx\u002FEXCLUDE` when implementation begins.\n\n\u003C\u002Fwrite_mode_workflow>\n\n\u003Cliteral_reuse_remediation>\n\n**Literal-Reuse Findings: What They Mean and How to Fix Them**\n\nThe literal checker (`spx validation literal`) reports two finding kinds:\n\n- `[reuse]` — a string\u002Fnumber in a test file also appears in a source file\n- `[dupe]` — the same string\u002Fnumber appears in two or more test files\n\n**These findings are a test quality signal, not a naming problem.**\n\nWhen a specific value like `\"src\u002Ffoo.ts\"` appears in three test files, those three tests are asserting that the code handles exactly that path. They confirm the author's expectation about one hand-picked input. They reveal nothing about inputs the author didn't think of.\n\n**The WRONG fix: shared constants (\"literal laundering\")**\n\n```typescript\n\u002F\u002F ❌ REJECTED: moving the hardcoded string to a constant changes nothing\nconst FIXTURE_SOURCE_PATH = \"src\u002Ffoo.ts\";\nexpect(result).toBe(FIXTURE_SOURCE_PATH);\n```\n\nThis is literal laundering. The test now uses a named constant, but it still asserts on a single specific value chosen by the test author. The bug-finding surface is identical — zero.\n\nShared test-owned constants that group hardcoded values (`TEST_FIXTURES`, `SAMPLE_PATHS`, etc.) are the same antipattern at scale.\n\n**The RIGHT fix: source contracts and domain generators**\n\nEvery string or number in a test represents either source-owned protocol data or an input domain. Identify the owner first.\n\nWhen the value is source-owned, improve the code under test so the owner exports a registry, typed constructor, or source-owned constant, then import that source API directly. When the value is test input with a real domain, use or create an `fc.Arbitrary` for it:\n\n```typescript\nimport { arbitrarySourceFilePath } from \"@testing\u002Fgenerators\u002Fpaths\";\nimport { assertProperty } from \"@testing\u002Fharnesses\u002Fproperties\";\nimport { sourcePathProcessingProperty } from \"@testing\u002Fharnesses\u002Fproperties\u002Fsource-paths\";\n\nassertProperty(\n  sourcePathProcessingProperty(arbitrarySourceFilePath(), processPath),\n);\n```\n\n**Decision table for literal-reuse findings**\n\n| Finding                                                | What the value represents                                | Fix                                                                   |\n| ------------------------------------------------------ | -------------------------------------------------------- | --------------------------------------------------------------------- |\n| Value also appears in `src\u002F`                           | Source-owned constant (command name, status token, etc.) | Import the constant from the production module                        |\n| Value is a source-owned singleton shape                | Source contract                                          | Export a typed constructor or registry from source, then import it    |\n| Value is variable input data (path, name, ID, content) | Domain value                                             | Use or create an `fc.Arbitrary` in `testing\u002Fgenerators\u002F`              |\n| Value is an expected output                            | Derived from input                                       | Compute it from the input inside the property test                    |\n| Value is a specific error message that IS the contract | Exact error text                                         | Allowed only in compliance tests that assert the exact message format |\n\n**When no generator exists for the domain**\n\nCreate one only when the domain has meaningful variability or composition. The generator lives in `testing\u002Fgenerators\u002F{domain}.ts` and is imported via `@testing\u002Fgenerators\u002F{domain}`.\n\nDo not create a generator that only returns `fc.constant(...)` for a singleton object. Improve the source module so it owns that constructor, then import it directly.\n\n**The only valid hardcoded strings in test files**\n\n- `describe` \u002F `it` block titles\n- Exact error message text in compliance tests where the format IS the contract (not a guess)\n- Import paths\n\nEverything else is source-owned data (import it), source-owned construction (export and import it), or variable input data (generate it).\n\n\u003C\u002Fliteral_reuse_remediation>\n\n\u003Cfix_mode_workflow>\n\n**FIX Mode: Fixing Rejected Tests**\n\n**Step 1: Read Rejection Feedback**\n\nFind the most recent `\u002Faudit-typescript-test` output. Look for:\n\n- Specific file:line locations\n- Issue categories (evidentiary gap, missing property tests, etc.)\n- Required fixes\n\n**Step 2: Apply Fixes**\n\nFor each rejection reason:\n\n| Rejection Category             | Fix Action                                                              |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| Evidentiary gap                | Rewrite test to actually verify the assertion                           |\n| `vi.mock()` detected           | Replace with typed DI interface                                         |\n| `vi.fn()` testing call details | Replace with typed spy class or recording object                        |\n| Missing property tests         | Add `assertProperty(parserRoundtripProperty())` for parsers\u002Fserializers |\n| Source-owned value redefined   | Import from production module instead                                   |\n| Wrong filename axes            | Rename to `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`             |\n| Literal `[dupe]` \u002F `[reuse]`   | See `\u003Cliteral_reuse_remediation>` — generators, not shared constants    |\n\n**Step 3: Verify Fixes**\n\n```bash\n# Run the node tests through the repository's canonical test command; fallback: npx vitest run\n\u003Cproduct-test-command> $node_path\u002Ftests\u002F\n\n# Run the repository's canonical TypeScript validation; fallback: npx tsc --noEmit\n\u003Cproduct-typecheck-command>\n\n# Run the repository's canonical lint validation for the changed files; fallback: npx eslint src\u002F test\u002F\n\u003Cproduct-lint-command> $node_path\u002Ftests\u002F\n```\n\n**Step 4: Report What Was Fixed**\n\n```markdown\n**Tests Fixed**\n\n**Issues Addressed**\n\n| Issue           | Location       | Fix Applied                       |\n| --------------- | -------------- | --------------------------------- |\n| vi.mock() usage | foo.test.ts:15 | Replaced with typed DI interface  |\n| Magic value     | foo.test.ts:23 | Imported STATUS_CODES from module |\n\n**Verification**\n\n- Test command: `\u003Cexact command>` — `\u003Crequired RED or GREEN result>`\n- Type-check command: `\u003Cexact command>` — passed\n- Lint\u002Fformat command: `\u003Cexact command>` — passed\n\nIf a required command cannot pass, report the exact command and blocking cause instead of claiming the tests are ready for re-review.\n```\n\n\u003C\u002Ffix_mode_workflow>\n\n\u003Ctest_writing_checklist>\n\nBefore declaring tests complete:\n\n- [ ] Each spec assertion has at least one test\n- [ ] Assertion type and level match `\u002Ftest` Stage 2\n- [ ] File names use `\u003Csubject>.\u003Cevidence>.\u003Clevel>[.\u003Crunner>].test.ts`\n- [ ] Test files contain no `const`, `let`, `var`, fixture-parameter, or property-parameter declarations\n- [ ] No `vi.mock()` or `vi.fn()` replacing the dependency under test\n- [ ] Doubles are typed interfaces passed through DI\n- [ ] Property assertions use meaningful `fast-check` properties through a seed-reporting wrapper\n- [ ] Source-owned values imported from production modules\n- [ ] Source-owned singleton shapes come from production constructors, not test constants or constant-only generators\n- [ ] Variable input data comes from generators (`fc.Arbitrary`), not hardcoded constants\n- [ ] No test-owned constant groups like `TEST_FIXTURES`, `SAMPLE_PATHS`, etc.\n- [ ] Tests run and fail for expected reasons (RED phase)\n\n\u003C\u002Ftest_writing_checklist>\n\n\u003Cpatterns_reference>\n\nSee `\u002Ftypescript-test-standards` for:\n\n- **File naming** - Evidence, level, and runner axes\n- **Level tooling** - Vitest vs Playwright, l1\u002Fl2\u002Fl3 infrastructure\n- **Router mapping** - `\u002Ftest` Stage decisions to TypeScript patterns\n- **l1 patterns** - Pure functions, typed factories, temp dirs\n- **Exception implementations** - The 6 exception cases in TypeScript\n- **l2 patterns** - Typed harness factory and usage\n- **l3 patterns** - Credential management, fail-loudly policy\n- **Dependency injection** - Typed interfaces and recording doubles\n- **Property-based testing** - `fast-check` patterns\n- **Test data policy** - Source-owned constants, generators, harnesses, fixtures\n- **Anti-patterns** - What to reject or rewrite\n\nRead the matching level guide from `\u002Ftypescript-test-standards` after choosing a level:\n\n- `\u002Ftypescript-test-standards` `levels\u002Fl1-local-deterministic.md` - pure functions, temp dirs, standard local tools, Stage 5 doubles\n- `\u002Ftypescript-test-standards` `levels\u002Fl2-local-infrastructure.md` - Docker, local services, browsers, and product binaries\n- `\u002Ftypescript-test-standards` `levels\u002Fl3-remote-credentialed.md` - remote services, shared environments, and credentials\n\nAlso check for `spx\u002Flocal\u002Ftypescript-tests.md` at the repository root -- product-specific overrides apply after this reference.\n\n\u003C\u002Fpatterns_reference>\n\n\u003Coutput_format>\n\n**WRITE mode output:**\n\n```markdown\n**Tests Written**\n\n**Node: $node_path**\n\n**Test Files Created**\n\n| File                            | Level | Assertions Covered |\n| ------------------------------- | ----- | ------------------ |\n| `tests\u002Ffoo.scenario.l1.test.ts` | `l1`  | Assertion 1, 2     |\n\n**Test Run (RED Phase)**\n\nTests fail as expected. Ready for review.\n```\n\n**FIX mode output:**\n\n```markdown\n**Tests Fixed**\n\n**Issues Addressed**\n\n| Issue   | Location    | Fix Applied |\n| ------- | ----------- | ----------- |\n| {issue} | {file:line} | {fix}       |\n\n**Verification**\n\n- Test command: `{exact command}` — `{required RED or GREEN result}`\n- Type-check command: `{exact command}` — passed\n- Lint\u002Fformat command: `{exact command}` — passed\n\nThe checklist and every required validation pass. Ready for re-review.\n```\n\n\u003C\u002Foutput_format>\n\n\u003Csuccess_criteria>\n\nTest evidence is ready for review when:\n\n- [ ] Every created or changed test file lives in the governed node's `tests\u002F` directory and is linked from the corresponding spec assertion\n- [ ] The test filenames and assertion mapping follow `\u002Ftypescript-test-standards` and any `spx\u002Flocal\u002Ftypescript-tests.md` overlay loaded for the repository\n- [ ] The product's resolved TypeScript test command demonstrates the required RED or GREEN phase result for the governed node or changeset\n- [ ] FIX mode addresses every supplied reviewer finding with a test change or a stated evidence-based rejection\n- [ ] In FIX mode, the product's resolved TypeScript type-check and lint\u002Fformat commands pass; otherwise the report names each blocked command and its exact blocking cause and does not claim readiness\n\n\u003C\u002Fsuccess_criteria>\n",{"name":5,"arguments":49,"description":7,"allowed-tools":50,"argument-hint":51},"node_path","Read, Glob, Grep, Write, Edit, {{! tool('use_skill') !}}, Bash(npx tsc:*), Bash(npx eslint:*), Bash(npx vitest:*)","\u003Cfull-spx-node-path>","main","978d51c51d68c99cffb2ba48f7cad9d2f07e5738","src\u002Fplugins\u002Ftypescript\u002Fskills\u002Fauthor-typescript-test","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins","https:\u002F\u002Fgithub.com\u002Foutcomeeng","https:\u002F\u002Foutcome.engineering","Spec-driven development for AI-assisted engineering","2026-11-14 20:33:56",{"source":8,"skillName":5,"commands":61,"prompt":70,"zipAvailable":71},[62,64,67],{"tool":31,"command":63},"npx skills add outcomeeng\u002Fplugins --skill author-typescript-test",{"tool":65,"command":66},"bunx","bunx skills add outcomeeng\u002Fplugins --skill author-typescript-test",{"tool":68,"command":69},"pnpm","pnpm dlx skills add outcomeeng\u002Fplugins --skill author-typescript-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Ftypescript\u002Fskills\u002Fauthor-typescript-test\u002FSKILL.md",true,[],[74,80,112,128,140,153],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":44},"01M71G25RZTPQG9KJ00JCHC1F7","plugin","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Ftemplates\u002Fplugin\u002FSKILL.md",[],[76],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":94,"publishedAt":44},"01M71G23DCX3SV60H63HBBKQ6J","sanitize-powerpoint","ALWAYS invoke this skill when sanitizing, cleaning up, auditing, or aligning a PowerPoint (.pptx) deck — slide-master and layout structure, layout type attributes, stray fonts, non-theme colors, or layout naming. NEVER hand-edit pptx XML without this skill.","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Fwork\u002Fskills\u002Fsanitize-powerpoint\u002FSKILL.md",[86,89],{"categoryNo":87,"categoryName":88,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":90,"categoryName":91,"taxonomyType":92,"taxonomyTypeDesc":93},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[95,96,97,98,99,100,101,43,102,103,104,105,106,107,108,34,109,110,28,111],"sanitize powerpoint","powerpoint","sanitize","fonts","type","cleaning","structure","attributes","theme","pptx","naming","layout","deck","up","xml","master","when",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":44},"01M71G21PQKBCDECHGVYSKPJW5","draw-excalidraw","ALWAYS invoke this skill when creating Excalidraw diagrams, visualizing workflows, architectures, or concepts. NEVER generate Excalidraw JSON without this skill.","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Fwork\u002Fskills\u002Fdraw-excalidraw\u002FSKILL.md",[],[119,120,121,122,123,43,28,124,125,111,126,127],"draw excalidraw","excalidraw","draw","diagrams","architectures","generate","workflows","concepts","json",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":135,"publishedAt":44},"01M71G1ZMNGFD37RZYM620XM2C","typescript-test-standards","TypeScript test standards enforced across all skills. Loaded by other skills, not invoked directly.","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-test-standards\u002FSKILL.md",[134],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[24,136,27,137,138,40,139],"typescript test standards","standards","false","across",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":149,"publishedAt":44},"01M71G1XBH0X1VCTR7269MDGSY","typescript-code-standards","TypeScript code standards enforced across all skills. Loaded by other skills, not invoked directly.","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-code-standards\u002FSKILL.md",[146],{"categoryNo":147,"categoryName":148,"taxonomyType":92,"taxonomyTypeDesc":93},"01JBSEEDCAT000000000000030","开发工程师",[24,150,151,152,137,138,40,139],"code","typescript code standards","code standards",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":44},"01M71G1TQ3VN45SJ75DFMJDB9W","typescript-architecture-standards","TypeScript ADR conventions enforced across architect and auditor skills. Loaded by other skills, not invoked directly.","https:\u002F\u002Fgithub.com\u002Foutcomeeng\u002Fplugins\u002Fblob\u002Fmain\u002Fsrc\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-architecture-standards\u002FSKILL.md",[],[160,137,161,162,24,163,164,139,40,165,138,166],"architecture standards","typescript architecture standards","architecture","adr","architect","auditor","conventions"]