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.
| What the output shows | Change to make in the prompt |
|---|---|
| Too generic or shallow | Add specificity or examples, or explicitly ask for comprehensive output that goes "beyond the basics" |
| Off-topic or misses the point | State the actual goal and explain why you are asking |
| Inconsistent format | Add few-shot examples, or use prefilling to control how the response starts |
| Task too complex, results unreliable | Break it into multiple prompts (chaining), each doing one thing well |
| Makes up information | Give explicit permission to say "I don't know" when uncertain |
| Suggests changes when you wanted them made | Ask 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.
Outputs can disappoint in similar ways for different reasons, and each reason has its own fix. A longer prompt or a resent request doesn't address any particular cause. Splitting a task, for example, fixes over-complexity but does nothing for a vague request. That is why you diagnose first and then make the change that targets that cause.
“Don't use every technique at once: Select techniques that address your specific challenge.”Source: claude.com
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?
Correct answer: C — Work out what is actually wrong with the answer, since a vague ask and missing material need different fixes.
- A. Length is not the variable. A longer version of an unclear request is still unclear, and padding can bury the one instruction that mattered.
- B. Resending an unchanged request repeats the conditions that produced the weak answer, so any improvement is chance rather than a fix.
- C. Correct. The causes call for opposite responses: a vague ask needs a tighter specification, missing source material needs the material supplied, and a wrong task needs restating. Changing something before knowing which it is means guessing.
- D. Splitting up helps when a request is genuinely doing too much, but applied blindly it produces four requests carrying the same original flaw.
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.
| Less effective | More effective | What the rewrite adds |
|---|---|---|
| NEVER use ellipses | Your 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 dashboard | Create 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?
A bare rule tells Claude what to avoid but not why, so Claude can't extend it to similar cases. Once Claude knows the reason, it can generalise from it. Capitals, repetition and longer lists of rules add emphasis but no new information. Resending the request leaves the cause in place.
“Claude is smart enough to generalize from the explanation.”Source: platform.claude.com
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?
Correct answer: A — Remove the bullet points and headers from the prompt itself so the prompt's own style matches the desired flowing-prose output.
- A. Correct. Anthropic notes that the formatting style used in the prompt influences Claude's response style, so removing bullet points and headers from the prompt can help the model adopt the desired flowing-prose style.
- B. Incorrect. Adding more bullet points would reinforce, not reduce, the bullet-point pattern the team is trying to eliminate, making it even harder for Claude to avoid that structure.
- C. Incorrect. The core issue is not instruction recency but the prompt's own style. Moving the anti-bullet instruction to a later turn does not address the underlying influence of the prompt's bulleted formatting.
- D. Incorrect. Increasing temperature affects randomness in word choice and phrasing, but it does not discourage structural elements like lists or bullet points, which are determined more by the prompt's formatting.
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?
Correct answer: A — Append a step instructing Claude to verify its answer against the problem constraints before giving the final answer.
- A. Correct. Adding an explicit self-verification step prompts Claude to check its solution against the original constraints, which can catch arithmetic errors before the final output. This technique directly addresses the need for error detection without altering the evaluation pipeline.
- B. Incorrect. Removing instruction to show steps discourages structured, step-by-step reasoning that helps maintain accuracy on multi-step math problems. Without explicit reasoning, arithmetic slips are more likely to occur and go unnoticed.
- C. Incorrect. Suppressing intermediate work hides the reasoning chain, preventing both the model and reviewers from spotting where arithmetic errors happen. It eliminates any chance for self-correction and does not add a verification mechanism.
- D. Incorrect. Repeating the same approach twice does not introduce a genuine check, because identical reasoning is likely to reproduce the same mistake. Since only the first result is used, the second computation provides no error-catching benefit.
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?
If the inputs are the same and only one thing differs, any change in the output comes from that difference, and fixed criteria tell you whether the change counts as better. Testing on a new input or judging from memory mixes the prompt change up with other differences. Adding more examples at the same time means you can't tell which one made the difference.
“Run a representative sample of your traffic with and without the guidance”Source: platform.claude.com
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?
Every addition costs tokens and context. You are aiming for the prompt that meets your criteria reliably with the least structure needed, so an addition that showed no improvement should come out instead of staying in "just in case".
“Start simple and add complexity only when needed. Test each addition to see if it actually improves results.”Source: claude.com
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
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?
A prompt tuned against one input can come to depend on that input's quirks, and this overfitting only shows up on inputs it has never seen. Testing on inputs that reflect the real task distribution, including edge cases, is what shows the prompt is ready. Repeated runs on the same invoice and guessed instructions both skip that test.
“Design evals that mirror your real-world task distribution. Don't forget to factor in edge cases!”Source: platform.claude.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://claude.com/blog/best-practices-for-prompt-engineeringSecondary source
“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.
“A clear definition of the success criteria for your use case”
↩︎ Iteration is a diagnose-change-test loop - 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 - 4.https://support.claude.com/en/articles/7996857-my-prompt-isn-t-giving-me-a-helpful-answerOfficial docs
“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 - 5.https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practicesOfficial docs
“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 - 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