concept

Prompt template

A prompt template is a parameterised prompt — a string with named slots (e.g. {{name}}, {{context}}) that get filled at runtime so the same skeleton can serve many requests.

Prompt templates separate the static prompt skeleton (instructions, examples, tags) from the per-request variables (user input, retrieved documents, current date). Modern frameworks (LangChain ChatPromptTemplate, Jinja-style prompts, PromptLayer, Braintrust) standardise the format. Templates enable prompt versioning, A/B testing, and centralised prompt registries. The simplest template is f-string interpolation; the most sophisticated supports conditional sections, looped few-shot, and validated variables. Treating prompts as templates is the gateway to treating prompts as code.

When to use prompt template

Common mistakes

FAQ

What is prompt template?

A prompt template is a parameterised prompt — a string with named slots (e.g. {{name}}, {{context}}) that get filled at runtime so the same skeleton can serve many requests.

When should I use prompt template?

Any production LLM feature with variable input. Multi-tenant or multi-language prompts. Centralised prompt registry + versioning.

What are the most common mistakes with prompt template?

Hard-coding inline strings everywhere instead of using a template. Letting untrusted user input land directly inside the template without escaping.

Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/prompt-template.md.