Skip to content
mentoor

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?

Choose one answer

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

  1. 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.
  2. 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?
  3. Search for the keywords. If you add a rule about "price", search the prompt for "price", "cost" and "plan".
  4. 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.
  5. Prefer the positive. "Write in two sentences" is clearer than a list of things not to do.
  6. Keep a small regression set: a dozen real inputs with expected behaviour. Run it before and after each change.
  7. 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?

Choose one answer

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"?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic