Write tests first, code second.
text
🔴 RED → Write failing test
↓
🟢 GREEN → Write minimal code to pass
↓
🔵 REFACTOR → Improve code quality
↓
Repeat...
FocusExampleBehavior"should add two numbers"Edge cases"should handle empty input"Error states"should throw for invalid data"
PrincipleMeaningYAGNIYou Aren't Gonna Need ItSimplest thingWrite the minimum to passNo optimizationJust make it work
AreaActionDuplicationExtract common codeNamingMake intent clearStructureImprove organizationComplexitySimplify logic
Every test follows:
StepPurposeArrangeSet up test dataActExecute code under testAssertVerify expected outcome
ScenarioTDD ValueNew featureHighBug fixHigh (write test first)Complex logicHighExploratoryLow (spike, then TDD)UI layoutLow
PriorityTest Type1Happy path2Error cases3Edge cases4Performance
❌ Don't✅ DoSkip the RED phaseWatch test fail firstWrite tests afterWrite tests beforeOver-engineer initialKeep it simpleMultiple assertsOne behavior per testTest implementationTest behavior
AgentRoleAgent AWrite failing tests (RED)Agent BImplement to pass (GREEN)Agent COptimize (REFACTOR)
Remember: The test is the specification. If you can't write a test, you don't understand the requirement.