Why Templates?
In a real app the same prompt is used thousands of times with different data. A template has fixed text and placeholders for the changing parts.
Summarize the text below in 2 bullet points for a busy manager. | | Text: | Sales grew 10% in Q3 after the new campaign.
Version Your Prompts
- Give each prompt a name and a version such as
summary_v2 - Store prompts in files or a repository, not hidden in code
- Write down why you changed it
- Keep old versions so you can roll back
Write Simple Tests
You cannot test an LLM answer exactly, but you can test rules an answer must follow. Build a small set of inputs and check the output with simple functions.
Great product! -> OK | Terrible service -> OK | It is fine -> OK
In real use, replace fake_model with your API call and run the tests each time you change a prompt. This is a regression test: it warns you when a change breaks something that used to work.
What to Check
| Check | Example |
|---|---|
| Format | Valid JSON, correct keys |
| Length | Under 50 words |
| Must include | Contains the order number |
| Must not include | No email addresses, no profanity |
| Quality | Compare with a reference answer or use a rubric |
Practice
- Make a template with three placeholders
- Write five test inputs and a check function
- Change the prompt and rerun the checks
Conclusion
Templates, versions and tests make prompts dependable parts of your software.

