tdd-workflow
Installation
SKILL.md
TDD Workflow — Red-Green-Refactor Mastery
Mandatory Pre-Flight Context Inspection
Before implementing feature logic or writing unit tests, you MUST inspect:
- Red-Green-Refactor Cycle → Write failing test FIRST (Red) → minimal passing code SECOND (Green) → cleanup THIRD (Refactor)
- Behavior-First Assertion Rule → Assert public contract results (GIVEN/WHEN/THEN); ban asserting internal private fields or private state
- I/O Boundary-Only Mocking → Mock ONLY un-owned external boundaries (database I/O, network fetch); ban mocking pure domain utilities or internal classes
- Fast Deterministic Test Runner → Tests must execute in memory in < 100ms per file; avoid unneeded sleep delays or live network connections
Activation Boundaries
- Activate when: Developing new algorithms, complex business logic, financial calculations, state machine transitions, and fixing bugs via regression reproduction.
- DO NOT activate when: Writing disposable prototype scripts, pure visual CSS layouts, or static documentation.