Module 4 Lesson 4: Prompt Templates and Variables
How to stop writing prompts from scratch. Create reusable structures with variables for scale.
Prompt Templates and Variables
If you find yourself writing the same instructions over and over, you need a Prompt Template. This allows you to keep the structure the same while only changing the "Variable" data.
1. What is a Prompt Template?
A template is a skeleton prompt with placeholders (often indicated by brackets like [variable] or {variable}).
Example Template:
You are a [Role]. Please review the following [Content Type]:
[Input Data]
Provide the analysis in a [Format] with a focus on [Priority].
2. Using Variables for Scale
When using templates, you treat the AI like a function in programming.
- Input: The variables.
- Function: The prompt template.
- Output: The consistent result.
graph LR
Vars[Variables: Topic, Tone, Words] --> Template[Prompt Template]
Template --> AI[ChatGPT]
AI --> Result[Standardized Output]
3. Creating a Library
Power users keep a "Prompt Library" (in a notes app, a text file, or a specialized tool). Each entry in the library should have:
- Name: e.g., "SEO Blog Outliner"
- The Template: The full text with variables.
- Example Use Case: A sample of when it's worked well.
4. Prompt Snippets
Use text-expander tools (like Alfred or Raycast) to trigger templates with short keywords.
- Typing
;emcould expand into your standard "Professional Email Polisher" template.
Hands-on: Build Your First Template
Create a template for "Movie Reviews."
- Variable 1: Movie Title.
- Variable 2: Your Rating (1-10).
- Variable 3: One thing you liked.
- Variable 4: One thing you hated.
The Template: "Write a 3-paragraph review for the movie [Title]. My rating is [Rating]. Mention that I liked [Liked] but I hated [Hated]. Use the tone of a cynical film critic."
Try filling it in for a recent movie you watched.
Key Takeaways
- Templates ensure consistency.
- Variables save time and mental energy.
- Treat your best prompts as assets to be saved and reused.