Implementation
TDD-based workflow for all code changes.
Workflow
Phase 1: Understand & Plan
- Explore codebase to understand context and existing patterns
- Create detailed TodoWrite items for each test case to implement
- Mark first todo as in_progress
Phase 2: Red-Green-Refactor Cycle
For each todo item:
- Red: Write failing test
- Define expected behavior/contract
- Include concrete examples and edge cases
- Follow project test naming conventions
- Run tests - verify new test fails
- Green: Write minimal code to pass
- Only implement what's needed to pass the test
- No premature optimization
- Run tests - verify all tests pass
- Refactor: Opportunistic cleanup
- Clean up touched code if beneficial
- High test coverage ensures safety
- Run tests - verify still passing
- Mark todo completed, next as in_progress
Phase 3: Verify
- Run full test suite
- Use available MCP servers or skills for additional verification if applicable
- Ensure all todos completed
Phase 4: Subagents
Run the following custom subagents parallel:
- code-simplifier
- test-reviewer
Guidelines
- Investigate and fix test failures autonomously - do not ask unless stuck
- Explain key decisions only, not every step
- High test coverage enables safe opportunistic cleanup of touched code
- Run tests after each TDD cycle, not just at the end
- Use TodoWrite to track each test case for visibility
