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 4
- Recommended 1
Required
Keep prompts in files
RequiredStore 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.
Keep user text out of the instructions
RequiredPut user input and retrieved documents in their own message or a clearly marked block. Never paste them into the system instructions.
Review and test every prompt change
RequiredTreat 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
RequiredRecord the prompt ID, prompt version and exact model version with every model call and every stored AI output.
Recommended
Show the model worked examples
RecommendedInclude two 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.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers ai features playbook: https://agentwranglers.se/playbook/ai-features/prompts-as-code.