Skip to content

Lesson 6 ยท Prompting ChatGPT

Prompt Templates, Examples and Roles

Use examples, roles and reusable templates to get consistent ChatGPT results, and learn where each technique helps and where it can mislead you.

Once a prompt works, you should not have to invent it again. This lesson covers three ways to get consistent results: showing examples, assigning a role and writing templates with blanks.

Show examples

If a style is hard to describe, show it. A few examples tell ChatGPT about length, tone and format at once:

TEXT
Turn each note into a short task title.

Note: "need to call the printer people about the late flyers"
Title: Call printer about late flyers

Note: "maybe book the hall for the June thing?"
Title: Book hall for June event

Note: "ask Sam if the budget sheet is updated"
Title:

Tips for good examples:

  • Make them varied, so the model does not copy an accidental detail, such as every title starting with "Call".
  • Make them correct. A wrong example teaches a wrong pattern.
  • Remove private details, or replace them with invented ones.
  • Say whether the examples are models to follow or only references.

Prompting with a few examples is called few-shot prompting. See zero-shot and few-shot prompting.

Give a role

A role can focus the answer:

TEXT
Act as a patient math tutor for a 13-year-old. Ask one question at a
time and do not give the final answer until I try.

The useful part is not the title "tutor" but the behavior you describe. A role does not give ChatGPT new knowledge, qualifications or accountability. "Act as a doctor" produces text in a doctor-like style, which is not medical advice. See roles, personas and system prompts.

Build a template

A template is a prompt with blanks. Keep the fixed instructions and change only the details:

TEXT
TASK: Write a weekly update for [team].
INPUT: [paste notes]
FORMAT: three headings: Done, Next, Blockers. Max [number] bullets each.
RULES: Use only facts from the input. If a heading has nothing, write "None".

The rule about using only the input matters. Without it, a model may fill gaps with plausible inventions.

Fill templates safely

The stand-in below fills placeholders and refuses to continue when a blank is left unfilled. It shows what a careful template tool would do before you paste the result into ChatGPT.

Python Stand-in: fill a prompt template

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Keep a small prompt library

Store your templates in a note or document you control. A good entry has:

Field Example
Name Weekly update
When to use Friday status reports
Prompt The template with blanks
Check Every bullet appears in the notes
Last tested The date you last tried it

The check column is easy to forget. It reminds you how to verify each result. Retest templates now and then, because model changes can alter how a prompt behaves.

Inside ChatGPT, you can also keep a template in a project or turn it into a skill, which you will learn about later.

Ask for structured output

For results you will reuse, ask for a strict shape:

TEXT
Return a table with exactly these columns: Task, Owner, Due date.
Write "unknown" if a value is missing. Do not add other text.

ChatGPT usually follows formats well, but it can still add a sentence or drop a column. If the output feeds another system, check it before using it. Developers working with an API have stricter options, described in structured output with JSON.

When templates are the wrong tool

Templates suit tasks you repeat. For open exploration, a rigid form can limit the answer. If you are still discovering what you want, chat freely first, then write a template once you know.

Test a template on awkward input

A template that works on tidy input may fail on messy input. Before you rely on it, try it with an empty section, a very long note, a note in another language and a note that contains something like an instruction ("ignore the above"). See whether the result still obeys your rules. Record what you observed next to the template, then improve one rule at a time. This habit comes from building a prompt test set.

A worked template, from start to finish

Suppose you answer the same kind of customer question every week. Start with one good chat. Notice which details changed each time (the product, the question, the tone) and which stayed fixed (length, greeting, rules). Turn the changing details into blanks:

TEXT
Draft a reply to a customer question.
Product: [product]
Question: [question]
Facts you may use: [approved facts]
Rules: under 120 words; friendly; if the facts do not answer the
question, say we will check and reply. Do not promise refunds.

The important line is "facts you may use". It tells ChatGPT where the truth comes from, and the fallback tells it what to do when the facts run out. A person should still read each reply before it is sent.

Keep, fix or retire

Review your library every few months. For each template ask: do I still use it, does it still pass its check and has the product or policy it mentions changed? Fix or delete old entries. A short library that works beats a long list that nobody trusts. If colleagues use your templates, record who maintains each one, so that problems reach someone who can fix them.

Practice

Pick one task you do at least once a month. Write the first version of its template with no more than four blanks. Run it with two different sets of invented details. If you had to correct the same thing both times, add that correction to the fixed rules. If a blank was often empty, decide what the template should do then, and write it down. Save the version that worked, with today's date and its check.

Examples or rules?

Use rules when you can state exactly what you need, such as a word limit. Use examples when the quality is easier to recognize than to describe, such as a tone of voice. Many good templates combine both: two or three short rules and one or two examples. If they disagree, fix the template, because the model has to guess which one you meant.

Common mistake: sharing a template that contains real customer names or private notes. Strip the data out and keep only the structure.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. What does adding a role such as 'act as a tutor' do?

    A role affects how it answers, not whether the content is true.
  2. 2. Why should examples vary?

    Very similar examples can suggest patterns you never intended.
  3. 3. What is a good rule for a summary template?

    This reduces invented content and makes gaps visible.

Summary

  • Varied, correct examples show tone and format quickly.
  • Roles shape behavior, not expertise or truth.
  • Templates with blanks make results consistent.
  • Keep a check step with each saved prompt.
  • Remove private data from shared templates.

Next: Writing and Editing With ChatGPT

Your progress is saved in this browser. No account needed.