Prompt Engineering
Ten sessions on getting reliable output from a language model. Each one teaches a single mechanism, lets you feel it in a lab, and ends with questions you should answer without notes.
Almost every technique pulls one of five levers. Knowing which lever a fix pulls is most of what scenario questions test.
Instructions
What the model is asked to do
Role, constraints, output format, TAG, CO-STAR
Examples
What good output looks like
Zero-shot vs few-shot, worked reasoning examples
Context
What the model knows right now
RAG, tool results, conversation history
Process
How the work is broken up
Chain-of-thought, prompt chaining, ReAct
Sampling
How the next token is picked
Temperature, top-p, max tokens
Ten sessions and a cheat sheet, in five stages, 45 to 60 minutes each. Skip ahead when a topic is already familiar; Day 10 is practice and review.
Foundations
How a model picks the next token, and what a strong prompt is made of. Sampling settings change how the pick is made; they never add knowledge. The parts of a prompt are the checklist every later technique hangs off.
Show and shape
Teach by example, then by reasoning. Few-shot examples are the strongest lever and the one that anchors hardest. Chain-of-thought, self-consistency and prompt chaining decide how the work is broken up.
Act and ground
When the model needs facts it does not have, it has to fetch them. ReAct turns reasoning into a loop of tool calls, and retrieval puts sources in the prompt so answers come from documents instead of memory.
Control and verify
Structure the output with schemas and validation, then prove the prompt works with a fixed eval set before trusting it. Prompt injection is covered here because every tool and document is an input you must defend.
Practice and review
Scenario questions, graded by symptom and mechanism, and a cheat sheet to check your answers against.
Guides and courses
Start with the first two; read the third when a named technique needs its full write-up.
- Anthropic prompt engineering overviewClarity, examples, XML tags, roles, thinking, chaining, evals
- Anthropic interactive prompt engineering tutorialNine hands-on chapters with exercises and an answer key
- Prompt Engineering Guide (DAIR.AI)Every named technique, plus RAG, agents and adversarial prompting
Original papers
Read the abstracts and figures on the day each one comes up.
- D03Language Models are Few-Shot Learners · Brown et al., 2020
- D01Lost in the Middle · Liu et al., 2023
- D04Chain-of-Thought Prompting Elicits Reasoning · Wei et al., 2022
- D04Large Language Models are Zero-Shot Reasoners · Kojima et al., 2022
- D04Self-Consistency Improves Chain of Thought · Wang et al., 2022
- D04Least-to-Most Prompting · Zhou et al., 2022
- D04Tree of Thoughts · Yao et al., 2023
- D05Self-Refine · Madaan et al., 2023
- D06ReAct: Synergizing Reasoning and Acting · Yao et al., 2022
- D06Reflexion · Shinn et al., 2023
- D07Retrieval-Augmented Generation · Lewis et al., 2020