write-tests
Add unit, formatter, parser, contract, component or pgTAP tests to existing code following .claude/rules/07-testing.md. Use when coverage is missing, after a refactor, or when a spec checklist row has
SKILL.md.claude/skills/write-tests/SKILL.md
GitHubWrite tests
- Read
.claude/rules/07-testing.mdanddocs/19-testing-qa.md§1–§3. - Pick the layer:
packages/shared/**,features/*/logic/**→ vitest/jest unit, 100% branch coverage, no mocks,todaypassed in.- formatters (money, date, speech) → table-driven with the exact Dutch string (
'€ 1.234,56','−€ 42,00'with U+2212). - parsers → committed synthetic fixture, never a real export.
- zod contracts → round-trip parse + one rejection.
- mutations → optimistic update + rollback.
- screens → renders empty, data, error (RNTL, query by role/text).
- tables/policies → pgTAP in
supabase/tests/(cross-tenant +personalscope).
- List cases as behaviours: happy path, empty, boundary, error, and every row the spec names (
docs/10§11,docs/06§11). Period tests always cover 28/29/30/31-day months, anchor 28 in February, a DST boundary, and a kind change mid-period. - Run the narrowest command (
pnpm test:shared,pnpm test:mobile -- <path>,pnpm test:db). Break one assertion on purpose to prove the test can fail. - No snapshots of component trees, no
.only, no skipped tests.
Report: tests added, spec rows covered, coverage delta, remaining gaps (≤ 6 lines).