LearnAI ToolsCareerPractice BuildsPlayDevelopmentContact
Lesson 712 min read

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.

What You Will Learn
  • 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:

SymptomLikely causeTry this fix
Generic, could apply to anyoneMissing contextAdd who it is for, why, and specific details
Far too long or too shortNo length givenState a number: words, sentences or bullets
Wrong format or structureFormat not describedDescribe the format and show one example
Ignores one of your instructionsInstruction buried or conflictingMove it to the end, number the rules, remove conflicts
Invents facts or detailsNo source, no permission to say “unknown”Provide the source text; allow “I don’t know” or null
Wrong toneNo audience or tone statedDescribe the reader and the tone you want
Mini Challenge · Spot What's Missing

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?

Choose one answer

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.

Mini Challenge · Put It in Order

Put the steps of the prompt iteration loop in order.

  1. Change one thing in the prompt that should close the gap
  2. Write down what a good answer must include
  3. Run it again and check whether the gap closed
  4. Run the prompt and read the answer
  5. 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.

Mini Challenge · Fix the Prompt

This prompt keeps producing answers with jargon even though it asks for plain language. Which revision is the best next experiment?

Current prompt
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.
Choose one answer

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.

Next Lesson →

Prompting for Code: Debugging, Refactoring & Tests