Reusable Prompt Templates
Stop writing prompts from scratch every time. Build a library of battle-tested templates for your most common tasks.
Why Templates?
The best prompt engineers don't craft every prompt from scratch — they maintain a library:
Benefits:
- Consistent quality across team members
- No need to remember optimal phrasing each time
- Easy to improve — update the template, everyone benefits
- Onboarding — new team members get expert-level results immediately
Template structure:
[ROLE] → Who the AI should be
[CONTEXT] → Background information (fill in per use)
[TASK] → What to do
[CONSTRAINTS] → Rules and limitations
[FORMAT] → Expected output shape
[EXAMPLES] → Optional: sample input/output pairs
Store templates in your project's prompts/ directory, a shared wiki, or a tool like Prompt Flux.
Template: Code Review
You are a senior software engineer performing a code review.
## Code to Review:
{paste code here}
## Context:
- Language/framework: {e.g., TypeScript, React 18}
- Purpose of this code: {brief description}
- This is a: {new feature / bug fix / refactor}
## Review Criteria:
1. **Bugs** — logic errors, off-by-one, null handling
2. **Security** — injection, auth, data exposure
3. **Performance** — unnecessary loops, N+1 queries, memory leaks
4. **Readability** — naming, complexity, documentation
5. **Best practices** — framework conventions, patterns
## Output Format:
For each issue:
- 📍 Location (file:line if applicable)
- 🔴/🟡/🟢 Severity (Critical/Medium/Low)
- 📝 Description
- ✅ Suggested fix (with code if applicable)
End with a summary: overall quality score (1-10) and
top 3 action items.
This template consistently produces thorough, actionable code reviews.
Template: Technical Documentation
You are a technical writer creating documentation for developers.
## What to Document:
{paste function/API/component code here}
## Context:
- Project: {project name}
- Audience: {junior devs / senior devs / external API consumers}
- Documentation style: {JSDoc / README / API reference}
## Requirements:
1. Start with a one-sentence summary of what it does
2. Describe parameters with types and constraints
3. Document return values and possible errors
4. Include 2-3 usage examples (simple → advanced)
5. Note any gotchas, edge cases, or prerequisites
6. Use clear, concise language — no filler
## Output Format:
{Markdown / JSDoc / OpenAPI spec}
Pro tip: Feed the AI both the code AND existing docs. Ask it to update the docs to match the current code — it's excellent at finding discrepancies.
Template: Data Analysis
You are a data analyst examining a dataset.
## Dataset:
{paste sample data or describe the schema}
## Questions to Answer:
1. {specific question}
2. {specific question}
3. {specific question}
## Constraints:
- Use {Python pandas / SQL / Excel formulas}
- Handle missing values by {dropping / filling with mean / flagging}
- All monetary values are in {USD / EUR}
## Output:
1. Key findings (3-5 bullet points)
2. Code to reproduce the analysis
3. Suggested visualizations
4. Caveats and limitations of this analysis
Template: Email Drafting
Draft a professional email.
## Context:
- From: {your name and role}
- To: {recipient and their role}
- Relationship: {cold outreach / existing client / internal team}
- Purpose: {what you want to achieve}
## Key Points to Include:
1. {point 1}
2. {point 2}
3. {point 3}
## Tone: {formal / friendly-professional / casual}
## Length: {2-3 sentences / 1 paragraph / detailed}
## Call to Action: {what you want them to do}
## Constraints:
- Don't use buzzwords or jargon
- Be direct — get to the point in the first sentence
- Include a specific next step with a timeline
Variations: Create sub-templates for common email types — follow-up, cold outreach, status update, meeting request, feedback response.
Template: Bug Investigation
You are a senior developer debugging an issue.
## Error:
{paste exact error message and stack trace}
## Context:
- Application: {tech stack and versions}
- Environment: {local / staging / production}
- When it started: {recent deploy / always / intermittent}
- What changed recently: {deployments, config changes, data changes}
## What I've Already Tried:
1. {attempt 1 and result}
2. {attempt 2 and result}
## Relevant Code:
{paste the function or component where the error occurs}
## Task:
1. Identify the root cause (not just symptoms)
2. Explain WHY this error occurs
3. Provide a fix with code
4. Suggest how to prevent this class of bug in the future
Including what you've already tried prevents the AI from suggesting solutions you've already ruled out.
Building Your Template Library
Start with these 5 categories and expand:
| Category | Templates |
|---|---|
| Code | Review, refactor, test generation, documentation |
| Communication | Email, Slack message, meeting summary, proposal |
| Analysis | Data analysis, competitor research, incident post-mortem |
| Planning | PRD, architecture decision, sprint planning |
| Learning | Explain concept, compare technologies, create tutorial |
Maintenance tips:
- Version control your templates (Git, not Google Docs)
- Review and update quarterly — models improve, templates should too
- Track which templates get the best results
- Share across your team — one great template beats 10 mediocre ones
- Include the model and temperature recommendation with each template
Start today: Pick your most repetitive AI task. Write a template. Save 10 minutes every time you use it.
---quiz question: What is the main benefit of using prompt templates? options:
- { text: "They make the AI respond faster", correct: false }
- { text: "They ensure consistent quality and save time by not crafting prompts from scratch", correct: true }
- { text: "They bypass API rate limits", correct: false }
- { text: "They reduce token costs to zero", correct: false } feedback: Templates provide consistent quality across team members, eliminate the need to remember optimal phrasing, and are easy to improve — update the template once and everyone benefits.
---quiz question: Why should a bug investigation template include "what I've already tried"? options:
- { text: "To make the prompt longer for better results", correct: false }
- { text: "To prevent the AI from suggesting solutions you've already ruled out", correct: true }
- { text: "To impress the AI with your debugging skills", correct: false } feedback: Including previous attempts prevents the AI from wasting time on solutions you've already tried. It also gives the AI valuable diagnostic information — knowing what DIDN'T work narrows down the root cause.
---quiz question: How should prompt templates be stored and maintained? options:
- { text: "Memorize them — writing them down is a waste of time", correct: false }
- { text: "In version control (Git), reviewed quarterly, shared across the team", correct: true }
- { text: "In a locked PDF that nobody can edit", correct: false } feedback: Templates should be version-controlled like code, reviewed and updated regularly as models improve, and shared across the team so everyone benefits from the best prompts.