Prompts as code
Keep every prompt in a versioned file and user text apart from instructions. No prompt change ships without review and a passing eval run.
- Required 3
- Recommended 5
Required
Keep user text out of the instructions
AIF-7Put user input and retrieved documents in their own message or a clearly marked block. Never paste them into the system instructions.
Pin the AI model version you depend on
AIF-59Call an AI model by its exact, fixed version, never by a moving alias. Change the version only after its tests pass.
Track the retirement date of every model you call
AIF-75Keep one list of every model version your code calls, with its provider's retirement date. Alert the owner 90 days before a date, and finish the move with a full eval run before it.
Recommended
Keep prompts in files
AIF-6Store every prompt as a template file in version control, one file per prompt, with an ID and a version. Never build prompts from strings scattered through the code.
Review and test every prompt change
AIF-8Treat a prompt change like a code change. It goes through review, and the feature's eval set must pass before it merges.
Log which prompt made each answer
AIF-9Record the prompt ID, prompt version and exact model version with every model call and every stored AI output.
Show the model worked examples
AIF-10Include three to five worked examples of input and the expected output in prompts where format or tone matters. Keep them in the prompt file and out of the eval set.
Keep generation settings in the prompt file
AIF-11Store the output limit and the generation settings, such as temperature or reasoning effort, in the prompt file's front matter. Raise the prompt version when any of them changes.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/prompts-as-code">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.