Test-Driven Development (TDD) — Quality Protocol
The TDD Cycle
2. GREEN — MINIMAL IMPLEMENTATION
- Write the simplest possible code to make the test pass.
- Avoid adding unrequested features (YAGNI) or "while-I'm-here" refactors.
- Verify GREEN: Run the test and confirm it passes alongside all existing tests.
3. REFACTOR — CLEAN UP
- Improve names, remove duplication, and extract helpers.
- Ensure the tests stay green throughout the refactoring process.
Verification Checklist
Red Flags — STOP
- "I'll write the tests after to verify it works." → STOP. Tests-after prove nothing; they only verify what was built, not what was required.
- "The test passed immediately." → STOP. The test is invalid or testing logic that already exists.
- "Deleting this code is wasteful." → STOP. Sunk cost fallacy. Keeping unverified code is technical debt.
- "I manually tested it, so it's fine." → STOP. Manual testing is non-deterministic and non-reproducible.
Rationalization Table
Reference Files
systematic-debugging/SKILL.md— Root cause protocol.verification-before-completion/SKILL.md— Final verification gate.sk-write-review-isolation/SKILL.md— Review isolation rules.testing-anti-patterns.md— Common TDD pitfalls.