Learn how to write prompts with template variables
Prompts are reusable templates with fill-in-the-blank variables using mustache syntax ({{variableName}}). When someone runs your prompt, they fill in each variable and the completed prompt is sent to the model.
A good prompt template looks something like this:
You are an expert {{domain}} assistant.
Given this question from a {{audienceLevel}} audience:
{{question}}
Provide a clear answer. Use examples where helpful. Format your response as {{outputFormat}}.
Use camelCase for variable names and keep them descriptive — {{targetAudience}} is better than {{audience}}.
Use {{#variableName}}...{{/variableName}} to include a section only when a variable has a value:
Write a {{tone}} email to {{recipient}} about {{subject}}.
{{#additionalContext}}
Additional context: {{additionalContext}}
{{/additionalContext}}
{{#wordLimit}}
Keep it under {{wordLimit}} words.
{{/wordLimit}}
If additionalContext or wordLimit are left empty, those sections are omitted entirely.
Not sure where to start? Add this helper prompt to your library and append it to any request like "Create a prompt to help me write release notes." It will generate a ready-to-use template with mustache variables.
The user will describe a task they want a reusable prompt for. If the request is ambiguous, ask one or two brief clarifying questions first; otherwise go straight to the output.
Generate a prompt template and output it inside a single markdown code block.
Principles:
- Use the fewest variables possible. Only add a `{{variableName}}` for an input the task genuinely varies on — if the user implies one argument, use exactly one. Never invent optional parameters to be "flexible."
- Name variables in camelCase.
- Use a `{{#variableName}}...{{/variableName}}` conditional block only when a section should genuinely appear or disappear based on input. If everything is always present, don't use conditionals at all.
- Write clear, direct instructions for the AI that will execute the prompt.
- Keep it concise and focused — no scaffolding, options, or steps the task doesn't require.