Claude Certified Architect - FoundationsCCAR-F Learning Guide
Domain 3 · Lesson 3.5 · 5 min read

Iterative Refinement Techniques

Exam taskApply iterative refinement techniques for progressive improvement

When prose instructions are read inconsistently, show concrete input and output examples, drive the work with tests, let Claude interview you before building in unfamiliar territory, and batch interacting issues into one message.

What you need to know

Getting the result you want from Claude Code is usually a short series of refinements. The exam tests four techniques and when each fits.

1. Concrete input and output examples

When a prose description ("normalise the phone numbers") produces inconsistent results, two or three concrete examples remove the ambiguity faster than more prose:

Input: "(020) 7946 0958"   -> Output: "+442079460958"
Input: "07700 900123"      -> Output: "+447700900123"
Input: "+44 20 7946 0958"  -> Output: "+442079460958"

The same applies to edge cases: to fix crashes on null values in a migration script, give specific test cases with sample input containing nulls and the expected output.

2. Test-driven iteration

Write the test suite first: expected behaviour, edge cases, and any performance requirement. Then let Claude implement, run the tests, and share the failures to guide the next round. Tests give Claude an objective way to verify its own work, so each iteration converges instead of drifting.

3. The interview pattern

In an unfamiliar domain you may not know what you do not know. Ask Claude to interview you before writing code: it asks about the considerations you might miss (cache invalidation, failure modes, consistency, retention), and the answers become the specification.

4. One message or several?

IssuesApproach
Interacting: a race condition causes a null pointer, which produces a misleading error messageOne detailed message describing all of them, because fixing one changes the others
Independent: a typo in a config file and an unrelated slow queryFix them one at a time, so each change is small and easy to verify

In the exam

Stems describe an inconsistent transformation (examples), an edge case to fix (test cases with input and output), an unfamiliar feature (interview), or several bugs at once (decide whether they interact).

Check your understanding

Question 1

A description of a date transformation keeps being interpreted differently. What is the most effective next step?

Show answer

Answer: B. Concrete examples pin down the transformation in a way prose does not, and they double as test cases.

Question 2

You are about to build a caching layer in a domain you do not know well. What should you ask Claude to do first?

Show answer

Answer: D. The interview pattern surfaces considerations you have not anticipated before any code is written.

Question 3

Three bugs interact: a race condition causes a null pointer, which causes a misleading error. A fourth bug is an unrelated config typo. How do you proceed?

Show answer

Answer: A. Coupled problems need to be fixed together because each fix affects the others. An independent issue is easier to verify on its own.

Apply it: Harbor Lane's audit-log feature

Exercise · about 15 minCase: Harbor Lane Software

Harbor Lane must add audit logging to api/, a domain nobody on the team knows well. Plan the refinement approach.

  1. List five interview questions you expect Claude to ask, and why each matters.
  2. Write three test cases (input and expected output) that pin down the log format.
  3. Describe the test-driven loop for the implementation.
  4. Handle a failure: the logs drop entries under load, and timestamps are in local time. Do they go in one message or two?
Check your work
Show model answer

1. Interview questions

  • Which actions must be logged (reads, writes, logins)? Defines scope.
  • How long are logs kept, and who may read them? Retention and access.
  • Must logs be tamper-evident? Storage design.
  • What happens if the log store is down: block the request or queue? Failure mode.
  • Is any logged data personal? Masking and privacy.

2. Test cases

InputExpected log entry
User 42 updates booking 9{"actor": 42, "action": "booking.update", "target": 9, "at": "<UTC ISO 8601>"}
Anonymous request rejected{"actor": null, "action": "auth.reject", ...}
Payload with a card numberCard number masked to the last four digits

3. Loop. Commit the tests first; ask Claude to implement until they pass; paste failures back with the test name and output; add a load test once the functional tests pass.

4. Failures. Two messages. Dropped entries under load and local timestamps are independent: one is a concurrency problem, the other a formatting one. Fixing them separately keeps each change verifiable.

Sources