Project: fresh `npm init -y` + `npm i -D vitest typescript` (Vitest 5.1.0, TypeScript strict). Every runner output below is pasted from the actual run.
Behaviour list (simplest first): 1. returns empty for blank input · 2. returns the address trimmed and lowercased when valid · 3. returns malformed when there is no @ · 4. returns malformed when there is more than one @ · 5. returns malformed when the domain has no dot · 6. returns too_long when the address is over 254 characters
Cycle 1: returns empty for blank input
```
[TDD] cycle 1/6 step RED behaviour: returns empty for blank input
test: src/validateEmail.test.ts > validateEmail > returns empty for blank input
ran: npx vitest run src/validateEmail.test.ts -t "returns empty for blank input"
result: FAIL Error: Cannot find module './validateEmail' imported from <project>/src/validateEmail.test.ts
reason: right (the unit under test does not exist yet: missing function, not a typo in the test)
changed: src/validateEmail.test.ts (+8, new file)
next: minimum code in src/validateEmail.ts
```
```
[TDD] cycle 1/6 step GREEN behaviour: returns empty for blank input
ran: npx vitest run src/validateEmail.test.ts -t "returns empty for blank input" --reporter=verbose; npx vitest run src/validateEmail.test.ts
result: PASS Tests 1 passed (1)
changed: src/validateEmail.ts (+9, new file: result types + hard-coded `{ ok: false, error: 'empty' }`)
next: refactor
```
Refactor: no refactor (hard-coded return is forced into the general version by cycle 2).
[Cycles 2–6 follow the same shape: each RED shows a real assertion mismatch such as `Tests 1 failed | 1 skipped (2)`, each GREEN the passing count, with refactors in cycles 5 and 6.]
Done
```
[TDD] DONE cycles 6 tests added 6 suite PASS
ran: npm test (vitest run) and npx tsc -p .
result: Test Files 1 passed (1) | Tests 6 passed (6); tsc exit 0
pre-existing failures: none (no tests existed)
found, not fixed: the 254 boundary itself (exactly 254 chars accepted) has no test; it passes today, so a test would be green on first run. 'a@.com' and 'a@b.' are accepted because the spec only asks for a dot in the domain.
```
No-fake-green check before every GREEN: no `.skip`/`.todo`, no assertion weakened, no test-only branch, nothing mocked.SkillCodeFree
- Antigravity
- Claude Code
- Codex
- +3
Coding
Red-Green TDD Loop
Use it to make your coding agent build every change test-first: one failing test, the minimum code, a refactor, and a status block after each step.
0 installs
Free