moai-workflow-tddlisted
Install: claude install-skill modu-ai/moai-cowork
# Test-Driven Development (TDD) Workflow
## Development Mode Configuration (CRITICAL)
[NOTE] This workflow is selected based on `.moai/config/sections/quality.yaml`:
```yaml
constitution:
development_mode: tdd # or ddd
```
**When to use this workflow**:
- `development_mode: tdd` → Use TDD (this workflow, default)
- `development_mode: ddd` → Use DDD instead (moai-workflow-ddd)
**Key distinction**:
- **TDD** (default): Test-first development for all work, including brownfield projects with pre-RED analysis
- **DDD**: Characterization-test-first for existing codebases with minimal test coverage
## Quick Reference
Test-Driven Development provides a disciplined approach for creating new functionality where tests define the expected behavior before implementation.
Core Cycle - RED-GREEN-REFACTOR:
- RED: Write a failing test that defines desired behavior
- GREEN: Write minimal code to make the test pass
- REFACTOR: Improve code structure while keeping tests green
When to Use TDD:
- Creating new functionality from scratch
- Building isolated modules with no existing dependencies
- When behavior specification drives development
- New API endpoints with clear contracts
- New UI components with defined behavior
- Greenfield projects (rare - usually Hybrid is better)
When NOT to Use TDD:
- Refactoring existing code (use DDD instead)
- When behavior preservation is the primary goal
- Legacy codebase without test coverage (use DDD first)
- When modifying existing files (c