Chapter 4 · Beyond Text and Trustworthy Use
Iteration and Debugging: Diagnosing Weak Outputs One Change at a Time
- Page 19 of 24
- 15 min read
Sooner or later a prompt that worked yesterday gives a weak answer today, or a new prompt gives a weak answer at once. Most people then do one of two things: they give up, or they rewrite the whole prompt and hope. Both waste time, because you never learn what caused the problem. People who maintain prompts for real work do something calmer: they look at the weak output, name the symptom, guess the most likely cause, change one thing and compare. This page teaches that routine. It is the same habit as debugging in programming, and it needs no code.
In Clarify, Iterate, Improve: From a Vague Request to a Specific Prompt you improved a prompt by trial and error. In Constraints, Delimiters and a Reusable Prompt Checklist you met a checklist for writing. Here the checklist works backwards: you start from a bad output and find which part of the prompt to fix.
What you will learn
- How to save a prompt that works, with a clear name, its task and audience, and one sample input with the output you expect.
- Why you should change one prompt element at a time, and how to compare outputs before and after a revision with a small log.
- How to diagnose four common problems: missing context, ambiguous instructions, outputs that are too long or unfocused, and wrong formats.
- A diagnosis table (symptom, likely cause, one change to try) that you can reuse.
Save what works
The first step of debugging happens before anything breaks: when a prompt gives you a useful result, keep it. Otherwise, next week you will remember that it worked but not how you wrote it, and you will start again.
Save a prompt that produces a useful result
Save the prompt text exactly as you sent it, not a shortened version from memory. A notes app, a text file or a spreadsheet is enough. Do not trust the chat history of your app for this: it can be hard to search, and some apps delete or limit history. Copy the prompt into your own file the moment it works.
Give every saved prompt a clear name
A name should tell you what the prompt does, for whom, and which version it is. Compare:
| Unclear name | Clear name |
|---|---|
| prompt 3 | feedback-summary-for-manager-v2 |
| good email one | delay-notice-customer-email-v1 |
| new final | meeting-notes-actions-table-v3 |
The pattern is task-audience-version, in lowercase with hyphens, so that the names sort and search well. Increase the version number only when you change the prompt. This is the same idea as the version names you met in Git, APIs and Backend for AI: Advanced, in small form.
Record the intended task and audience
Write a line or two about what the prompt is for and who will read the result. Months later you will not remember, and a teammate never knew. The task and audience also tell you what "good" means when you test the prompt after a change.
Save a representative input and the expected output
A representative input is a typical example of what you will feed the prompt: not the easiest case and not the strangest. The expected output is what a good answer looks like. It can be an example you wrote or edited yourself, or a short list of things a good output must contain. With these two, you can rerun the prompt at any time and see quickly whether it still works. Here is a complete saved entry. We call it a prompt card.
Name: feedback-summary-for-manager-v5
Task: Summarise customer feedback comments for a weekly manager report.
Audience: Shop manager; reads on a phone; has two minutes.
Last changed: 2026-10-12 (v4 to v5: added "Use only the comments")
PROMPT
Summarise the customer comments below for a shop manager.
Write at most 3 bullets, each under 20 words. Start with the most common issue.
Use only the comments. Do not invent numbers.
Comments:
{comments}
TEST INPUT
1. "Parcel arrived 5 days late."
2. "Great mug, but the box was damaged."
3. "Delivery took a week, not 3 days."
4. "Lovely colour. Will buy again."
EXPECTED OUTPUT (what good looks like)
- First bullet is about late delivery (2 of the 4 comments mention it).
- Mentions the damaged box and the positive comment.
- At most 3 bullets, no invented numbers.Note how the expected output was written: it was counted from the test input (comments 1 and 3 mention late delivery, comment 2 a damaged box, comment 4 praise). Count it yourself before you save it. Check your own expected output: a wrong reference is worse than none, because it makes a good answer look bad. The card also shows a replaceable field, {comments}, which the next page uses.
Change one thing at a time
Change one prompt element at a time
When an output is weak, you will want to fix everything at once: add a role, add a format, add a limit, change the wording. If the result improves, you will not know which change helped. If it gets worse, you will not know which change hurt. Worse, some changes cancel each other out.
The discipline is simple. Look at the anatomy from The Anatomy of a Good Prompt: Task, Context, Input and Output Format: role, task, context, audience, constraints, output format, success criteria. Pick one of them, change it, run again, compare. If you need to change three things, make three runs.
One run is also a weak test. A model can give different answers to the same prompt. Before you decide that a change helped, run the same prompt a second time. If the two answers differ a lot, the difference you saw may be normal variation, not the effect of your change.
Compare outputs before and after a revision
Keep a small log. Each row is one revision. Below, Aiko in Osaka improves the prompt card above. The first version is: "Summarise these customer comments." The comments are the four test comments.
| Version | The one change | What the output did | Keep? |
|---|---|---|---|
| v1 | None (starting point) | Six sentences, a polite introduction, no priority order. | Baseline |
| v2 | Added the audience: "for a shop manager, two minutes to read" | Shorter (four sentences), still no order, no clear list. | Yes |
| v3 | Added the format: "at most 3 bullets, each under 20 words" | Three bullets. The first one is the positive comment. | Yes |
| v4 | Added the rule: "Start with the most common issue" | First bullet is late delivery. Damaged box and praise follow. | Yes |
| v5 | Added "Use only the comments. Do not invent numbers." | The invented "most customers" disappeared; checked against the comments. | Yes |
The table is the evidence. Each row has one change and one observation, so you could undo any row. It also shows you progress in small steps, which is more motivating than a vague feeling that the prompt is "better". Here are two outputs from the log, to compare before and after. They are examples written for teaching.
Example reply (illustrative; yours will differ):
v1 output:
Thank you for sharing these comments! Customers seem generally happy with the
products, although some had issues. One parcel was late, another had a damaged
box, and a third took longer than promised. Overall, most customers appear
satisfied and many plan to return.Example reply (illustrative; yours will differ):
v5 output:
- Late delivery is the main issue (2 of 4 comments: 5 days late; a week, not 3 days).
- One mug arrived in a damaged box.
- One customer likes the colour and plans to buy again.What to notice: v1 says "most customers appear satisfied and many plan to return", which the four comments do not support (only one says so). v5 uses counts that you can check against the input: two comments mention late delivery. Checking is the last step of every comparison: count, quote, look.
Diagnose the cause
Changing one thing is only useful if you pick a good thing to change. Match the symptom you see to its likely cause. These are likely causes, not certain ones: a weak output can have more than one reason, and the table is a place to start, not a guarantee.
| Symptom | Likely cause | One change to try |
|---|---|---|
| Generic or invented details | Missing context | Add the real facts and "use only these facts". |
| Does a different job than you meant | Ambiguous instruction | Replace the vague verb with one action verb and name the product. |
| Too long, off-topic or full of extras | No length or focus limit | Add a length limit and say what to leave out. |
| Right content, wrong shape | Format not stated, or stated unclearly | Describe the shape exactly, with a small example. |
The next page, Building a Prompt Library: Names, Templates, Test Cases and Limitations, adds more rows. The four causes below come first.
Diagnose missing context
Symptom: the answer is generic, or it contains details you never supplied (a date, a name, a number, a reason). The model has no facts, so it writes plausible ones. The fix is to supply them. Do not ask the model to "be more specific" without giving it anything specific to use.
Weak prompt:
Write a reminder for tomorrow's workshop.Better prompt:
Write a reminder for tomorrow's workshop. Use only these facts:
- Workshop: Basic Spreadsheets, 2026-10-14, 10:00 to 12:00
- Place: Room 4, Lincoln Street Library
- Bring: a laptop with a spreadsheet program
If a fact is missing, write [MISSING] instead of inventing it.Test for this cause: look in the output for any fact that is not in your prompt. If you find one, context was missing (or the "use only" rule was).
Diagnose ambiguous instructions
Symptom: the answer is good but not what you meant: a summary when you wanted a list of actions, an explanation when you wanted a draft. Read your prompt as a stranger: could it mean something else? Words like "improve", "fix", "review" and "short" are common causes.
Weak prompt:
Improve this paragraph.Better prompt:
Rewrite this paragraph so that it is easier to read for a new employee.
Keep the meaning and every number. Do not add new information.
Return only the rewritten paragraph.What changed: "improve" could mean shorter, more formal, more correct or more persuasive. The better prompt names the action (rewrite), the reader (a new employee), what must not change (meaning, numbers) and what to return.
Diagnose overly long or unfocused outputs
Symptom: the answer repeats your question, adds a long introduction, lists ten tips when you needed one, or wanders into related topics. The model has no limit and no priority, so it tries to be complete. Give it a limit and a priority, and say what to leave out.
Better prompt:
Answer in at most 5 sentences. Give the single most important step first.
Do not repeat the question. Do not add an introduction or a conclusion.
If there are important extra points, say only "More on request."The last line is a useful trick: instead of fighting a long answer, you let the model say there is more, and you ask for it if you need it.
Diagnose incorrect output formats
Symptom: the content is right but you cannot use it: a paragraph instead of a table, extra text before a list, a different column order, or a date written in another style. Say the shape explicitly, and show a one-row example. Models follow a shown shape more reliably than a described one.
Better prompt:
Return only a table with these columns, in this order:
Name | Due date (YYYY-MM-DD) | Status (open or done)
Example row: Prepare slides | 2026-10-20 | open
No text before or after the table.Example reply (illustrative; yours will differ):
| Name | Due date | Status |
| Send invoice | 2026-10-18 | open |
| Book room | 2026-10-16 | done |What to verify: the column names and their order, the date style (YYYY-MM-DD), the allowed words in Status, and whether any extra text appears around the table. If a program or spreadsheet will read the result, check it the same way a program would: an unexpected column name is a failure. A format request improves your chances; it does not make a wrong format impossible.
Where this shows up at work
- Shared team prompts: when a colleague says "the summary prompt stopped working", a name, a version, a test input and a log let you find what changed in minutes.
- Customer-facing text: a stable saved prompt with a known test input is how you notice that a small edit started to produce invented offers.
- Building AI features: developers keep prompts as versioned files with test inputs, as in Git, APIs and Backend for AI: Advanced. The prompt card on this page is the beginner form of the same practice.
- Personal productivity: your own reusable prompts for email, notes and reports save more time when you know how to repair them.
Common mistakes
- Rewriting everything at once. You cannot tell what helped. The fix: change one element, run, compare.
- Judging by one run. Outputs vary. The fix: run a change twice before you decide, especially when the difference is small.
- No saved test input. You compare outputs on different inputs and learn nothing. The fix: keep one typical input with the prompt and reuse it.
- A wrong expected output. If your own reference is wrong, you fix good answers. The fix: check the expected output yourself, by counting it from the test input, as the prompt card did.
- Treating the table as a rule. The cause can be different, or several at once. The fix: use the table to choose what to test first, and let the result decide.
Try it yourself
- Easy. Name each symptom's likely cause from the diagnosis table: (a) the reply invents a phone number; (b) you asked "review this" and got a list of compliments; (c) the reply is 600 words when you needed 60; (d) you wanted CSV and got a paragraph.
- Medium. Choose a prompt from an earlier page that you use. Write its prompt card: name, task, audience, the prompt, one test input and an expected output. Then check your expected output against the input, as the page did, and fix it if needed.
- Hard. Take the prompt "Write a message about the meeting change." with these facts: the project meeting moves from Tuesday 2026-10-20 at 09:00 to Wednesday 2026-10-21 at 11:00; the room stays Room 2; attendance is still required. Run it as v1. Then make three revisions, each with exactly one change (for example context, then audience, then format). After each run, add a row to a log table like the one above, and run the final version twice. Decide which change helped most, and say how you know.
Answers
Easy. (a) Missing context: the facts were not given, so a number was made up; add the real number, or a rule to write [MISSING]. (b) Ambiguous instruction: "review" did not say what to check; ask for "list three possible errors in the figures". (c) No length or focus limit; add "at most 60 words". (d) Format not stated or unclear; describe the columns and show a sample row. Pass checklist: each cause names a prompt element, and each fix changes only one element.
Medium. Answers differ. Your card passes if: the name has task, audience and version; the task and audience are written in one or two lines; the test input is typical and short; the expected output states checkable points (counts, required items, limits); and when you compare the expected output with the test input, every statement is true.
Hard. A strong log looks like this. v1: the bare prompt gives a generic note with an invented reason for the change. v2 (change: add the facts): correct date and time, but a long reply. v3 (change: add "at most 50 words, audience: team members who read on a phone"): short and clear. v4 (change: add "Return a subject line and a body. Do not give a reason for the change; none was given."): ready to send. Pass checklist: each row changes exactly one element; the log notes what the output did, not just "better"; the final version was run at least twice; the date, time and room match the facts; there is no invented reason for the meeting change.
Summary
- Save a working prompt exactly, with a clear name (task, audience, version), a line on task and audience, one representative input and an expected output you have checked.
- Change one prompt element at a time, run twice when the difference is small, and keep a log of the change and what the output did.
- Diagnose from the symptom: invented details point to missing context, wrong job to ambiguity, long answers to missing limits, wrong shape to an unclear format.
- A diagnosis table gives you a place to start. It does not replace testing, and several causes can happen together.
Next: Building a Prompt Library: Names, Templates, Test Cases and Limitations continues the diagnosis table with unsupported claims and contradictory answers, and shows how to organise a personal library of tested prompts.

