# Prompt Template

> A prompt template is a parameterized prompt — fixed instructions with variable slots — turning prompts from strings into versioned, testable components.

**A prompt template is a reusable prompt with variable slots — fixed instructions, dynamic inputs (`{question}`, `{context}`, `{examples}`) — the unit that turns prompting from string-building into software engineering.**

Its value is everything that becomes possible once a prompt is an *artifact*: version it (and know which version produced a regression), test it ([eval suites](/guides/evaluation/write-llm-evals) run against template versions, catching the regression before users do), review it in PRs, and manage it — platforms like [Langfuse and LangSmith](/guides/comparisons/langfuse-vs-langsmith) ship prompt registries with versioning and deployment precisely because templates are the unit teams iterate on. In code, every serious framework treats templates as first-class, from simple f-string-style substitution to structured message builders.

One slot deserves special respect: **untrusted input**. A template makes the boundary between instructions and data explicit — which is the first, structural defense against [prompt injection](/glossary/prompt-injection): quote user and fetched content into clearly-delimited data slots, never splice it into instruction position. Combined with the [patterns](/guides/prompting/prompt-patterns) for what goes *in* the template — role, rules, [few-shot examples](/glossary/few-shot-prompting), output contracts — templates are where prompt craft becomes maintainable.

---

_Source: https://agentscamp.com/glossary/prompt-template — Term on AgentsCamp._
