Prompt Versioning and Evals: Treating Prompts Like Production Code
A prompt edit can silently break a feature that worked yesterday. How to version prompts, build a small evaluation set, and catch regressions before your users do.

Someone tweaks a prompt to fix one bad answer. The fix works. Two weeks later, support notices the summarisation feature has started dropping dates from every summary. Nobody connects the two, because nobody knew the prompt changed.
Prompts are code. They change behaviour, they can break things, and they deserve the same discipline.
Keep prompts in the repository
Prompts hidden in a database row or pasted into a dashboard cannot be reviewed, diffed or rolled back. Store them as files next to the code that uses them:
prompts/
summarise-ticket/
v3.md
v4.md
classify-intent/
v2.mdEvery change goes through a pull request, like any other code change.
Log the version with every call
Each model call should record the prompt name, prompt version, model name and model version. When an output looks wrong, you can see exactly which combination produced it.
Build a small evaluation set
You do not need thousands of examples. Start with 30–50 real inputs that represent normal cases, edge cases and past failures. For each, write down what a good output must contain.
{
class="text-code-string">"input": class="text-code-string">"Customer says order #4412 arrived damaged on 3 Oct...",
class="text-code-string">"must_include": [class="text-code-string">"4412", class="text-code-string">"damaged", class="text-code-string">"3 Oct"],
class="text-code-string">"must_not_include": [class="text-code-string">"refund approved"],
class="text-code-string">"max_words": 60
}Add every production failure you find to the set. Over time it becomes a precise description of what your feature must do.
Use the right kind of check
| Check type | Good for | |---|---| | Exact / contains | Required facts, IDs, labels | | Schema validation | Structured outputs | | Length and format | Summaries, titles | | Model-graded rubric | Tone, helpfulness, faithfulness | | Human review | Final judgement on a sample |
Model-graded checks are useful but imperfect. Keep the rubric narrow ("Does the summary mention every date in the input? yes/no") rather than "rate quality from 1–10."
Run evals on every change
Changing the prompt, switching models, or updating retrieval should all trigger the eval run. Compare the new pass rate against the current version and look at every case that flipped from pass to fail.
classify-intent v2 -> v3
pass: 44/50 -> 47/50
newly failing: case_17, case_31
newly passing: case_04, case_22, case_40, case_45, case_49A higher score with new failures still needs review — those two failing cases might matter more than the five fixed ones.
Pin model versions
Model aliases that automatically move to newer versions can change behaviour under you. Pin a specific version in production, and upgrade deliberately, with an eval run, like any dependency upgrade.
Roll out gradually
For high-traffic features, send a small share of traffic to the new prompt version first and compare real outcomes — user ratings, retries, escalations — before switching fully.
Keep it lightweight
None of this requires a platform. Prompts in files, a JSON eval set, and a script that runs the cases and prints a comparison table will catch most regressions. Add tooling once the simple version becomes painful.
The teams that ship reliable AI features are not the ones with the cleverest prompts. They are the ones who notice when a prompt gets worse.
Paj Digital Labs
The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.
Related reading

Streaming AI Responses: Partial Text Is Not a Completed Result
Streaming improves perceived speed but adds cancellation and partial-output states. Keep tool actions, structured results and saved answers behind a verified completion boundary.

Human Review Queues for AI: Confidence Is Not a Permission Slip
A model’s self-reported confidence does not establish accuracy. Route uncertain and consequential cases using tested rules, show reviewers the evidence and record their decisions without rubber-stamping.

AI Evaluation Sets: Keep the Test Data Out of the Tuning Loop
An evaluation stops being independent when every prompt revision is shaped around its answers. Separate development examples from held-out cases and measure meaningful failure categories.