Prompts rot silently
Prompts are code. They have bugs. They drift when the underlying model changes. They get tweaked for one use case and break another. Prompt regression tests are unit tests for prompts.
The shape of a prompt regression suite
Each test:
- Calls the production prompt with a known input.
- Asserts properties of the output: 'contains the user's name', 'is JSON-parseable', 'doesn't include forbidden phrase X', 'cites at least one source'.
- Doesn't assert exact wording (LLMs vary). Asserts structural / semantic invariants.
Common regression patterns
- JSON schema — the prompt is supposed to return JSON; the test validates against a schema.
- Forbidden phrases — the answer must not say 'I cannot help with that' for a topic we explicitly support.
- Citation density — the answer must reference at least N sources from the context.
- Tone / persona — answer must be in the agreed voice (Pippa's sassy reading; a brand's professional tone).
- Refusal correctness — for genuinely off-topic / unsafe inputs, the model must refuse.