| name | tdd-typescript |
| description | Default test workflow. RED-GREEN-REFACTOR cycle for all new TypeScript code. |
| triggers | implement, add.*feature, build.*feature, create.*function, new.*endpoint, write.*test, tdd |
TDD is not about testing—it's about design. Writing tests first forces you to think about the API, edge cases, and behavior BEFORE writing implementation code.
Three Laws of TDD:
- Write NO production code until a failing test exists
- Write ONLY enough test to demonstrate failure
- Write ONLY enough production code to pass the test
Coverage Requirements (Non-Negotiable):
| Metric | Minimum | Critical Paths |
|---|---|---|
| Line coverage | 80% | 100% |
| Branch coverage | 75% | 100% |
| Function coverage | 90% | 100% |
Coverage targets are minimum thresholds, not aspirational goals. See references/test-coverage-patterns.md for blocking criteria.
Context Isolation: Each phase (RED, GREEN, REFACTOR) runs with isolated context. The test writer cannot see implementation plans—this ensures genuinely test-first thinking rather than tests designed around anticipated code.
Phase Gates: Do NOT proceed to the next phase until the current phase verification succeeds:
- RED → Test must FAIL before proceeding to GREEN
- GREEN → Test must PASS before proceeding to REFACTOR
- REFACTOR → Tests must STILL PASS after changes
See references/test-strategy-checklist.md for complete phase gate requirements.
- Read
workflows/tdd-cycle.mdand follow it exactly - Use
references/test-coverage-patterns.mdfor coverage targets and blocking criteria - Use
references/test-data-strategies.mdfor factories, fixtures, and mocks - Use
references/test-naming-conventions.mdfor consistent naming - Use
references/test-strategy-checklist.mdfor phase gates and governance
Invoke with: Any prompt containing "implement", "add feature", "build", or "create functionality"
This skill handles the TDD WORKFLOW (when/what to test). The vitest skill handles TEST SYNTAX (how to write tests). Load both for full coverage.
- RED: Failing test written BEFORE any implementation
- GREEN: Minimal code written to pass test
- REFACTOR: Code improved while tests stay green
- Coverage: 80%+ lines, 75%+ branches, 100% critical paths
- Test data: Factories for dynamic, fixtures for edge cases, mocks at boundaries
- Naming: Tests follow
should_<expected>_when_<condition>pattern - Gates: All phase gate criteria met (see test-strategy-checklist.md)