Evaluate existing test coverage, identify gaps and pattern violations, then create or update comprehensive tests...
Evaluate test coverage and create or update tests when gaps or pattern violations are identified.
Invoke when user says:
| Phase | Action | Reference |
|---|---|---|
| 1 | Code Analysis & Risk Assessment | execution-phases.md |
| 2 | Existing Test Discovery & Pattern Compliance | execution-phases.md |
| 3 | Test Design | execution-phases.md |
| 4 | Test Implementation | execution-phases.md |
| 5 | Validation | execution-phases.md |
| 6 | Reporting | report-template.md |
For detailed phase instructions: references/execution-phases.md
| Risk Level | Characteristics | Required Tests |
|---|---|---|
| High | Business logic, mutations, forms, auth, payments | Unit + Integration + E2E |
| Medium | Data fetching, filtering, validation, hooks | Unit + Integration OR Unit + E2E |
| Low | Pure utilities, formatters, type guards | Unit only |
| Code Type | Required Tests |
|---|---|
| User-facing component | Unit + E2E |
| Form component | Unit + E2E |
| Service with mutations | Unit + Integration + E2E |
| Service read-only (simple) | Unit |
| Service read-only (complex) | Unit + Integration |
| Pure utility | Unit |
| React hook (simple) | Unit |
| React hook (complex) | Unit + Integration |
| Page component | E2E |
| Level | Pattern | Example |
|---|---|---|
| Unit | src/**/__tests__/[name].test.{ts,tsx} |
src/components/__tests__/SessionForm.test.tsx |
| Integration | src/**/*.integration.test.{ts,tsx} |
src/services/__tests__/email.integration.test.ts |
| E2E | playwright/tests/*.spec.ts |
playwright/tests/session-creation.spec.ts |
Check these pattern documents before writing tests:
claude-patterns/testing-patterns.md (React component unit tests)claude-patterns/vitest-testing-patterns.md (Service/utility unit tests)claude-patterns/playwright-best-practices.md (E2E tests)| Priority | Type | Examples |
|---|---|---|
| P0 (Must Fix) | Safety & Correctness | No direct DB inserts in E2E, proper async handling, worker validation |
| P1 (Should Fix) | Maintainability | test.step() usage, proper cleanup, comprehensive assertions |
| P2 (Nice to Have) | Best Practices | Naming conventions, organization, comments |
Fix P0 violations before creating new testsβa test that violates patterns is worse than no test.
For detailed patterns: references/best-practices.md
Basic:
Use build-update-tests skill for src/components/MyComponent.tsx
With requirements:
Use build-update-tests for src/services/email.service.ts with critical flows from docs/email-requirements.md
# Run unit tests for specific file
npm run test:unit -- [test-file-name]
# Run all unit tests
npm run test:unit
# Run E2E tests
npx playwright test [spec-file]
| Gate | Phase | Question |
|---|---|---|
| None | - | This skill runs autonomously without user approval gates |
Note: Test creation is non-destructive. User reviews output report and decides what to keep.
# Find existing tests
glob "src/**/__tests__/**/*.test.{ts,tsx}"
glob "playwright/tests/*.spec.ts"
# Check for pattern docs
cat claude-patterns/testing-patterns.md
cat claude-patterns/playwright-best-practices.md
v3.2.0 (2025-01-18): AI optimization updates
v3.1.0 (2025-12-28): Added missing sections per skill-authoring-patterns audit
<approval_gates> section<safety_rules> section<references> sectionv3.0.0 (2025-12-28): Refactored to follow skill-authoring-patterns
v2.0.0 (2025-11-15): Combined audit and implementation workflows
v1.0.0 (2025-10-01): Initial release