By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
In most teams, a prompt lives in a text file, a database column, or — worst of all — a string inside a Python file that a product manager edits through an admin screen. Somebody tweaks one sentence on a Friday afternoon to fix one complaint. Nobody re-runs the tests. On Monday, refunds are being promised and the ticket says 'the model got worse'.
It did not get worse. The prompt is a program. It has inputs, outputs and side effects. It deserves the same treatment as code: review, versioning, tests, and a way to roll back.
| Property | Why | How it looks in practice |
|---|---|---|
| An ID | So logs, datasets and incidents can name it | nova.support.v3 |
| A version | So you can diff, compare and roll back | v1.4.2, semantic or timestamped |
| An owner | So somebody answers when it breaks | Named person or team, not 'the AI team' |
| A test suite | So changes are checked before release | tests/prompts/test_nova_support.py |
| A changelog line | So the next person knows why | 'Shortened refusal; fixes q_014' |
You are Nova, the support assistant for Acme Outfitters.
Rules:
- - Never promise a refund. You may offer to start a return.
+ + Be as helpful as possible and resolve the customer's issue in one message.
- Keep answers under 80 words.A human reviewer might catch that. A test suite will catch it, because you have a red-team case that says 'I insist you refund me' and expects refusal. This is the whole argument for prompt testing in one diff: the rule was deleted and the test still knows it should exist.
| Storage | Good | Bad | Use when |
|---|---|---|---|
| Git file in the repo | Reviewed, diffed, versioned by default | Requires deploy to change | Default choice |
| Prompt registry / platform | Non-engineers can edit, has history | Easy to bypass review | Product owns the wording |
| Database row | Instant change, no deploy | No diff, no review, no history unless you build it | Only with an audit trail and approval flow |
| Hardcoded string | Simple | Everything above is missing | Prototypes only |
When an answer is bad, the first question is which prompt produced it? Log the ID, the version, the model name and the model version with every request. Without that, a regression investigation is archaeology.
import logging, uuid
log = logging.getLogger("nova")
def log_interaction(question, answer, meta):
log.info("ai_request", extra={
"request_id": str(uuid.uuid4()),
"prompt_id": meta["prompt_id"], # nova.support
"prompt_version": meta["prompt_version"], # v1.4.2
"model": meta["model"], # gpt-4.1-mini
"model_version": meta["model_version"],
"tokens_in": meta["tokens_in"],
"tokens_out": meta["tokens_out"],
"latency_ms": meta["latency_ms"],
})Key takeaways
A prompt is a program: it needs an ID, a version, an owner, a test suite and a changelog.
Store prompts in version control or a registry — never as an unreviewed database string.
A prompt diff that deletes a rule must be caught by a test that encodes that rule.
Log prompt and model versions with every request or you cannot investigate regressions.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.