Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Asking an AI assistant clearly

After this lesson: I can write a clear request with context and an example.

45 min lessonNo commands

Two people, one assistant

Two new developers at a delivery company ask the same assistant for help. One types "fix my date code". The other says what the code is for, pastes the error and shows one date.

The first gets a guess. The second gets a fix that works. The difference is not luck. It is how they asked.

By the end of this lesson

Note

I can write a clear request with context and an example.

Key words

WordWhat it meansExample
Goalwhat you want the code to do
Contextthe facts the assistant needs about your work
Constrainta limit the answer must keep toUse plain Python
Exampleone input with the output you expect1250 gives 12.50
Output formatthe shape you want the answer in
Follow-upa next message that corrects or adds detail

The cells students fill in are left blank in this preview.

A clear request has four parts

The assistant knows only what you tell it. So say four things.

The goal: what the code must do. The context: where the data comes from and what it looks like. The constraints: the language, the libraries, the style. The output format: one function, a whole file, or an explanation.

A vague request and a clear one

PartVagueClear
GoalFix my date codeTurn a date like 21/10/2026 into 2026-10-21
Context(missing)Dates come from a delivery CSV file, day first
Constraint(missing)Python 3, no extra libraries
Output format(missing)One function, with a short comment

The cells students fill in are left blank in this preview.

An example removes the guessing

Words can mean two things. "Format the price" could mean £12.50, 12.5 or 1,250p.

One example settles it. Give one input and the exact output you expect. Two or three examples are better when there is an odd case, such as zero or an empty list. Later, the same examples become your tests.

Try it: add an example

Code: python
# A request for an assistant, kept as text in a script.
goal = "Write a Python function that turns a price in pence into pounds."
context = "Prices come from our shop's orders file as whole numbers."
limit = "Use plain Python. No extra libraries."
example = ""

# Add an example: give example the text
# "Input 1250, output 12.50" and press Run.

print("Goal:", goal)
print("Context:", context)
print("Limit:", limit)
print("Example:", example)

A follow-up says what was wrong

The first answer is often close but not right. Do not start again with the same words.

Send a follow-up. Say what you ran and what happened. Paste the exact error message. Add the constraint you forgot. Each message adds to the context, so the next answer has more to go on.

Worked example: three messages

MessageWhat you sendWhy it helps
1Goal, context, constraint and one exampleA clear start
2It fails for 05/01/2026. Here is the error.The exact fault is now in the context
3Good. Now add a comment on each step.One change at a time is easy to check

The cells students fill in are left blank in this preview.

A common mistake

Warning

Many people think a longer request is always a better one. Length only helps when every line changes the answer. Keep the goal, the facts, the limits and an example, and cut the rest.

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.