Topic 4 of 5 · 4 min read
Keeping 2,000-word prompts maintainable
Goal: Review a diff to a long prompt and find the contradiction, duplicate or dead rule it introduces.
Treat a long prompt like source code: keep it in version control, review every change as a diff, and delete rules that no longer earn their place. A prompt that grows by patches turns into a pile of contradictions.
Check yourself · 1 of 3
A prompt change adds "Always quote the price" while an older line says "Never mention pricing". What should the reviewer do?
Why it matters
Prompts grow because every bug gets a new line. "Never mention pricing." Three months later someone adds "Always include the price of the plan." Both rules sit 800 words apart. The model does not raise an error. It picks one, differently on different days, and you chase a bug you cannot reproduce.
Long prompts also hide dead rules: a ban on a feature you removed, a format the parser no longer reads. Dead rules cost tokens and give the model more to misread.
How to do it
- Keep the prompt in a file under version control, not in a dashboard text box. Every change then has an author, a date and a diff.
- Review the diff, not the whole prompt. For each added line ask: does it contradict an existing rule? Does it repeat one? Is it in the right section?
- Search for the keywords. If you add a rule about "price", search the prompt for "price", "cost" and "plan".
- Fix the cause, not the symptom. If the model fails a rule, check the order, the wording and the examples before adding a louder copy.
- Prefer the positive. "Write in two sentences" is clearer than a list of things not to do.
- Keep a small regression set: a dozen real inputs with expected behaviour. Run it before and after each change.
- Prune on a schedule. Remove a rule, run the set, keep the removal if nothing breaks.
Before and after
<rules>
Keep replies under 80 words.
- Never mention pricing.
+ Always include the plan price in the reply.
+ Keep replies short.
</rules>
The diff adds a rule that contradicts the old one, which stays in place, and a duplicate of the length rule. The fix: decide which pricing rule is true, delete the other, and drop the duplicate.
What goes wrong
- Patch-on-patch. Each fix adds a rule and nobody removes the old one.
- Editing in a dashboard with no history, so nobody can say what changed last Tuesday.
- Capital letters and "very important". Emphasis inflation makes every rule seem equally urgent.
- Reviewing only wording. The question is whether the model's behaviour changed, so run the test set.
Examples
The contradiction in a diff
- Refuse requests for legal advice.
+ Answer legal questions in detail.
Always add the disclaimer: "This is not legal advice."
The disclaimer line now describes behaviour that the new rule changes. A reviewer should ask what the intended behaviour is and update both lines.
A dead rule
Use the "export_pdf" tool when the user asks for a PDF.
The tool was removed in March. The model may now invent calls to it. Deleting the line is the whole fix, and the regression set confirms nothing else relied on it.
Key points
- Keep long prompts in version control and review every change as a diff.
- For each added line, check for contradictions with existing rules and for duplicates.
- Dead rules for removed features cost tokens and give the model more to misread.
- Fix failures at the cause (order, wording, examples) before adding a louder rule.
- Keep a small regression set of real inputs and run it before and after each prompt change.
Common mistakes
- Adding a new rule for every bug without removing or merging the old one.
- Keeping the prompt only in a dashboard text box with no history or review.
- Using capitals and "very important" so many times that no rule stands out.
- Changing a prompt without running a set of real inputs before and after.
Check yourself · 2 of 3
Why store a production prompt in version control rather than a dashboard text box?
Check yourself · 3 of 3
You removed the PDF export feature from your app. What should you do with the prompt line that tells the model to call "export_pdf"?
Practice items, not counted towards your mastery.
Start here
- Prompting best practices (Claude docs) (opens in a new tab)DocsFree
Official advice on XML tags, putting long documents first and the query last, and keeping prompts consistent.
- GPT-4.1 prompting guide (OpenAI Cookbook) (opens in a new tab)DocsFree
Compares Markdown, XML and JSON delimiters for long context and says where to place instructions.
- Lost in the Middle: How Language Models Use Long Contexts (opens in a new tab)PaperFree
The study showing that models use information at the start and end of a long context better than the middle.
More for this topic
- Prompt injection series (Simon Willison) (opens in a new tab)ArticleFree
Long-running notes on why delimiters and escaping do not fully stop prompt injection.