Version Your Prompts
A prompt is code. Code needs versioning. Track what changed and why, so you can roll back when a prompt regresses.
Prompts are a form of source code. They have logic, structure, and behavior. They should be treated with the same discipline as any other code: version control, review, tests, and rollback.
A small change to a prompt can have a large effect on output quality. Without versioning:
- You cannot tell what changed when output degrades.
- Team members reuse old prompts unknowingly.
- You lose good prompts when someone overwrites them.
- You cannot A/B test phrasings.
- Rollbacks are manual and error-prone.
- Keep prompts in your repo. A
prompts/directory is enough to start. - Name by purpose and version.
extract-entities-v1.txt,extract-entities-v2.txt. - Commit changes with context. "Updated extraction prompt to handle nested lists."
- Run regression tests. Keep a small set of inputs and expected outputs.
- Archive, do not delete. Old prompts teach you what not to do.
- The prompt text itself
- The model and parameters it was tuned for
- A one-line description of its purpose
- Known limitations or failure modes
- A few example inputs/outputs if space allows
prompts/
summarize-long-form-v1.prompt
summarize-long-form-v2.prompt
extract-action-items-v1.prompt
classify-support-ticket-v3.prompt
For critical prompts, create a test file with 5–10 representative inputs. After any prompt change, run the same inputs and compare outputs. Flag differences for human review.
This does not have to be automated at first. A manual diff is already better than nothing.
Move your most important production prompt into version control today. Commit it with a clear message. Future-you will thank present-you.