CertSafari
    Anthropic Claude Certified Associate – Foundations (CCAO-F)· Lessons

    Domain 1 · Lesson 3/30

    Iterating prompts: diagnose, change one thing, test

    Iterate prompts to improve output quality

    17 min read
    3.5% of exam
    6 sources
    Published 19 Oct 2026
    Docs as of 14 Oct 2026

    What you will be able to do

    • Run prompt iteration as a loop: diagnose the output, make a change, then test it against criteria you set in advance
    • Choose the prompt change that fits the diagnosed problem, and spot changes that only feel like progress
    • Change one variable per round so an improvement can be traced to its cause, and recognise when to stop
    • Test a refined prompt on varied inputs and edge cases before adopting it as a standard

    Key concept

    Diagnose-change-test loop — Improving a prompt means working out what is wrong with the output, changing the part of the prompt that causes it, and checking the new output against criteria fixed beforehand. A reworded retry skips the diagnosis and the test, so it produces a different output rather than a better one.

    1.Iteration is a diagnose-change-test loop

    A first prompt rarely gives you exactly the output you wanted. What you do next decides whether the second attempt is better or only different. Iterating a prompt is a deliberate loop. You diagnose what is wrong with the output, change the part of the prompt responsible, and test whether the change moved the output toward the target. A reworded retry skips the first and last steps: it changes words without knowing which problem they address, and it judges the result by feel.

    The loop needs a fixed target. Anthropic's prompt engineering guidance assumes three things before any tuning starts: a clear definition of success for the use case, some way to test against that definition, and a first draft to improve. Before each round, decide what "better" means. It might be a length, a level of depth, a format, or figures that must match the source. Then the next output gets compared with that standard, not with a vague impression of the last one. Defining success criteria before delegating or judging covers how to write those criteria. Without them you cannot tell an improvement from a change.

    Diagnosis comes before any edit, because outputs that disappoint in the same way can have different causes, and each cause needs its own fix. A flat campaign brief might come from a vague request that gave no audience, goal or expected depth. It might also come from missing material: Claude was never given the product facts the brief depended on. A longer, more specific request helps the first case and does nothing for the second. Attaching the product sheet fixes the second and leaves the first untouched. The same applies when an otherwise readable report quotes wrong figures. Rewording the request won't help if the figures were never in the prompt. Diagnosing poor output: five causes that look alike teaches how to tell the causes apart. Use its verdict to decide what to change before you touch the wording.

    Common output problems and the prompt change each one calls for
    What the output showsChange to make in the prompt
    Too generic or shallowAdd specificity or examples, or explicitly ask for comprehensive output that goes "beyond the basics"
    Off-topic or misses the pointState the actual goal and explain why you are asking
    Inconsistent formatAdd few-shot examples, or use prefilling to control how the response starts
    Task too complex, results unreliableBreak it into multiple prompts (chaining), each doing one thing well
    Makes up informationGive explicit permission to say "I don't know" when uncertain
    Suggests changes when you wanted them madeAsk for the action directly: "Change this function" rather than "Can you suggest changes?"

    Two terms in the format row need unpacking. Few-shot examples are sample inputs paired with the output you want, placed in the prompt so Claude can copy the pattern; a single pair is one-shot. Prefilling means writing the first words of Claude's response yourself, such as an opening brace to force JSON, so the reply continues from your start and skips any preamble. Prefilling the last assistant turn is not supported on Claude 4.6 models and later, which return a 400 error. On those models, state the format directly or show it with examples.

    Some moves feel productive but aren't. Sending the identical request again leaves the cause where it was. Making the prompt much longer is not a fix in itself, because longer, more complex prompts are not always better. Splitting a request into four smaller ones is the remedy for a task that is too complex, not for one that was underspecified. Each of these can still be the right move once the diagnosis calls for it. The mistake is reaching for one before you know what is wrong. Follow-up instructions, clarifications and requests to rewrite are all legitimate tools, as long as each one targets the diagnosed problem.

    Checkpoint 1 of 8· Match them up

    You've diagnosed what's wrong with each output. Match each diagnosis to the prompt change that fixes it.

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 8· Exam question

    A marketing coordinator's first attempt at a campaign brief comes back disappointing. She wants to improve the result on her next attempt. What should she do first?

    Sources12345

    2.Changes that reliably move the output

    Once the diagnosis names the problem, a few kinds of change keep earning their place. They work because they give Claude information it was missing, not because they say the same thing more forcefully.

    Give the reason behind a rule. A bare prohibition tells Claude what to avoid but not what you are trying to achieve, so it cannot apply the rule sensibly to related cases. Explaining the motivation lets Claude generalise from it. Spell out depth when output is too shallow. An accurate but thin draft usually means the request never said how deep to go. Asking explicitly for a fuller treatment, or naming the specific elements to cover, closes that gap.

    Two rewrites from Anthropic's prompting guidance: adding the reason, and adding the expected depth
    Less effectiveMore effectiveWhat the rewrite adds
    NEVER use ellipsesYour response will be read aloud by a text-to-speech engine, so never use ellipses since the text-to-speech engine will not know how to pronounce them.The reason, so Claude can generalise to similar cases
    Create an analytics dashboardCreate an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation.An explicit expectation of scope and depth

    Add a self-check when errors slip through. If outputs sometimes contain mistakes that go uncaught, such as an arithmetic slip in a multi-step word problem, add a closing step like "Before you finish, verify your answer against [test criteria]." This catches errors reliably, especially in coding and maths. The fix only works if the check is against the problem's constraints. Asking for just the final number hides the working that could be checked. Solving the problem twice the same way and keeping the first result repeats the same mistake. One model-specific exception: Claude Opus 5 already verifies its own work well, and on that model you should remove such instructions rather than rewrite them.

    Make the prompt's own shape match the output you want. Claude follows patterns as well as instructions. Recent models pay very close attention to details in examples, and they pick up unintended patterns when examples don't vary enough. The prompt's own formatting is one of those patterns. A prompt that asks for flowing prose but is built from bullet lists under headers shows Claude the very structure it forbids. When a clear formatting instruction is still ignored in some outputs, rewrite the prompt in the style you want back: plain paragraphs to get plain paragraphs. Capitals, repetition or more lists of rules only add more of the pattern you are fighting.

    Add examples one at a time. When the format or tone is easier to show than describe, start with a single example. Add more only if the output still doesn't match what you need.

    Checkpoint 3 of 8· Check yourself

    A voice assistant's prompt says "NEVER use ellipses." Replies now avoid ellipses but still contain other symbols that the speech engine reads out awkwardly. Which revision is most likely to help Claude handle related cases like these, including ones the prompt doesn't list?

    Checkpoint 4 of 8· Exam question

    After rewriting an instruction to say "write in flowing prose, avoid bullet points," a team still finds Claude's responses returning to bulleted lists in some outputs. They notice their own prompt itself is written using bullet points and headers throughout. Which additional iteration is most likely to help?

    Checkpoint 5 of 8· Exam question

    A prompt asks Claude to solve multi-step math word problems, but a review of outputs shows occasional arithmetic slips that go uncaught. The team wants to iterate on the prompt to catch these errors before the final answer is returned, without switching to a different evaluation pipeline. Which addition to the prompt best addresses this?

    Sources51

    3.Change one thing, then test

    Change one variable per round. When a round swaps the role, adds examples and restructures the format all at once, any improvement can't be attributed and any regression can't be traced. You end up keeping all three changes, including the ones that did nothing. A single change, tested against the criteria you set, tells you whether that change earns its place. Anthropic's guidance on steering Claude's thinking states the general rule: a prompt change changes model behaviour, so measure it before you ship it. Run a representative sample of inputs with and without the new guidance, and compare the results that matter to you. Same inputs and one difference means any shift in the output belongs to that difference.

    Wording is a variable too. Steering effectiveness can be sensitive to exact wording, so if one phrasing doesn't produce the behaviour you want, a more direct variant is a legitimate next round. It is still one change, and it still gets tested.

    Stop once further rounds stop paying off. Every addition has a cost: examples, extra prompts and detailed instructions all consume tokens and add context overhead. The goal is the prompt that meets your criteria reliably with the minimum structure needed, not the longest one you can build. When the output meets the criteria you set, the loop is done. When the last round or two produced no measurable gain against those criteria, more tuning of the same kind is unlikely to help either. An addition that tested as no improvement should come back out, not stay in "just in case".

    Checkpoint 6 of 8· Check yourself

    To fix inconsistent formatting, you add one few-shot example to a support-reply prompt. What is the best way to find out whether the example actually helped?

    Checkpoint 7 of 8· Check yourself

    After several rounds, a report prompt meets most of your criteria. The latest addition, a detailed role description, showed no measurable gain when tested. What should you do with it?

    Sources61

    4.Test beyond the input you tuned on

    A prompt refined over many rounds against the same input has been shaped by that input. Each change was judged by whether it helped on one document, so the prompt can quietly come to depend on that document's quirks: its length, its layout, how its figures are labelled. Then it fails on the next one. That is overfitting. It is invisible as long as you keep testing on the input you tuned on, and it only shows up when you run the prompt on inputs it has never seen.

    Before treating a prompt as finished, run it on a varied set that reflects the inputs it will really meet. Anthropic's evaluation guidance asks for test cases that mirror your real-world task distribution and include edge cases, such as:

    • input data that is irrelevant or missing
    • input that is too long
    • ambiguous cases where even human reviewers would disagree
    A labelled test set that deliberately includes hard cases (sarcasm, mixed sentiment) alongside easy onespython
    tweets = [
        {"text": "This movie was a total waste of time. 👎", "sentiment": "negative"},
        {"text": "The new album is 🔥! Been on repeat all day.", "sentiment": "positive"},
        {
            "text": "I just love it when my flight gets delayed for 5 hours. #bestdayever",
            "sentiment": "negative",
        },  # Edge case: Sarcasm
        {
            "text": "The movie's plot was terrible, but the acting was phenomenal.",
            "sentiment": "mixed",
        },  # Edge case: Mixed sentiment
        # ... 996 more tweets
    ]

    The same principle covers any examples inside the prompt. Examples that all look alike teach Claude patterns you never intended, so vary them enough to cover edge cases. Repeated runs matter too: check whether the format stays consistent across several attempts, because a prompt that works once on one input hasn't shown that it will keep working.

    Once varied testing confirms the prompt works, save it as a reusable standard. Don't retype it from memory or fix the same problems by hand in each new session. Instructions that should apply every time belong in persistent configuration such as CLAUDE.md files or skills, not in each individual prompt. Updating instructions instead of repeating corrections covers how to maintain them. The varied-input test comes first: a prompt adopted as a team's standard after tuning on one supplier's file carries that file's quirks to everyone who uses it.

    Checkpoint 8 of 8· Check yourself

    Your manager wants to make your invoice-extraction prompt the team standard. You refined it over twelve rounds against one supplier's invoice, and it now handles that invoice perfectly. What should you do before it is adopted?

    Sources351

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Don't forget to iterate: The first prompt rarely works perfectly. Test and refine.”
      ↩︎ Iteration is a diagnose-change-test loop
      “Problem: Response is too generic → Solution: Add specificity, examples, or explicit requests for comprehensive output.”
      ↩︎ Iteration is a diagnose-change-test loop
      “Don't over-engineer: Longer, more complex prompts are NOT always better.”
      ↩︎ Iteration is a diagnose-change-test loop
      “Prefilling lets you start the AI's response for it, guiding format, tone, or structure.”
      ↩︎ Iteration is a diagnose-change-test loop
      “Ensure your examples align with the behaviors you want to encourage and minimize any patterns you want to avoid.”
      ↩︎ Changes that reliably move the output
      “Pro tip: Start with one example (one-shot). Only add more examples (few-shot) if the output still doesn't match your needs.”
      ↩︎ Changes that reliably move the output
      “Test each addition to see if it actually improves results.”
      ↩︎ Change one thing, then test
      “it adds context overhead through additional token usage”
      ↩︎ Change one thing, then test
      “It's the one that achieves your goals reliably with the minimum necessary structure.”
      ↩︎ Change one thing, then test
      “Is the format consistent across multiple attempts?”
      ↩︎ Test beyond the input you tuned on
      “For instructions you want applied to every session rather than every prompt, move them into CLAUDE.md files, skills, or other steering methods.”
      ↩︎ Test beyond the input you tuned on
      “Don't over-engineer: Longer, more complex prompts are NOT always better.”
      ↩︎ Exam trap 1
      “Don't use every technique at once: Select techniques that address your specific challenge.”
      ↩︎ Checkpoint
      “Start simple and add complexity only when needed. Test each addition to see if it actually improves results.”
      ↩︎ Checkpoint
    2. 3.
      “Building a successful LLM-based application starts with clearly defining your success criteria and then designing evaluations to measure performance against them.”
      ↩︎ Iteration is a diagnose-change-test loop
      “Be task-specific: Design evals that mirror your real-world task distribution. Don't forget to factor in edge cases!”
      ↩︎ Test beyond the input you tuned on
      “This cycle is central to prompt engineering.”
      ↩︎ Key concept
      “Be task-specific: Design evals that mirror your real-world task distribution. Don't forget to factor in edge cases!”
      ↩︎ Exam trap 4
      “Design evals that mirror your real-world task distribution. Don't forget to factor in edge cases!”
      ↩︎ Checkpoint
    3. 4.
      “Give Claude feedback: you provide Claude with follow-up instructions, clarifications, or ask it to rewrite an answer.”
      ↩︎ Iteration is a diagnose-change-test loop
    4. 5.
      “A few well-crafted examples (known as few-shot or multishot prompting) improve accuracy and consistency.”
      ↩︎ Iteration is a diagnose-change-test loop
      “prefilled responses (providing a partial assistant message for Claude to continue from) on the last assistant turn are no longer supported”
      ↩︎ Iteration is a diagnose-change-test loop
      “Providing context or motivation behind your instructions, such as explaining to Claude why such behavior is important, can help Claude better understand your goals”
      ↩︎ Changes that reliably move the output
      “This catches errors reliably, especially for coding and math.”
      ↩︎ Changes that reliably move the output
      “On Claude Opus 5, remove these instructions rather than rewriting them.”
      ↩︎ Changes that reliably move the output
      “Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”
      ↩︎ Changes that reliably move the output
      “Diverse: Cover edge cases and vary enough that Claude doesn't pick up unintended patterns.”
      ↩︎ Test beyond the input you tuned on
      “Claude is smart enough to generalize from the explanation.”
      ↩︎ Exam trap 2
      “Claude is smart enough to generalize from the explanation.”
      ↩︎ Checkpoint
    5. 6.
      “Prompt-based steering changes model behavior, so treat it like any other prompt change: measure before you ship.”
      ↩︎ Change one thing, then test
      “Run a representative sample of your traffic with and without the guidance”
      ↩︎ Change one thing, then test
      “Steering effectiveness can be sensitive to exact wording.”
      ↩︎ Change one thing, then test
      “Prompt-based steering changes model behavior, so treat it like any other prompt change: measure before you ship.”
      ↩︎ Exam trap 3

    Ready to test yourself?

    Practise the 22 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.