Skip to main content

3.5 Iterative refinement techniques

TechniqueUse when
Concrete input/output examples (2–3)Prose descriptions are interpreted inconsistently — the most effective way to communicate an expected transformation
Test-driven iterationWrite the suite first (expected behaviour, edge cases, performance), then iterate by sharing test failures
The interview patternUnfamiliar domain — have Claude ask questions to surface considerations you had not anticipated (cache invalidation strategies, failure modes) before implementing
Specific test cases with input and expected outputFixing an edge case, e.g. null values in a migration script

One message or several?​

Problems are…Do
Interacting (fixing one changes another)Provide all issues in a single detailed message
IndependentFix sequentially, one iteration each

Quiz​

  1. Question 1

    You have described a record-normalisation transformation in prose three times, and Claude has produced a different reading of the edge cases each time: nulls become empty strings in one version and are dropped in another, and mixed-case keys are folded in one and preserved in the next. The happy path has been right every time. What is the most effective next step?

  2. Question 2

    Review of a generated caching layer surfaces four defects: the TTL is applied after serialization, the invalidation hook fires before the write commits, the key builder ignores tenant ID, and one test asserts on wall-clock time. Fixing the key builder changes what the invalidation hook must invalidate, and the TTL ordering decides whether that test can assert anything stable. How should you feed these back?

  3. Question 3

    You are adding a caching layer to a service in a domain you do not know well. You are unsure how invalidation should work, what should happen on a cache-miss storm, and whether staleness is tolerable anywhere in the flow. Which technique surfaces these before any implementation exists?

  4. Question 4

    A rate limiter has to handle burst traffic, sustained load, clock skew between instances, and a documented p99 overhead budget. You know exactly what correct behaviour looks like in each case and want each one pinned down before you accept an implementation. What is the most effective approach?