| name | moai-workflow-tdd |
| description | Test-Driven Development workflow specialist using RED-GREEN-REFACTOR cycle for test-first software development. Use when developing new features from scratch, creating isolated modules, or when behavior specification drives implementation. Do NOT use for refactoring existing code (use moai-workflow-ddd instead) or when behavior preservation is the primary goal.
|
| license | Apache-2.0 |
| compatibility | Designed for Claude Code |
| allowed-tools | Read Write Edit Bash(pytest:*) Bash(ruff:*) Bash(npm:*) Bash(npx:*) Bash(node:*) Bash(jest:*) Bash(vitest:*) Bash(go:*) Bash(cargo:*) Bash(mix:*) Bash(uv:*) Bash(bundle:*) Bash(php:*) Bash(phpunit:*) Grep Glob mcp__context7__resolve-library-id mcp__context7__get-library-docs |
| user-invocable | false |
| metadata | {"version":"1.0.0","category":"workflow","status":"active","updated":"2026-02-03","modularized":"true","tags":"workflow, tdd, test-driven, red-green-refactor, test-first","author":"MoAI-ADK Team","context":"fork","agent":"manager-tdd","related-skills":"moai-workflow-ddd, moai-workflow-testing, moai-foundation-quality"} |
| progressive_disclosure | {"enabled":true,"level1_tokens":100,"level2_tokens":5000} |
| triggers | {"keywords":["TDD","test-driven development","red-green-refactor","test-first","new feature","greenfield"],"phases":["run"],"agents":["manager-tdd","expert-backend","expert-frontend","expert-testing"]} |
Test-Driven Development (TDD) Workflow
Development Mode Configuration (CRITICAL)
[NOTE] This workflow is selected based on .moai/config/sections/quality.yaml:
constitution:
development_mode: hybrid
hybrid_settings:
new_features: tdd
legacy_refactoring: ddd
When to use this workflow:
development_mode: tdd → Always use TDD
development_mode: hybrid + new package/module → Use TDD
development_mode: hybrid + refactoring existing code → Use DDD instead (moai-workflow-ddd)
Key distinction:
- New file/package (doesn't exist yet) → TDD (this workflow)
- Existing code (file already exists) → DDD (ANALYZE-PRESERVE-IMPROVE)
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 (consider Hybrid mode)
Core Philosophy
TDD vs DDD Comparison
TDD Approach: