When to use it
Use this prompt when a prompt works well in your own chat and you want to share it with a team, store it in a prompt library, or call it from code. Ad hoc prompts often depend on context you typed earlier or details you fixed by hand; a template makes those dependencies explicit.
It is worth doing for any prompt you expect to use more than a handful of times, or that someone else will run without you there to fix the output. A one-off question does not need a template.
How to customize it
- [ORIGINAL PROMPT] should be the version that produced good results, plus any follow-up corrections you had to make.
- [WHAT IT IS FOR] helps the model decide which rules are essential.
- [WHO WILL FILL IT IN] changes the design: people need clear instructions and defaults, code needs strict types and machine-readable output.
- [INPUTS THAT VARY] become the variables. Everything else should stay fixed.
- [WHERE THE OUTPUT GOES] decides how strict the output contract must be.
Why it works
Separating fixed instructions from variable inputs, and wrapping inputs in delimiters, makes the prompt easier to maintain and harder to hijack. Telling the model that input sections are data is a basic defence against prompt injection, although no wording stops every attack, so the third test case checks it.
The variable table documents behavior for missing values, which is where templates usually break in practice. An explicit output contract with an example lets downstream code or colleagues rely on the result, and the test cases give you a quick regression check whenever the template changes.
Tips and variations
- Keep templates in version control and note which model and settings they were tested with.
- Run the test cases on every model you plan to use; behavior differs between models and versions.
- For JSON output, read our guide to structured outputs.
- Harden it further with the edge-case stress test prompt.
- See the prompting patterns cheat sheet for structures that work well inside templates.