Loading
0x00Lesson 1 of 9

Write a clear prompt

State the task, the context and the reason behind it, the constraints and the output - specific enough that success is checkable.

20 min 6-question quiz 2 code exercises
By the end of this lesson you can
  • Build a prompt from task, context, constraints and output format
  • Replace vague requests with observable requirements
  • Explain why giving the reason behind an instruction helps

A useful test: would a smart new colleague, with no background, know exactly what to do from your prompt? Models are in the same position - they know a lot about the world and nothing about your situation unless you say it.

Clear prompts usually cover:

  • Task - what to produce, stated directly.
  • Context - who it’s for, where it will be used, what’s already known. Say why a rule matters: “Keep it under 80 words because it’s shown in a phone notification” lets the model make sensible trade-offs instead of following the rule blindly.
  • Constraints - length, tone, what to avoid - only those that matter.
  • Output - the exact shape you need, so you can check it.

Before writing any prompt, define what success looks like and how you’ll test it (Anthropic’s guide puts this first).

Try it

Up to 15 XP

Prompt duel

Each round has one goal and two prompts. Pick the one more likely to get a useful result, then read why.

Round 1 of 4: A summary of a long incident report for executivesScore 0/0
prompt_parts.py
1parts = {
2    "task": "Summarize the announcement in one sentence.",
3    "context": "The park opens at 7 am on Saturday.",
4    "format": "Include the opening time.",
5}
6print("\n".join(f"<{name}>{text}</{name}>" for name, text in parts.items()))
Output
<task>Summarize the announcement in one sentence.</task>
<context>The park opens at 7 am on Saturday.</context>
<format>Include the opening time.</format>

Key takeaways

  • Write for a smart newcomer: task, context and why, constraints, output.

  • Replace vague words (“better”, “some”, “etc.”) with observable requirements.

  • Define success and how you’ll test it before polishing the prompt.

Lesson quiz

6 questions · pass with 5 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: write Python

Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.

Exercise 1

Assemble a prompt from parts

+25 XP

Each line is field: value for any of role, context, task, format, in any order. Print the non-empty fields as <field>value</field>, one per line, in the order role, context, task, format. If there is no task, print error: a prompt needs a task instead.

  • All parts, shuffled
  • Empty format
  • No task
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Exercise 2

Flag vague phrases

+25 XP

For each input line (a prompt), find the VAGUE phrases it contains as whole words, ignoring case. Print prompt N: followed by the phrases found (in the order of the VAGUE list, comma-separated), or looks specific.

  • Three prompts
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…