tdmcp-test-coverage
Use this skill for coverage-improvement work in this repository. The goal is
more tested behavior, not prettier percentages.
Phase 0 - Context
- Read
AGENTS.md, package.json, vitest.config.ts, and the nearest tests.
- Run
npm run coverage:harness unless the user asked for a static-only pass.
- Read
_workspace/coverage/latest.md.
- Treat the actionable scope as
src/**/*.ts; src/knowledge/data/** is
generated reference data and is intentionally excluded.
Phase 1 - Select gaps
Choose one to three independent gaps. Prefer seams where a test can lock a real
contract:
- CLI/config: parsing, defaulting, env precedence, diagnostics, and exit behavior.
- Resource/knowledge loaders: URI matching, malformed input, ranking, and stable
result shape.
- Tool implementations: Zod defaults, bridge payloads, warnings, and
isError
paths using msw.
- Server/client boundaries: offline TD behavior, auth forwarding, timeout/retry,
event streaming, and transport setup.
Skip generated data, docs-only files, and import-only tests.
Phase 2 - Build tests
For parallel work, spawn tdmcp-coverage-writer agents with one seam each. Give
each writer:
- target file(s) and nearest existing test to mirror;
- behavior to assert;
- expected failure mode or branch to cover;
- exact narrow command to run.
The lead is the single writer for shared config, package scripts, and harness
docs. Do not let multiple agents edit the same test file.
Phase 3 - Verify
Run narrow tests first. Then run:
npm run typecheck
npm run build
./node_modules/.bin/biome check .
npm run coverage:harness
npm run validate:recipes
npm run test:bridge
If a gate fails, fix forward. Do not lower coverage thresholds, delete assertions,
or exclude executable code to pass.
Phase 4 - Report
Write _workspace/coverage/wave-<date>.md with:
- starting and ending coverage summary;
- tests added and behaviors covered;
- commands run;
- PASS/FAIL/UNVERIFIED buckets;
- next suggested gaps from
_workspace/coverage/latest.md.
Test scenarios
- Normal flow: coverage harness identifies
src/cli/chat.ts; writer adds focused
CLI behavior tests; lead runs coverage and gates; report includes delta.
- Error flow: a new test exposes a production bug; report the failing behavior,
patch the smallest safe code path, keep the regression test, and re-run gates.
1---2name: tdmcp-test-coverage3description: Orchestrate any tdmcp test-coverage work: run the coverage harness, inspect coverage gaps, plan focused Vitest/msw or bridge tests, delegate coverage writers, verify coverage deltas, and re-run gates. Use whenever the user asks to raise coverage, add broad regression coverage, create a test harness, improve tests, re-run a coverage wave, or fix a coverage gate.4---56# tdmcp-test-coverage78Use this skill for coverage-improvement work in this repository. The goal is9more tested behavior, not prettier percentages.1011## Phase 0 - Context12131. Read `AGENTS.md`, `package.json`, `vitest.config.ts`, and the nearest tests.142. Run `npm run coverage:harness` unless the user asked for a static-only pass.153. Read `_workspace/coverage/latest.md`.164. Treat the actionable scope as `src/**/*.ts`; `src/knowledge/data/**` is17 generated reference data and is intentionally excluded.1819## Phase 1 - Select gaps2021Choose one to three independent gaps. Prefer seams where a test can lock a real22contract:2324- CLI/config: parsing, defaulting, env precedence, diagnostics, and exit behavior.25- Resource/knowledge loaders: URI matching, malformed input, ranking, and stable26 result shape.27- Tool implementations: Zod defaults, bridge payloads, warnings, and `isError`28 paths using msw.29- Server/client boundaries: offline TD behavior, auth forwarding, timeout/retry,30 event streaming, and transport setup.3132Skip generated data, docs-only files, and import-only tests.3334## Phase 2 - Build tests3536For parallel work, spawn `tdmcp-coverage-writer` agents with one seam each. Give37each writer:3839- target file(s) and nearest existing test to mirror;40- behavior to assert;41- expected failure mode or branch to cover;42- exact narrow command to run.4344The lead is the single writer for shared config, package scripts, and harness45docs. Do not let multiple agents edit the same test file.4647## Phase 3 - Verify4849Run narrow tests first. Then run:5051```bash52npm run typecheck53npm run build54./node_modules/.bin/biome check .55npm run coverage:harness56npm run validate:recipes57npm run test:bridge58```5960If a gate fails, fix forward. Do not lower coverage thresholds, delete assertions,61or exclude executable code to pass.6263## Phase 4 - Report6465Write `_workspace/coverage/wave-<date>.md` with:6667- starting and ending coverage summary;68- tests added and behaviors covered;69- commands run;70- PASS/FAIL/UNVERIFIED buckets;71- next suggested gaps from `_workspace/coverage/latest.md`.7273## Test scenarios7475- Normal flow: coverage harness identifies `src/cli/chat.ts`; writer adds focused76 CLI behavior tests; lead runs coverage and gates; report includes delta.77- Error flow: a new test exposes a production bug; report the failing behavior,78 patch the smallest safe code path, keep the regression test, and re-run gates.