Prompt Engineering for Engineers
Write instructions a model will follow, put the right facts in front of it, get back data your code can trust, and test the prompt like the code it is.
A prompt is a program written in English that a language model runs by predicting what comes next. This short, example-dense course teaches engineers to write instructions that hold, ground the model in the facts it needs, get structured output code can validate, use examples and caching well, and test every prompt change against a small eval set. You practice on two model-backed features of Shelf, the bookshop app from the platform's other courses, and Eve, the built-in tutor, is one highlight away.
7 lessons · about 6 hours of reading · quizzes graded by code and by Eve
- 1prompts/draft.system.mdrole, voice, scope, refusal, priority
- 2Delimited contextorder record in, data is not instructions
- 3record_offers schemaforced tool call, nulls allowed
- 4zod validation + retryshape is not meaning
- 5prompts/intake.examples.mdthree to five, labeled, stable prefix
- 6evals/*/cases.jsonabout 20 cases per feature
- 7npm run evalsassertions and a judge, pass rate
- 8prompts/CHANGELOG.mdone change at a time
How the course is organized
| Phase | Question it answers | Lessons |
|---|---|---|
| Instruct | What should the model do, for whom, with what facts, and what should it do when it cannot? | L0–L2 |
| Structure | How do you shape the input so data stays data, and shape the output so code can trust it? | L3–L4 |
| Iterate | How do you know a prompt change made things better, and when is a prompt the wrong tool? | L5–B1 |
Modules
Start Here
How a model produces text, the three kinds of material in a request, system prompt versus user turn, and why "be helpful" does nothing.
Instructions and Context
Specific, positive instructions with a role, a scope, and a refusal; then the facts the model needs, delimited, placed well, and protected from injection.
Shaping Input and Output
Schemas and forced tool calls for output code can validate, nulls instead of guesses, and examples, templates, versions, and caching for the input.
Prompts as Code
A small eval set, assertions and a judge, one change at a time, thinking on or off, and knowing when the prompt is the wrong layer.
Bonus
A twelve-question review checklist for prompt changes and the five anti-patterns it catches.
Every lesson
Module 0Start Here
- L0Instruct· 35 min Not startedWhat a Prompt Is (and Is Not)
How a language model produces text, the three kinds of material in a request, what belongs in the system prompt versus the user turn, and why a prompt is code.
Module 1Instructions and Context
- L1Instruct· 55 min Not startedInstructions That Hold
Turn wishes into checkable instructions: name the behavior, pair every never with an instead, set role, audience, and voice, write the refusal, resolve conflicts, and cut every line that changes nothing.
- L2Instruct· 50 min Not startedContext, Grounding, and Injection
Put the order record in the request, wrap every piece of data in a labeled block, tell the model what to say when a fact is missing, place long data before the question, and defuse the email that tries to give orders.
Module 2Shaping Input and Output
- L3Structure· 55 min Not startedStructured Output
Describe Intake's record as a JSON schema, force the model to fill it through a tool call, validate the result with zod, retry with the error, and let the model say unknown instead of guessing.
- L4Structure· 50 min Not startedExamples, Templates, and Caching
Pick three to five examples that teach a pattern without being copied, move prompts into versioned files with variables, and order every request so the stable part is cached.
Module 3Prompts as Code
- L5Iterate· 60 min Not startedTesting and Iterating a Prompt
Build a twenty-case eval set, check Intake with assertions and Draft with a rubric judge, run npm run evals, change one thing at a time, decide when thinking is worth it, and notice when the prompt is the wrong layer.
Module 4Bonus
- B1Bonus· 30 min Not startedBonus: The Prompt Review Checklist
Twelve questions to ask of every prompt change before it merges, the five anti-patterns they catch, a walk-through of a one-line pull request, and a short script for explaining to a product owner why a sentence needs a review and an eval run.
Meet Bramble Books, Shelf, Intake, and Draft
The same bookshop as the platform's other courses. Two features of Shelf call a language model: Intake turns a supplier's free-text email into title records Shelf can import, and Draft writes a reply to a customer email from the order record for Tessa, the Elm Street store manager, to approve. Six recurring cases (IN-1 to IN-3, DR-1 to DR-3) run through every lesson and seed the eval sets.
| Tool | What it does | Risk tier |
|---|---|---|
prompts/draft.system.md | Draft's standing instructions: role, audience, voice, scope, refusal, priority | Versioned, reviewed, in CHANGELOG.md |
prompts/intake.system.md + intake.examples.md | Intake's instructions and its three to five labeled examples | Stable prefix, cached |
record_offers schema | The shape of an Intake record: nullable price, currency enum, confidence | Forced tool call, then zod |
src/llm/draft.ts, src/llm/intake.ts | The calls, the templates, the validation, the retry | Anthropic TypeScript SDK shapes |
evals/*/cases.json + evals/run.ts | About 20 cases per feature; assertions for Intake, a rubric judge for Draft | npm run evals prints the pass rate |
docs/prompt-review.md | The twelve-question checklist for every prompt change | Reviewed like code |
Written as a short companion to the platform's other courses. The API shapes follow the Anthropic TypeScript SDK's documented Messages API, tool use, prompt caching, and adaptive thinking. All lesson text, examples, prompts, quizzes, the glossary, and the Intake and Draft features were written for this course.