← Back to Dashboard
1. Prompt Contracts and Output Schemas2. Template Variables and Reuse
Template Variables and Reuse
📚 Prompt Engineering on Bedrock⏱ 9 min⭐ 70 XP⌨ Hands-on lab
Reusable Prompt Systems
Template-driven prompting improves consistency at scale. Separate static policy instructions from dynamic request context - the same separation of concerns you apply to code and configuration.
Template Structure That Scales
# template: ticket-triage v3.2
SYSTEM (static, versioned):
You are a support triage assistant for {{product_line}}.
Always output strict JSON: {"priority", "team", "reason"}.
Escalate security reports regardless of wording.
USER (dynamic, per request):
Ticket: {{ticket_text}}
Customer tier: {{tier}}
Recent related incidents: {{incident_context}}
What Goes Where
| Layer | Contents | Change cadence |
|---|---|---|
| Static template | Policy, persona, output schema, refusal rules | Versioned releases with regression tests |
| Typed variables | Ticket text, user tier, retrieved context | Every request |
| Environment config | Model ID, temperature, max tokens | Per environment (dev/stage/prod) |
Operational Rules
- Keep immutable system constraints in one template - never string-concatenate policy in scattered code paths.
- Inject context as typed variables and validate them before rendering (length limits, encoding, injection screening).
- Track template version and test score for each release - a template change is a deploy, not an edit.
- On Bedrock, Prompt Management can store, version, and A/B prompt variants as first-class resources.
Security note: template variables are an injection surface. Sanitise user-provided values (strip role markers, cap length) before they enter the rendered prompt - treat it like SQL parameterisation for LLMs.
⌨ HANDS-ON LABCreate a Prompt Template Matrix
⭐ +150 XPBuild repeatable prompt variants for support, compliance, and engineering triage tasks.
1Create a template file with placeholders.
2Generate a rendered prompt for one scenario.
OBJECTIVE 1 / 2 — type "hint" if stuck
🧪 Knowledge Check
Press 1-4 to select1 of 2
What is the primary benefit of prompt templates?
Random creativity
Repeatability across environments and teams
Lower IAM permissions
No monitoring required