| name | tdd |
| description | Enforce Test-Driven Development: Red → Green → Refactor (INTERNAL - used by @build) |
@tdd (INTERNAL)
TDD discipline. Called by @build, not users.
Cycle
- RED — Write failing test first. Run test suite (see Quality Gates in AGENTS.md) — must FAIL
- GREEN — Minimal implementation. Run test suite (see Quality Gates in AGENTS.md) — must PASS
- REFACTOR — Improve code. Run test suite (see Quality Gates in AGENTS.md) — still PASS
- COMMIT — Save state
Exit When
- All AC met
- Test suite passes (see Quality Gates in AGENTS.md)
- Static analysis passes (see Quality Gates in AGENTS.md)
Example (Go)
func TestEmailValid(t *testing.T) {
v := NewValidator()
if !v.IsValid("a@b.com") { t.Error("expected valid") }
if v.IsValid("x") { t.Error("expected invalid") }
}
func NewValidator() *V { return &V{} }
func (v *V) IsValid(s string) bool { return strings.Contains(s, "@") }
For Go refactors, prefer modern stdlib idioms from @go-modern when they preserve behavior.