Iterating on Prompts: Diagnose and Fix Bad Outputs
Learn a repeatable way to improve prompts: define what good looks like, diagnose why an answer missed, change one thing at a time and re-test.
On this page 7 sections
Introduction
Even experienced prompt writers rarely get a prompt perfect on the first try. The difference between a beginner and an expert is what happens next. A beginner rewrites the whole prompt at random, or adds “PLEASE” in capital letters. An expert looks at what went wrong, forms a theory about why, changes one thing and checks whether it helped — the same way a programmer debugs code.
- How to define what a good answer looks like before you start.
- Common symptoms of a bad answer and the prompt problems behind them.
- A simple, repeatable loop for improving any prompt.
Start by Defining Success
You cannot fix an answer if you cannot say what is wrong with it. Before iterating, write down two or three concrete criteria: “under 150 words”, “mentions the return policy”, “friendly but not casual”, “valid JSON with all five fields”. Concrete criteria turn a vague feeling (“this isn’t quite right”) into a specific gap you can close.
It also helps to keep one example of an answer you would be happy with. Comparing each new result against that “gold” answer makes differences easy to spot — missing points, a different structure, the wrong level of detail. If you cannot describe or show what a good answer looks like, the problem may not be the prompt at all: it may be that the task itself still needs to be decided.
Symptoms and Their Causes
Most bad answers fall into a few recognisable patterns, and each points to a likely gap in the prompt:
| Symptom | Likely cause | Try this fix |
|---|---|---|
| Generic, could apply to anyone | Missing context | Add who it is for, why, and specific details |
| Far too long or too short | No length given | State a number: words, sentences or bullets |
| Wrong format or structure | Format not described | Describe the format and show one example |
| Ignores one of your instructions | Instruction buried or conflicting | Move it to the end, number the rules, remove conflicts |
| Invents facts or details | No source, no permission to say “unknown” | Provide the source text; allow “I don’t know” or null |
| Wrong tone | No audience or tone stated | Describe the reader and the tone you want |
You asked for “a product description for our new water bottle”. The answer is pleasant but could describe any water bottle ever made. What is the prompt most likely missing?
The Iteration Loop
Improving a prompt works best as a loop: run the prompt, compare the result with your success criteria, form a theory about the gap, make one targeted change and run it again. Changing one thing at a time matters — if you rewrite three things at once and the answer improves, you will not know which change helped, and you might keep a change that actually made things worse.
Put the steps of the prompt iteration loop in order.
- Change one thing in the prompt that should close the gap
- Write down what a good answer must include
- Run it again and check whether the gap closed
- Run the prompt and read the answer
- Compare the answer with your criteria and name the gap
Keep your earlier versions. Saving each version of the prompt with a note on what changed and what happened lets you go back if a change makes things worse, and builds your intuition for which fixes work.
This prompt keeps producing answers with jargon even though it asks for plain language. Which revision is the best next experiment?
Write a 300-word explanation of cloud computing covering servers, data centres, virtualisation, IaaS, PaaS, SaaS, pricing models, security and the history of the industry. Use plain language.
Test on More Than One Input
A prompt that works for one example can fail on the next. If a prompt will be reused — summarising every support email, or tagging every product — collect five to ten realistic inputs, including awkward ones (very short, very long, unusual, missing information). After each change, run the prompt on all of them. This small test set stops you from fixing one case while quietly breaking another.
Also remember that answers vary a little from run to run. Before deciding a change helped, run it more than once. Consistent improvements across several runs and inputs are the ones worth keeping.
Key Takeaways
- Define concrete success criteria before iterating.
- Match symptoms to likely causes: generic answers mean missing context, wrong length means no number, and so on.
- Change one thing at a time and keep earlier versions.
- Test reusable prompts on a small set of varied inputs, and run each more than once.
Summary
Iteration turns prompting from guesswork into a repeatable process. Next you will apply everything so far to one of the most popular uses of AI: getting help with code — debugging, refactoring and writing tests.