Prompting fundamentals
System prompts, examples and step-by-step reasoning are the first tools to reach for. Each has evidence behind it and limits to know.
In this lesson you'll
- Structure a system prompt
- Use few-shot examples well
- Know when reasoning prompts help
The system prompt
A good system prompt reads like a task spec: who the model is acting as, what it receives, exactly what to return, and what it must never do. Ambiguity in the prompt becomes inconsistency in the output.
Few-shot examples
Showing the model a few solved examples is often the single biggest gain, as the GPT-3 paper found across many tasks [1]. Choose examples that cover the hard cases and show the exact output format. Order matters too: models use information at the start and end of a long context better than information in the middle [2], so put the essentials where they'll be seen.
Asking for reasoning
Chain-of-thought prompting, which shows worked reasoning steps in the examples, substantially improved large models on arithmetic, commonsense and symbolic reasoning benchmarks [3]. Self-consistency goes further: sample several reasoning paths and take the majority answer [4]. Both cost extra tokens and latency, so use them where the task needs multi-step reasoning, not for simple classification.
You classify customer support tickets. Input: one ticket, in any language. Output: exactly one of billing | bug | feature_request | other. Return only the label, lower case, nothing else. Ticket: "I was charged twice this month." Label: billing Ticket: "The export button does nothing on Safari." Label: bug
Key takeaways
- Write the system prompt as a spec with an exact output format.
- Few-shot examples should cover hard cases; keep key material out of the middle of long contexts.
- Reasoning prompts help on multi-step problems and cost latency everywhere.
Start a beginner kata and submit a prompt-based solution. Sensei grades it from 0 to 100, and 70 completes it.
Try a kataCheck your understanding
Score 70 or more to complete the lesson. Progress is saved in this browser.
Further reading
Sources
Checked against the original sources in November 2026.
- Brown, T. et al. (2020). Language Models are Few-Shot Learners. NeurIPS 2020 · arXiv:2005.14165.
- Liu, N. F. et al. (2023). Lost in the Middle: How Language Models Use Long Contexts. TACL 2024 · arXiv:2307.03172.
- Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022 · arXiv:2201.11903.
- Wang, X. et al. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. ICLR 2023 · arXiv:2203.11171.