TL;DR - Building Reusable Prompt Templates
Stop rewriting prompts from scratch. This guide teaches you to build a personal prompt library with templates that save hours of work while ensuring consistent, high-quality outputs. For foundational prompting skills, see the Prompt Engineering Fundamentals guide.
What you’ll learn:
- Template Structure — How to design prompts with variables
- Variable Types — Different placeholder patterns and when to use each
- Conditional Logic — Prompts that adapt to different contexts
- Modular Components — Reusable building blocks for faster prompt creation
- Library Organization — How to organize and manage your templates
- Complete Examples — Ready-to-use template patterns
The 5-minute rule: If you’ll use a prompt more than 3 times, spend 5 minutes making it a template. You’ll save hours over time.
Why Prompt Templates?
| Without Templates | With Templates |
|---|---|
| Write prompts from scratch each time | Fill in proven templates |
| Inconsistent quality | Reliable, consistent outputs |
| Forget effective techniques | Best practices encoded in template |
| Time wasted on structure | Focus on content, not format |
| Tribal knowledge in heads | Documented, shareable library |
Real impact: A team using prompt templates can reduce prompt creation time by 80% while improving output consistency.
For more on AI-powered productivity, see the AI for Everyday Productivity guide.
Template Structure Fundamentals
Basic Template Anatomy
Every prompt template has three elements:
===========================================
TEMPLATE: [Template Name]
===========================================
# STATIC CONTENT
Parts that never change - the proven structure.
# VARIABLES
Placeholders you fill in for each use.
Marked with clear syntax: {{VARIABLE_NAME}}
# INSTRUCTIONS
How the AI should process and respond.
Variable Syntax Options
Choose one syntax and use it consistently:
OPTION 1: Double Curly Braces (Recommended)
{{VARIABLE_NAME}}
- Most common in templating systems
- Clearly distinct from regular text
- Example: "Write a {{CONTENT_TYPE}} about {{TOPIC}}"
OPTION 2: Square Brackets
[VARIABLE_NAME]
- Simple and clear
- Common in documentation
- Example: "Write a [CONTENT_TYPE] about [TOPIC]"
OPTION 3: Angle Brackets
<VARIABLE_NAME>
- Used in XML-style templates
- Can conflict with code examples
- Example: "Write a <CONTENT_TYPE> about <TOPIC>"
OPTION 4: Comments with REPLACE
# REPLACE: Description of what goes here
- More descriptive, self-documenting
- Takes more space
- Best for complex variables
Template Patterns
Pattern 1: Simple Substitution Template
The most basic pattern—just swap in your variables.
===========================================
TEMPLATE: Email Response
===========================================
VARIABLES:
- {{SENDER_NAME}}: Who sent the email
- {{EMAIL_SUBJECT}}: What the email was about
- {{KEY_POINTS}}: Main points to address
- {{TONE}}: professional / friendly / formal
- {{ACTION_NEEDED}}: What you want them to do next
---
PROMPT:
Write a {{TONE}} email response.
Original email from: {{SENDER_NAME}}
Subject: {{EMAIL_SUBJECT}}
Key points to address:
{{KEY_POINTS}}
Close with this call to action: {{ACTION_NEEDED}}
Keep it concise—under 150 words. Be helpful but direct.
===========================================
EXAMPLE USE:
Write a friendly email response.
Original email from: Sarah Chen
Subject: Q4 Budget Review Meeting
Key points to address:
- Confirm I can attend Tuesday at 2pm
- Ask if she needs any prep materials from me
- Mention I'll bring the forecast spreadsheet
Close with this call to action: Ask her to send the agenda beforehand.
Keep it concise—under 150 words. Be helpful but direct.
Pattern 2: Role + Context + Task Template
A structured pattern for more complex requests.
===========================================
TEMPLATE: Expert Analysis
===========================================
VARIABLES:
- {{EXPERT_ROLE}}: What expert perspective to take
- {{CONTEXT}}: Background information
- {{SPECIFIC_TASK}}: What you want analyzed/done
- {{OUTPUT_FORMAT}}: How to structure the response
- {{CONSTRAINTS}}: Any limitations or requirements
---
PROMPT:
# ROLE
You are a {{EXPERT_ROLE}} with deep expertise in this domain.
# CONTEXT
{{CONTEXT}}
# TASK
{{SPECIFIC_TASK}}
# OUTPUT FORMAT
{{OUTPUT_FORMAT}}
# CONSTRAINTS
{{CONSTRAINTS}}
===========================================
EXAMPLE USE:
# ROLE
You are a senior product manager with deep expertise in this domain.
# CONTEXT
We're a B2B SaaS company with 500 customers. Our main competitor
just launched a feature that 40% of our customers have requested.
We have limited engineering capacity (2 developers) for Q1.
# TASK
Analyze whether we should build this feature now or delay.
Consider competitive pressure, customer retention, and resource constraints.
# OUTPUT FORMAT
- Executive summary (2-3 sentences)
- Recommendation (build/delay/alternative)
- Key factors table (factor, weight, analysis)
- Risks of each option
- Suggested timeline if building
# CONSTRAINTS
- Decision needed by Friday
- Cannot hire more engineers before Q2
- Feature must integrate with existing architecture
Pattern 3: Conditional Template
Templates that adapt based on context.
===========================================
TEMPLATE: Content Creation (Adaptive)
===========================================
VARIABLES:
- {{CONTENT_TYPE}}: blog post / email / social post / documentation
- {{TOPIC}}: What the content is about
- {{AUDIENCE}}: Who will read this
- {{GOAL}}: What you want readers to do/feel
- {{TONE}}: professional / casual / authoritative / friendly
- {{LENGTH}}: short (<300 words) / medium (300-800) / long (800+)
CONDITIONAL SECTIONS:
- IF blog post → include SEO elements
- IF social post → include hashtag suggestions
- IF documentation → include code examples section
- IF email → include subject line options
---
PROMPT:
Create a {{CONTENT_TYPE}} about {{TOPIC}}.
**Audience:** {{AUDIENCE}}
**Goal:** {{GOAL}}
**Tone:** {{TONE}}
**Length:** {{LENGTH}}
[IF {{CONTENT_TYPE}} = blog post]
Include:
- SEO-optimized title (include primary keyword)
- Meta description (under 160 characters)
- Headers structured for scanning
- Internal link suggestions
[END IF]
[IF {{CONTENT_TYPE}} = social post]
Include:
- 3 hashtag options
- Emoji suggestions
- Best posting time recommendation
- Alternative shorter version
[END IF]
[IF {{CONTENT_TYPE}} = documentation]
Include:
- Overview section
- Prerequisites
- Step-by-step instructions
- Code examples where relevant
- Troubleshooting section
[END IF]
[IF {{CONTENT_TYPE}} = email]
Include:
- 3 subject line options
- Preview text
- Clear call-to-action
[END IF]
===========================================
Pattern 4: Multi-Variant Template
Generate multiple versions for testing or options.
===========================================
TEMPLATE: Headline Variants
===========================================
VARIABLES:
- {{PRODUCT}}: What you're writing headlines for
- {{BENEFIT}}: Primary benefit/value proposition
- {{AUDIENCE}}: Target reader
- {{STYLE_1}}: First style (e.g., "question-based")
- {{STYLE_2}}: Second style (e.g., "benefit-led")
- {{STYLE_3}}: Third style (e.g., "curiosity-driven")
---
PROMPT:
Generate 3 headline variants for {{PRODUCT}}.
**Primary benefit:** {{BENEFIT}}
**Target audience:** {{AUDIENCE}}
Create one headline in each style:
**Style 1 - {{STYLE_1}}:**
[Generate headline]
Why it works: [Brief explanation]
**Style 2 - {{STYLE_2}}:**
[Generate headline]
Why it works: [Brief explanation]
**Style 3 - {{STYLE_3}}:**
[Generate headline]
Why it works: [Brief explanation]
**Recommendation:**
Which headline would work best and why.
===========================================
EXAMPLE USE:
Generate 3 headline variants for our project management app.
**Primary benefit:** Ship projects 2x faster
**Target audience:** Engineering managers at startups
Create one headline in each style:
**Style 1 - question-based:**
[Generate headline]
Why it works: [Brief explanation]
**Style 2 - benefit-led:**
[Generate headline]
Why it works: [Brief explanation]
**Style 3 - curiosity-driven:**
[Generate headline]
Why it works: [Brief explanation]
**Recommendation:**
Which headline would work best and why.
Pattern 5: Chained Template
Templates that flow into each other for multi-step workflows. For more on automated AI workflows, see the AI-Powered Workflows guide.
===========================================
TEMPLATE CHAIN: Content Workflow
===========================================
This chain creates content through multiple steps.
Output from each step feeds into the next.
---
STEP 1: Research & Outline
---
VARIABLES:
- {{TOPIC}}: Content topic
- {{AUDIENCE}}: Target readers
- {{CONTENT_GOAL}}: What you want to achieve
PROMPT:
Research and create an outline for content about {{TOPIC}}.
**Audience:** {{AUDIENCE}}
**Goal:** {{CONTENT_GOAL}}
Provide:
1. Key points to cover (5-7)
2. Questions the audience has about this topic
3. Suggested structure (sections and subsections)
4. Hook ideas for opening
5. Sources/data to reference
OUTPUT → Save as {{OUTLINE}}
---
STEP 2: First Draft
---
VARIABLES:
- {{OUTLINE}}: [Output from Step 1]
- {{TONE}}: Writing tone
- {{LENGTH}}: Target word count
PROMPT:
Write a first draft based on this outline:
{{OUTLINE}}
**Tone:** {{TONE}}
**Length:** {{LENGTH}} words
Write the full draft following the structure provided.
Include placeholders [ADD STAT] where data/statistics should go.
Include placeholders [ADD EXAMPLE] where examples would strengthen points.
OUTPUT → Save as {{DRAFT}}
---
STEP 3: Edit & Polish
---
VARIABLES:
- {{DRAFT}}: [Output from Step 2]
- {{STYLE_GUIDE}}: Any style requirements
PROMPT:
Edit and polish this draft:
{{DRAFT}}
**Style requirements:** {{STYLE_GUIDE}}
1. Improve clarity and flow
2. Strengthen weak sentences
3. Add transitions between sections
4. Tighten wordy passages
5. Ensure consistent tone throughout
6. Flag any gaps or weak arguments
Provide:
- Edited version
- Summary of major changes
- Remaining placeholders to fill
===========================================
Modular Components Library
Build prompts faster by combining these reusable modules.
Tone Modules
===========================================
TONE MODULE: Professional
===========================================
Use clear, business-appropriate language. Be direct but courteous.
Avoid slang, excessive enthusiasm, or overly casual expressions.
Write as a knowledgeable colleague, not a friend.
===========================================
TONE MODULE: Friendly
===========================================
Be warm and approachable. Use conversational language.
It's okay to use contractions and light humor where appropriate.
Write as a helpful friend who happens to be an expert.
===========================================
TONE MODULE: Technical
===========================================
Be precise and use accurate domain terminology.
Assume the reader has technical background.
Include specific details, code examples, and technical rationale.
Prioritize accuracy over accessibility.
===========================================
TONE MODULE: Executive
===========================================
Lead with the bottom line. Be extremely concise.
Focus on impact, decisions, and actions needed.
Quantify when possible. No fluff, no padding.
Assume reader has 30 seconds to get the key point.
===========================================
TONE MODULE: Empathetic
===========================================
Acknowledge emotions and challenges first.
Use supportive language. Validate concerns.
Be gentle with criticism. Focus on improvement, not blame.
Write as a supportive mentor or coach.
Output Format Modules
===========================================
FORMAT MODULE: Executive Summary
===========================================
Structure:
1. Bottom line (1 sentence)
2. Key points (3-5 bullets)
3. Recommendation (1-2 sentences)
4. Next steps (numbered list)
Total length: Under 200 words.
===========================================
FORMAT MODULE: Detailed Analysis
===========================================
Structure:
1. Executive summary (50 words)
2. Background/Context
3. Analysis (with sections)
4. Findings (bullet points)
5. Recommendations (prioritized)
6. Appendix (supporting detail)
Total length: 500-1000 words.
===========================================
FORMAT MODULE: Step-by-Step Guide
===========================================
Structure:
1. Overview (what and why)
2. Prerequisites (what you need)
3. Steps (numbered, with sub-steps if needed)
4. Verification (how to check it worked)
5. Troubleshooting (common issues)
Each step: Action verb start, expected outcome, tips.
===========================================
FORMAT MODULE: Comparison
===========================================
Structure:
1. Quick recommendation (1 sentence)
2. Comparison table
| Criteria | Option A | Option B | Winner |
3. Detailed analysis per option
4. Trade-offs discussion
5. Recommendation with context
===========================================
FORMAT MODULE: Quick Response
===========================================
Answer directly in 1-3 sentences.
Only elaborate if asked.
Offer to expand: "Want me to go deeper on any part?"
Guardrail Modules
===========================================
GUARDRAIL MODULE: Accuracy
===========================================
- If uncertain, say so explicitly
- Distinguish facts from opinions
- Cite sources or note when information may be outdated
- Don't make up specific numbers, dates, or quotes
===========================================
GUARDRAIL MODULE: Scope
===========================================
- Stay focused on the requested topic
- If question ventures outside scope, redirect:
"That's outside this scope. What I can help with is..."
- Don't provide advice in domains requiring licensed professionals
(medical, legal, financial advice)
===========================================
GUARDRAIL MODULE: Safety
===========================================
- Do not provide harmful, dangerous, or illegal guidance
- Do not generate content that could harm individuals
- If request is concerning, redirect or decline
- Err on the side of caution
===========================================
GUARDRAIL MODULE: Quality
===========================================
- Before responding, verify the response:
- Addresses the actual question
- Is complete (nothing missing)
- Is accurate (facts are correct)
- Is clear (reader will understand)
- If quality can't be met, explain limitations
For more on AI safety and responsible AI use, see the [Understanding AI Safety, Ethics, and Limitations guide](/tech-articles/understanding-ai-safety/).
Context Gathering Modules
===========================================
CONTEXT MODULE: Audience Analysis
===========================================
Before creating content, establish:
- Who is the reader?
- What do they already know?
- What do they need to learn/do?
- What's their level of expertise?
- What outcome do they want?
If not provided, ask before proceeding.
===========================================
CONTEXT MODULE: Goal Clarification
===========================================
Before proceeding, confirm:
- What does success look like?
- What's the primary goal? Secondary goals?
- What decisions will be made from this?
- What action should result?
If unclear, ask for clarification.
===========================================
CONTEXT MODULE: Requirements Check
===========================================
Verify requirements are complete:
- [ ] Purpose/goal is clear
- [ ] Audience is defined
- [ ] Constraints are known (length, format, deadline)
- [ ] Quality criteria are specified
- [ ] Examples of good output exist
List any missing requirements before proceeding.
Organizing Your Prompt Library
Recommended Structure
PROMPT LIBRARY/
├── By Role/
│ ├── Developer prompts
│ ├── PM prompts
│ ├── Writer prompts
│ └── ...
├── By Task/
│ ├── Email templates
│ ├── Analysis templates
│ ├── Content templates
│ └── ...
├── By Workflow/
│ ├── Code review chain
│ ├── Content creation chain
│ └── ...
└── Components/
├── Tone modules
├── Format modules
└── Guardrail modules
Template Documentation Standard
===========================================
TEMPLATE METADATA
===========================================
Name: [Template Name]
Category: [Category]
Created: [Date]
Version: [X.Y]
Author: [Name]
PURPOSE:
What is this template for?
WHEN TO USE:
- [Scenario 1]
- [Scenario 2]
WHEN NOT TO USE:
- [Scenario to avoid]
VARIABLES:
| Variable | Type | Required | Description | Example |
| {{VAR}} | text | Yes | What it is | Example value |
EXAMPLE INPUT:
[Complete example with all variables filled]
EXAMPLE OUTPUT:
[What good output looks like]
TIPS:
- [Tip 1]
- [Tip 2]
CHANGELOG:
v1.1 - [Date] - [What changed]
v1.0 - [Date] - Initial version
Complete Template Examples
Template: Meeting Notes Processor
===========================================
TEMPLATE: Meeting Notes Processor
Version: 1.0
===========================================
PURPOSE: Transform messy meeting notes into structured summary.
VARIABLES:
- {{MEETING_TITLE}}: Name/purpose of the meeting
- {{ATTENDEES}}: Who was present
- {{RAW_NOTES}}: Your messy notes (paste as-is)
- {{PRIORITY_TOPICS}}: (optional) Topics to emphasize
- {{ACTION_OWNER_DEFAULT}}: (optional) Default person for unassigned actions
---
Transform these meeting notes into a structured summary.
**Meeting:** {{MEETING_TITLE}}
**Attendees:** {{ATTENDEES}}
**Raw Notes:**
{{RAW_NOTES}}
[IF {{PRIORITY_TOPICS}} is provided]
**Prioritize these topics:** {{PRIORITY_TOPICS}}
[END IF]
[IF {{ACTION_OWNER_DEFAULT}} is provided]
**Default action owner:** {{ACTION_OWNER_DEFAULT}}
[END IF]
**Output Format:**
# Meeting Summary: {{MEETING_TITLE}}
**Date:** [Extract or note as "not specified"]
**Attendees:** {{ATTENDEES}}
## TL;DR
[2-3 sentence summary of key outcomes]
## Decisions Made
| # | Decision | Context |
| 1 | | |
## Action Items
| # | Action | Owner | Due |
| 1 | | | |
## Discussion Points
### [Topic 1]
- Key points discussed
- Outcome/conclusion
### [Topic 2]
[Continue for each topic]
## Parking Lot
- Items to discuss later
## Next Meeting
- [If scheduled/mentioned]
---
EXAMPLE USE:
**Meeting:** Sprint 24 Planning
**Attendees:** Sarah (PM), Mike (Tech Lead), Lisa (Design), James (QA)
**Raw Notes:**
discussed what to include in sprint 24
sarah wants user auth done - high priority
mike says 2 weeks for auth, team should be able to handle it
lisa showed new designs for dashboard - team liked option B
need to decide on API versioning approach - tabled for next week
James concerned about test coverage - wants 80% minimum
ACTION mike to spike API options by friday
ACTION lisa finalize dashboard designs
sprint starts monday, planning to hit auth and dashboard
might need to cut analytics if blocked
retro on the 15th
Template: Code Review Request
===========================================
TEMPLATE: Code Review Request
Version: 1.0
===========================================
PURPOSE: Structured code review with specific focus areas.
VARIABLES:
- {{LANGUAGE}}: Programming language
- {{CONTEXT}}: What this code does
- {{FOCUS_AREAS}}: What to focus review on
- {{CONSTRAINTS}}: Performance/security/style requirements
- {{CODE}}: The code to review
---
Review this {{LANGUAGE}} code.
**Context:**
{{CONTEXT}}
**Focus Areas:**
{{FOCUS_AREAS}}
**Constraints/Requirements:**
{{CONSTRAINTS}}
**Code:**
{{CODE}}
**Review Format:**
## Summary
[1-2 sentence overall assessment]
## Issues Found
| Severity | Location | Issue | Suggestion |
| High/Med/Low | Line X | What's wrong | How to fix |
## Code Quality
- Readability: [1-5 rating with notes]
- Maintainability: [1-5 rating with notes]
- Performance: [1-5 rating with notes]
## Positive Observations
- [What's done well]
## Recommended Changes
Priority order:
1. [Change 1]
2. [Change 2]
## Questions for Author
- [Anything you'd ask them to clarify]
---
EXAMPLE USE:
Review this Python code.
**Context:**
This function processes user uploads and stores them in S3.
Part of our file management service, called ~1000 times/day.
**Focus Areas:**
- Error handling
- Security (user input handling)
- Performance for larger files
**Constraints/Requirements:**
- Max file size 100MB
- Must handle graceful failures
- PEP 8 compliant
**Code:**
def process_upload(file, user_id):
filename = file.filename
s3.upload_file(file, "bucket", filename)
return {"status": "ok", "filename": filename}
Template: Decision Document
===========================================
TEMPLATE: Decision Document
Version: 1.0
===========================================
PURPOSE: Document a decision with reasoning and alternatives.
VARIABLES:
- {{DECISION_TITLE}}: What decision was made
- {{DECISION_MAKER}}: Who made/will make the decision
- {{CONTEXT}}: Background and why decision is needed
- {{OPTIONS}}: Options that were considered
- {{CRITERIA}}: How options were evaluated
- {{CHOSEN_OPTION}}: What was decided
- {{RATIONALE}}: Why this option was chosen
---
Create a decision document.
**Decision:** {{DECISION_TITLE}}
**Decision Maker:** {{DECISION_MAKER}}
**Context:**
{{CONTEXT}}
**Options Considered:**
{{OPTIONS}}
**Evaluation Criteria:**
{{CRITERIA}}
**Chosen Option:**
{{CHOSEN_OPTION}}
**Rationale:**
{{RATIONALE}}
**Output Format:**
# Decision: {{DECISION_TITLE}}
**Status:** [Decided / Pending / Superseded]
**Date:** [Date]
**Decision Maker:** {{DECISION_MAKER}}
## Context
[Expanded background]
## Decision
[Clear statement of what was decided]
## Options Considered
| Option | Description | Pros | Cons |
| A | | | |
| B | | | |
## Evaluation
| Criteria | Weight | Option A | Option B |
## Rationale
[Why the chosen option was selected]
## Implications
- [What changes as a result]
- [What teams are affected]
- [Dependencies or prerequisites]
## Review Triggers
- Revisit this decision if: [conditions]
## Related Decisions
- [Links to related decisions]
Quick Reference
| Pattern | Use When |
|---|---|
| Simple Substitution | Basic templates with swappable values |
| Role + Context + Task | Complex requests needing structure |
| Conditional | Different scenarios need different prompts |
| Multi-Variant | Need multiple options to compare |
| Chained | Multi-step workflows with dependencies |
| Module Type | Purpose |
|---|---|
| Tone | Control voice and style |
| Format | Structure the output |
| Guardrails | Set boundaries and safety |
| Context | Gather required information |
Tips for Effective Templates
1. Start from Successes
When a prompt works well: Turn it into a template immediately.
Identify what made it work and make those elements permanent.
2. Name Variables Clearly
❌ {{X}}, {{INPUT}}, {{THING}}
✅ {{PRODUCT_NAME}}, {{TARGET_AUDIENCE}}, {{WORD_COUNT}}
3. Provide Examples
Every variable should have an example value.
"{{TONE}}: e.g., 'professional but approachable, like a helpful colleague'"
4. Include Anti-Examples
Show what NOT to output:
"Don't start with 'I'd be happy to...' or excessive pleasantries."
5. Document When to Use
WHEN TO USE:
- Writing customer-facing emails
- Responding to support tickets
WHEN NOT TO USE:
- Internal quick messages
- Automated notifications
6. Version and Iterate
v1.0 - Initial template
v1.1 - Added example outputs after confusion
v1.2 - Shortened format after feedback outputs were too long
7. Test with Edge Cases
Before sharing a template, test with:
- Minimal input (just required fields)
- Maximum input (all optional fields filled)
- Unusual input (edge cases)
What’s Next
- 📚 Mega-Prompt Engineering — Build complete AI assistants
- 📚 Prompt Engineering Fundamentals — Master the basics
- 📚 AI Prompts for Developers — Ready-to-use coding templates
- 🛠️ PRD Generator — See templates in action
Found this guide helpful? Share it with your team and start building your prompt library!