Dev.to AI 🤖 Ai 👁 2 📖 3 min read

Treat prompts like code: versioning, evals and the four things that actually break

The third post in this series. Part 1 was choosing a model, part 2 was the async job layer. This one is about the thing everyone edits and nobody versions: the prompt. I've been treating prompts as strings for two years

The third post in this series. Part 1 was choosing a model, part 2 was the async job layer. This one is about the thing everyone edits and nobody versions: the prompt.

I've been treating prompts as strings for two years. I stopped last month, and the change was less about tooling than about admitting a hard truth: a prompt is a piece of business logic that silently changes behaviour when it changes.

Why "just tweak the prompt" is dangerous

A prompt edit has none of the safeguards a code edit has. It doesn't fail to compile. It doesn't break tests unless you wrote one for it. It doesn't show up in a diff review unless someone remembers to look. It just quietly alters what every user gets, starting now.

Then a week later someone says "the images got worse" and you have no idea which of the fourteen prompt edits since then did it, because you only kept the latest.

The fix is embarrassingly simple: prompts need stable IDs and versions, exactly like any other deployed artefact.

prompt_id: portrait_photoreal
version:   7
body:      "..."
model:     flux-2
created:   2026-11-28
eval:      0.83 / 24 cases

Store that row every time you generate. Now "the images got worse" is answerable: filter by prompt version, compare accept-rates, find the regression.

The four failure modes I actually hit

Not the ones from blog posts about prompt engineering. The ones that cost me actual debugging time.

1. Silent truncation. You append a new instruction to a long prompt and it starts getting cut off at the far end — the part the model reads least carefully. The symptom isn't an error, it's "the model stopped following the last rule". Check your token count after every edit, not once.

2. Instruction collision. You add "no text in the image" and it starts adding text, because mentioning text at all raises its probability. Diffusion models don't parse negation the way you expect. If you need something absent, it usually has to be expressed as a positive constraint or handled by restructuring, not by adding "no X".

3. Order sensitivity. The same three instructions in a different order produce different adherence. This is real and it's why prompt diffs matter: moving a sentence is a behaviour change, not a formatting change.

4. Model-prompt coupling. A prompt tuned for one model family quietly underperforms on another. This is the one that bites in multi-model products: you switch a user from Flux to Seedream and suddenly the output looks wrong — not because the model is worse, but because the prompt was written for Flux's reading habits.

The last one is why I eventually stopped maintaining per-model prompt variants by hand. When the same prompt has to work across several families — which is the whole point of routing image, video and audio through one interface — you either build a translation layer or you accept that the prompt is now model-specific. There isn't a third option I've found.

What an eval actually looks like when you're small

"Build an eval suite" sounds like a quarter of work. It doesn't have to be.

Mine is 24 cases in a YAML file. Each case is a prompt and a short list of things that must be true about the output:

- id: sign_text
  prompt: A wooden sign reading "OPEN 24H", photographed head-on
  must:
    - render_text: "OPEN 24H"      # human confirms
    - no_extra_glyphs: true

Twenty-four is enough. It takes forty minutes to label and it catches roughly three quarters of my regressions. The value isn't precision — it's that a prompt change now has a pass/fail before it reaches users.

Run it before every prompt deploy. Yes, manually at first. Automation can wait.

The minimum viable setup

If you take one thing from this post:

  • Every prompt gets an id and a version
  • Every generation logs both
  • A prompt change requires a version bump
  • You have fewer than 50 eval cases and that's fine

That's it. No framework, no vendor, no new dependency. A table and a YAML file.

The uncomfortable part is that this only pays off after the first incident. Before that, it feels like bureaucracy. After it, you'll wonder how you ever shipped prompts without it.

What I still haven't solved: evaluating prompts where "good" is genuinely subjective — style, mood, brand voice. My 24 cases all check things a person can verify in three seconds. For taste, I don't have a method, and I'd like to hear from anyone who does.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.