25.1 A prompt is code: versioned, reviewed and tested
- Approved by
- Panaversity ·
In everyday life. A bakery bakes its bread from a recipe card on the wall. One morning the baker thinks the bread needs less salt, and changes the card with a pen. Nobody tastes the new bread before the shop opens. By noon, forty customers have bought a loaf that no one tried. A careful bakery writes a new card with a date on it, bakes one tray, and has someone taste it. Only then does the new card go on the wall. The old card goes in a drawer, in case the new bread is worse. In this concept, the card is the prompt, the tasting is the suite, and the drawer is the old version.
What you will learn. You practice this in Lab 25, Tasks 1 and 2, where one changed line reaches production only through a pull request.
- Why does a prompt change the way code changes?
- What do versioned, reviewed and tested mean for one file?
- Where else can a prompt live, and what does each home cost?
Why it matters. A changed prompt changes every answer, and nobody reads every answer.
At work. Monday, April 19, 2027. INV-8340 is in the morning report, and the builder already knows which file to change: the extraction prompt. The fast way is to open the file on the server, add a line and save. That is also how the builder tested on Friday: one invoice, one answer, one person reading. But tomorrow at 7:10 the new words will read every new invoice, with nobody reading the answers. So who reads the results of a changed prompt? Not the builder. The suite does, and a suite can only test something that does not change.
Why does a prompt change the way code changes?
Because the reader of its results is now a suite, and not a person. When a person read each answer, the same person read again after each change. Chapter 5 taught that habit: "Read the result as a test, and change only the part that failed". Nobody reads a thousand invoices again. Chapter 24's suite does it for you: it runs every case at each change and compares each answer with Ana's label.
That gives a prompt the same three needs as code. The suite must know which words it tested, so the prompt needs a version. A person must see what changed, so the change needs a review. And the change must not reach the 7:10 run until the cases pass, so it needs a test.
Chapter 24 showed this work, ten days earlier in the story. On Friday, April 9, a pull request shortened the worker's prompt. The suite ran, one answer was marked incorrect, and the change did not merge until the cut line was put back. No customer and no morning report ever saw the broken prompt.
What do versioned, reviewed and tested mean for one file?
Each word is one thing you do to the file. In 21.13 the prompt was pinned as "A file with a version in its name, prompts/ap-worker.v1.md, reviewed like code". This concept adds the third word, tested.
| The word | What you do | What it gives you |
|---|---|---|
| Versioned | Copy the file to a new name, prompts/ap-worker.v2.md, and change the copy. One line in the code names the version it loads | Every answer can be traced to the exact words that produced it. Going back is a change to one line |
| Reviewed | Open a pull request. The reviewer compares v1 with v2 and sees only what changed. Where the changed words state an AP rule, Ana reads them | A second reader for the words, before any invoice meets them |
| Tested | The suite runs on the pull request. Checks by code run on every pull request, and the judge runs when the worker's prompt, the model or the golden set changes | Every case read again, with no person reading |
The extraction prompt is kept the same way, as its own file in prompts/. Keep each prompt in one file, and let code fill in the parts that differ from run to run, such as the invoice. And never edit a version that has shipped, which means it has reached production. A file that changes under its name is no longer a version.
Where else can a prompt live, and what does each home cost?
In the repository, the price is speed. A one-word change needs a new file, a pull request and a suite run, and a live suite run costs money. That price is fair for any prompt whose answers nobody reads.
On a server, the price is the review. Some teams keep prompts in a registry, a service that stores each prompt by version. A prompt update can then go live without a deployment of the code.1 A hosted agent works this way too. Claude's Managed Agents is Anthropic's service that runs a worker for you (Chapter 23). There, each update to an agent makes a new version that cannot be changed. One run, called a session, chooses its version by id.2 Anthropic's own worked example names the cost: "There's no built-in approval workflow on agents.update. Any key in the workspace can call it." Its answer is that production callers always pin an explicit version, and that pinned number is the thing under change control.2 That is why 23.4 kept the worker's definition as a file and applied it with a plan.
OpenAI has moved the same way. Its reusable prompt objects, the v1/prompts API, are scheduled to shut down on November 30, 2026. Its guide says: "Store production prompts in your application code instead of creating reusable prompt objects."34
Whichever home you choose, two things stay yours: a version that never changes under its name, and a test that runs before the version is used.
The operating rule: a prompt reaches production only as a named version that the suite has read.
Do this now. Ask your coding agent to find every prompt your project sends. Copy this line:
List every prompt this project sends to a model. For each one, name the file that holds it, the place where its version is set, and the test that would fail if I changed one word of it. Change no file.
A prompt with no file, no version or no test is one that only a person is reading.
Check yourself
Question 1 / 7
0 answered
Why does a prompt now change the way code changes?
Sources
- Owner
- Panaversity