Prompt Templates
Abstract
A prompt template is a pre-filled template with variables that you customize for a specific task.
Why Use Templates
When the same task repeats, it's convenient to use a pre-filled template instead of writing a new prompt each time.
Example without a template:
Write a code review...
Example with a template:
You are a senior Python developer.
Provide a code review for the following code:
[INSERT CODE]
Only [INSERT CODE] needs to be changed.
Basic Structure of a Template
Role + Context + Task + Format + Constraints
For more details, see the article Prompt Engineering.
Where to Find Ready-Made Templates
In the Prompts section, we have a collection for:
How to Make a Template User-Friendly
- Move changeable parts into
[BRACKETS]. - Describe the role and format once.
- Provide examples if the format is complex.
- Store templates in one place.
Example: Template for Emails
Write an email.
To: [TO]
Purpose: [PURPOSE]
Tone: [FRIENDLY / BUSINESS]
Length: [SHORT / DETAILED]
Fill in the variables and send.