Skip to main content

How to Version Your Prompts

Guide · about 6 min · refs checked 2026-11-03 (reference links and dates only)

If you can't say which change moved your live numbers, it's usually because prompts live inside code and get edited on the fly. The minimal way to treat prompts like code.

How to
Move prompts out of code strings into their own files: editing a prompt shouldn't require a rebuild or redeploy. Commit every change with the motivation written down: traceable, diffable, revertable — just like code. Pair changes with a regression run: fixed inputs, old vs new outputs; without an eval, "improved" is a feeling. Record prompt and model version as a pair: the same prompt can break on a new model; log them together. When production misbehaves, check the prompt changelog first: prompts are a common change source that rarely sits inside the audit trail. Control variables in A/B comparisons: swap prompt and model together and you'll never know which one did it.

Example and interpretation

A teaching scenario, not a measured or executed site test.

Keep v1 and v2, recording one change: mark missing information unknown. Compare the same inputs and model settings, checking invented details and regressions. Do not change the model simultaneously and attribute every difference to the prompt.

How to check your practice

Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.

For this topic, start with missing input · See all six scenarios and their reasoning

Sources
  • Prompt Engineering Guide ↗
  • Git documentation ↗
  • Ribeiro et al., Why Should You Trust Your Model? ↗