What is a prompt template?
A prompt template is a prompt written once with named placeholders, which an application fills in for each request. The fixed parts hold the instructions, the output format, and any worked examples. The placeholders receive the variable parts: the user’s question, the retrieved passages, the customer record, or the current date. The result is that a thousand requests are built in exactly the same shape, and a change to the instructions happens in one place.
Templates are the bridge between prompt engineering and software. A developer can store them in version control, test them with sample inputs, and swap them without touching application code. Most AI agent frameworks treat templates as first-class objects for this reason.
Prompt templates in practice
A trucking company emails customers whenever a shipment is delayed. The template contains the instructions (“write a two-paragraph delay notice in a plain, apologetic tone”), two example notices the dispatch manager approved, and placeholders for the customer name, shipment number, original and revised delivery dates, and the reason code description. Dispatch software fills the placeholders from the transport management system. The manager later changed the tone across all notices by editing one example.
What to watch for
- Delimit inserted content clearly, because text pulled from a record or a document can contain instructions the model will follow.
- Validate that every placeholder was filled, since a template sent with an empty field produces a confident answer about nothing.
- Version templates and record which version produced each output for later review.