Rubric
Contents — domains, guide and mocks

Iterative refinement

CCAR-F 3.512 min read · checked 21 September 2026

Task statementApply iterative refinement techniques for progressive improvement

The refinement loop

  1. Clear targetexamples, test cases, a screenshot, the exact error
  2. Runnable checktests, build, linter, screenshot diff
  3. Claude attemptsdoes the work, then runs the check
  4. Read the resultpass → done; fail → specific fix

Each failure feeds a specific correction back in — not the same request, louder

The loop only closes on its own when step 2 exists. Without a check Claude can run, “looks done” is the only signal — and you become the verification loop.

Give Claude a way to check its own work

The Claude Code best-practices guide puts this first: Claude stops when the work looks done, and without a check it can run, looking done is the only signal available. Give it something that produces a pass or a fail — a test suite, a build exit code, a linter, a script that diffs output against a fixture, or a screenshot compared against a design — and Claude can do the work, run the check, read the result and iterate until it passes.

Instead ofRefine to
“implement a function that validates email addresses”“write validateEmail. user@example.com is valid, invalid is not, user@.com is not. Run the tests after implementing.”
“make the dashboard look better”“[screenshot] implement this design, screenshot the result, list the differences and fix them”
“the build is failing”“the build fails with this error: [error]. Fix the root cause, don’t suppress it, and confirm the build passes.”

Ask for evidence, not assertions. The guide recommends having Claude show the test output, the command it ran and what it returned, or a screenshot of the result — reviewing evidence is faster than re-running the check yourself.

Tests first, then code

Tests are the most precise way to say what “correct” means. Writing them before the implementation turns an ambiguous request into a target that either passes or doesn’t, and every failure tells Claude exactly what is still wrong. The best-practices guide’s example prompt for a bug asks Claude to write a failing test that reproduces the issue, then fix it. For a larger change, it suggests having one Claude session write the tests and another write code to pass them.

Show, don’t describe: concrete examples

When Claude keeps misreading a transformation or format, more adjectives rarely help. A few concrete input-and-output pairs show the pattern directly, including the edge cases a description glosses over. Anthropic’s prompting guidance recommends examples that are relevant, diverse enough to cover edge cases, and clearly marked off from the instructions (few-shot prompting is covered in depth in 4.2).

Refining a request: description versus examples

Vague, repeated more firmlytext

Normalise the order dates so they
are consistent. Make sure they're
all in the same format!! Handle the
weird ones properly this time.

Concrete input → output pairstext

Convert order_date to ISO 8601.
Examples:
"03/04/2025" (UK store) -> "2025-04-03"
"Apr 3 2025"            -> "2025-04-03"
""                      -> null, log it
Add these as test cases, then run
the tests.
The weak version leaves Claude to guess what “consistent” means. The strong version shows three concrete conversions, including the ambiguous and missing cases.

Let Claude ask before it builds

Some refinement should happen before any code exists. For larger features the best-practices guide suggests asking Claude to interview you in detail — about implementation, UI, edge cases, concerns and trade-offs — until everything is covered, then write a spec to a file. The interview surfaces questions you hadn’t considered, and a fresh session then implements against the finished spec with clean context.

Correcting course without drowning the context

Tight feedback loops beat long ones. Press Esc to stop Claude mid-action while keeping its context, so you can redirect. Press Esc twice or run /rewind to restore an earlier checkpoint of the conversation, the code or both. Ask Claude to undo a change. And when a line of attack has clearly failed, cut your losses.

Output isn’t right — what next?

What went wrong?
  • Format or pattern misread
    Give examplesinput → output pairs, as tests
  • Behaviour wrong
    Give a failing testor the exact error text
  • Heading the wrong way
    Esc or /rewindredirect before it goes further
  • Two corrections failed
    /clear and re-promptfold in what you learned

The documentation is specific about that last branch: if you have corrected Claude more than twice on the same issue in one session, the context is cluttered with failed approaches. Run /clear and start again with a better prompt that includes what you learned; a clean session with a better prompt almost always outperforms a long one with accumulated corrections.

How you batch feedback matters too. When several problems are connected — a schema change that breaks a query that breaks a report — describe them together in one message so the fix is designed as a whole. When problems are independent, fixing and verifying them one at a time keeps each change small and each failure easy to trace.

Traps the wrong answers are built from

Tempting but wrongDo this instead
Repeating a vague instruction more forcefullyReplace it with concrete input → output examples or a failing test.
Asking for a change with no way to check itGive Claude tests, a build or a screenshot to verify against, and ask for the evidence.
Saying “it’s broken” or “the build fails”Paste the exact error or failing assertion and ask for the root cause.
Correcting the same issue again and again in one long sessionAfter two failed corrections, /clear and restart with a better prompt.
Letting Claude special-case the test inputsAsk for a general solution and for Claude to flag tests it thinks are wrong.

You should now be able to

  • Give Claude a runnable check and ask for evidence of the result.
  • Use a test-first loop, feeding failing tests back as feedback.
  • Replace ambiguous descriptions with concrete input and output examples.
  • Use an interview to surface requirements before implementing a larger feature.
  • Choose between Esc, /rewind and /clear to course-correct.
  • Decide whether related issues should be fixed together or one at a time.

Practice questions

Original questions written for this lesson, in the exam’s style. Answer first, then open the reasoning — every option is explained, including why the wrong ones are tempting.

  1. Question 1

    An insurance team asks Claude to “format policy numbers consistently”. Across three attempts Claude produces three different formats, each defensible. The team lead’s fourth message is “No — CONSISTENTLY, like our real policy numbers!”

    What is the most effective next step?

    1. AAdd “IMPORTANT: be consistent” to the project CLAUDE.md.
    2. BProvide three or four real before-and-after examples and ask Claude to add them as tests.
    3. CSwitch to plan mode so Claude can think harder about the format.
    4. DAsk Claude to try ten formats and pick the most consistent.
    Show answer and reasoning
    1. AIncorrect. Emphasis doesn’t tell Claude what the target format is; the ambiguity remains.
    2. BCorrect. Concrete pairs remove the ambiguity, and turning them into tests gives Claude a check it can run.
    3. CIncorrect. Planning helps with approach and scope; it doesn’t supply the missing definition of the format.
    4. DIncorrect. Without a definition of the target, Claude still has to guess which is right.
  2. Question 2

    A developer has corrected Claude four times in one session about how a caching layer should invalidate entries. Each fix introduces a new problem, and Claude now references approaches that were already rejected.

    What does the Claude Code guidance recommend?

    1. AKeep correcting in the same session, since the context holds all the history.
    2. BRun /compact so the failed attempts are summarised but retained.
    3. CRun /clear and start fresh with a prompt that includes what was learned.
    4. DEnable auto mode so Claude can try more fixes without prompts.
    Show answer and reasoning
    1. AIncorrect. That history is the problem: it is cluttered with failed approaches that keep resurfacing.
    2. BIncorrect. Compaction keeps a summary of the failed approaches in context; the guidance is to start clean.
    3. CCorrect. The guidance says that after more than two failed corrections on the same issue, a clean session with a better prompt almost always does better.
    4. DIncorrect. Fewer permission prompts doesn’t address polluted context or an under-specified target.
  3. Question 3

    A fintech team wants Claude to implement a fee calculator with tiered rates, rounding rules and a cap. Previous attempts from a written description passed a quick manual check but failed in staging on edge cases.

    Which two changes will most improve the next iteration? (Select 2.)

    1. AHave Claude write tests for the tiers, rounding and cap first, confirm they fail, then implement.
    2. BTell Claude to write a general solution and to flag any test it believes is wrong.
    3. CAsk Claude to double-check its work carefully before replying.
    4. DDescribe the fee rules again in more detail, in capitals.
    5. ESkip tests to save time and review the code by eye in the PR.
    Show answer and reasoning
    1. ACorrect. Tests define correct behaviour precisely and give Claude a pass or fail signal to iterate against.
    2. BCorrect. This guards against code that special-cases test inputs, one of the risks of test-driven iteration.
    3. CIncorrect. Without a runnable check, “double-check” still means “looks done”.
    4. DIncorrect. More forceful prose isn’t a check Claude can run, and the edge cases stay implicit.
    5. EIncorrect. Manual review is what missed the edge cases last time.
  4. Question 4

    After a database column is renamed, three things break in a reporting service: a SQL query, the ORM model that maps it, and a CSV export that reads the model. A developer plans to report them to Claude one per message.

    What is the better approach, and why?

    1. AOne per message, because smaller requests always produce better results.
    2. BReport only the SQL query, since the others will fix themselves.
    3. COpen three parallel sessions, one per broken component.
    4. DDescribe all three together, since they share one cause and need one design.
    Show answer and reasoning
    1. AIncorrect. Small steps help for independent issues; these three share a cause, so fixing them apart invites inconsistent fixes.
    2. BIncorrect. The ORM model and export read the old name too; they won’t update on their own.
    3. CIncorrect. Parallel sessions can’t coordinate a fix that must be consistent across all three.
    4. DCorrect. Interacting problems are best fixed as a whole so the rename is handled consistently across query, model and export.

Sources

Drafted with AI assistance and checked against the sources above; expert review is in progress. Spotted an error? Tell us and it gets fixed, dated and listed on how this is written.