preen-msw-parity
SKILL.md
Preen MSW Parity
Audit @tearleads/msw coverage against API routes, prioritize high-value gaps, and keep parity tooling up to date.
When to Run
Run this skill when:
- API endpoints are added/changed in
packages/api/src/routes - MSW handlers are edited in
packages/msw/src/handlers.ts - You need a quick parity report before adding test coverage
Discovery
Use the parity script first:
./scripts/preen/checkMswParity.ts
For machine-readable output:
./scripts/preen/checkMswParity.ts --json
To fail when parity has missing routes or low-confidence matcher coverage:
./scripts/preen/checkMswParity.ts --strict
Prioritization
Work in this order:
- Routes currently used by
packages/client/src/lib/api.ts - Auth/session routes that affect app boot/login flows
- Admin routes used by debug/admin UI
- Remaining endpoints by prefix volume (e.g.,
mls,vfs,ai)
Workflow
- Run parity discovery and capture baseline counts.
- Select one endpoint cluster and add/adjust handlers in
packages/msw/src/handlers.ts. - Add/expand Vitest coverage that uses real fetch/MSW and asserts request metadata.
- Re-run parity script and confirm missing/low-confidence counts are stable or decreased.
- Run focused tests for touched suites.
- Commit and open PR only when parity delta is positive.
Test Wiring Guidance
- Prefer tests that call real API wrappers and assert:
- response payload shape
- request path/method via
getRecordedApiRequests/wasApiRequestMade
- Keep request-state cleanup in shared setup (
resetMockApiServerState). - Avoid replacing all fetch mocks at once; migrate high-value suites incrementally.
Guardrails
- Keep handlers aligned with shared response types in
@tearleads/shared. - Preserve optional
/v1matching so tests work across base URL variants. - Do not remove existing handler behavior without replacing equivalent coverage.
- Keep each PR scoped to one parity increment.
Completion Gate
Before finishing a parity pass:
./scripts/preen/checkMswParity.ts --json
pnpm --filter @tearleads/msw test
pnpm --filter @tearleads/client exec vitest run src/test/msw/msw.test.ts src/lib/api.msw.test.ts
Then run:
/commit-and-push/enter-merge-queue
Weekly Installs
1
Repository
a2f0/tearleadsFirst Seen
10 days ago
Security Audits
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1