TokenPad

Prompting

Prompt template

A prompt template is a prompt with placeholders, filled with real values at request time.

It is how prompts get versioned, tested and reused rather than being scattered through code as string concatenation.

The failure it introduces is silent: an unfilled placeholder does not error. The model receives the literal text and does its best, usually by inventing something.

In practice

Templates are program logic, so they belong in version control and under review. Editing prompts in a dashboard means production behaviour changes with no diff, no reviewer and no way back. The related discipline: keep the variable parts at the end, because anything dynamic near the top destroys prompt caching for everything after it.

Common questions

Where should prompt templates live?

In version control, alongside the code, reviewed like code. Editing prompts in a dashboard means production behaviour changes with no diff, no reviewer and no way back.

Where do variables go in a template?

At the end. Anything dynamic near the top invalidates prompt caching for everything after it, which can turn a cheap cached read into a full-price request on every call.

Measure it

More in Prompting