Test-Driven Iteration & Interview Pattern
AdvancedApply iterative refinement techniques for progressive improvement · Difficulty 2/5
Two powerful iterative refinement patterns deserve deeper treatment: test-driven iteration and the interview pattern.
Test-Driven Iteration
Write tests BEFORE asking Claude to implement:
This is more effective than reviewing code manually because:
The Interview Pattern
Before implementing in unfamiliar domains, have Claude ask questions:
This surfaces considerations the developer may not have anticipated, producing better first-pass implementations by front-loading design decisions.
Batched vs Sequential Feedback
Choosing the right feedback strategy matters:
| Situation | Strategy | Why |
|---|
|-----------|----------|-----|
| Interacting problems | Single detailed message with all issues | Fixes may affect each other; Claude needs full picture |
|---|---|---|
| Independent problems | Sequential, one at a time | Each fix is isolated; simpler context per iteration |
Specific Test Cases for Edge Cases
When Claude mishandles edge cases (e.g., null values in migration scripts), provide specific test cases with example input and expected output rather than describing the edge case in prose. This eliminates ambiguity about the expected behavior.
Key Takeaways
- ✓Test failures are unambiguous feedback -- more effective than prose review
- ✓The interview pattern front-loads design decisions in unfamiliar domains
- ✓Batch interacting issues together; handle independent issues sequentially
- ✓Provide specific test cases with input/output for edge case fixes