promptdojo_
the whole school

31 chapters · 833 runnable steps · 8–15h

31 chapters·833 steps·8–15h·MIT·last commit 2026-05-14
phase 00

before you build

for anyone whose job got eaten by ai. what an llm is, how to talk to one, and what this course is going to ask of you.

ch 00
~1h 17m
+ch 00before you build34 steps · ~1h 17m

if you're here because ai took your job, this chapter is the one. names the situation honestly, installs the mental model the rest of the course assumes, and gets you typing your first line of code without pretending the last six months didn't happen.

  1. 01·the situation, named honestly8
  2. 02·what an llm actually is9
  3. 03·how to talk to one8
  4. 04·where this course goes (and where you fit)9
open chapter
phase 01

foundations

variables, functions, lists, dicts, loops, conditionals, tracebacks, mutation

ch 01–07
~2h 14m
+ch 01variables26 steps · ~22m

when ai writes python, the first thing it does is name things. learn to read those names on sight, and to write a few yourself.

  1. 01·naming things you'll point ai at8
  2. 02·the four types you'll see daily9
  3. 03·print, repr, and the f-string9
open chapter
+ch 02functions27 steps · ~21m

ai writes functions constantly, and silently forgets the `return` line about a third of the time. learn to spot the missing return on sight.

  1. 01·functions and the missing return9
  2. 02·arguments, defaults, and the silent wrong-order bug9
  3. 03·closures and the @ symbol — what ai is doing when it stacks decorators9
open chapter
+ch 03lists and dicts27 steps · ~21m

every json response you've ever copied out of chatgpt or a rest api is some mix of two things: lists and dicts. read them on sight.

  1. 01·lists, dicts, and the shape of an api response9
  2. 02·the one-liner python writes when it's showing off9
  3. 03·nested dicts and lists — digging through the json ai just dumped9
open chapter
+ch 04loops28 steps · ~21m

ai writes a loop every time you say *for each*. half the time it's wrong by one. read it before you trust it.

  1. 01·loops — read it, predict it, then trust it10
  2. 02·while, break, and the infinite loop ai ships9
  3. 03·enumerate and zip — the loops ai writes when it's not lazy9
open chapter
+ch 05conditionals17 steps · ~14m

`if` looks simple. the traps inside it — empty values, `==` vs `is`, the difference between `0` and `None` — are where ai quietly ships wrong code.

  1. 01·conditionals and the truthiness traps8
  2. 02·elif chains and the match statement cursor reaches for9
open chapter
+ch 06tracebacks26 steps · ~21m

when python crashes, it tells you exactly what happened and where. most non-engineers panic at the wall of text. you're going to learn to read it.

  1. 01·tracebacks — read the wall of text8
  2. 02·diagnose any crash in one read9
  3. 03·print and breakpoint — finding the bad value before ai does9
open chapter
+ch 07mutation17 steps · ~14m

when a list inside a function changes the list outside the function, that's mutation. ai does this constantly without flagging it, and it's the bug class that takes the longest to find.

  1. 01·mutation and the action-at-a-distance bug8
  2. 02·shallow copy, deep copy, and the nested-dict bug9
open chapter
phase 02

real python

modules, error handling, files & i/o, classes, http

ch 08–12
~1h 52m
+ch 08modules, imports, and why your venv hates you17 steps · ~15m

half of `pip install x` failures are environment confusion, not python bugs. learn what `import` actually does, what a virtual env is for, and why your script can't find the package you just installed.

  1. 01·imports, pip, and the venv that can't see your package8
  2. 02·aliases, multi-imports, and the `np.` you'll see everywhere9
open chapter
+ch 09error handling27 steps · ~23m

ai loves a happy path. the moment a file isn't there or an api blinks, the script blows up. `try/except` is how you keep the program alive long enough to log what went wrong.

  1. 01·try/except — catching what ai didn't9
  2. 02·catching the right error — not 'anything that goes wrong'9
  3. 03·raising errors — making your code fail loudly on purpose9
open chapter
+ch 10files and i/o27 steps · ~24m

reading a csv, writing a log, parsing a json dump. the first thing ai does in any real project is touch a file. learn the few patterns it reaches for and the one it forgets.

  1. 01·open() — and the with-block ai keeps forgetting9
  2. 02·pathlib — the file api ai should reach for first9
  3. 03·csv and jsonl — the two formats ai moves data in9
open chapter
+ch 11classes27 steps · ~25m

ai ships classes constantly: sqlalchemy models, fastapi schemas, custom exceptions. you don't need to design them. you need to read one without flinching.

  1. 01·class, __init__, self — the three keywords ai uses every time9
  2. 02·instance vs class attributes — and the bug ai ships every time9
  3. 03·@dataclass — the class shape ai ships in every modern python project9
open chapter
+ch 12http and apis27 steps · ~25m

every ai script eventually calls an api. learn the shape of `httpx.get`, what a status code means, and how to pull a value out of the json that comes back.

  1. 01·get, status, json — the call ai makes 100 times a day9
  2. 02·status codes and error handling — what ai's api calls do when the wire blinks9
  3. 03·parsing nested api responses — without crashing on a missing key9
open chapter
phase 03

llm apis

calling models, structured output, mcp, agent loops

ch 13–16
~2h 47m
+ch 13llm apis26 steps · ~37m

every ai feature you ship eventually calls a model api. learn the messages pattern, how to read the response, and the four lines ai writes every single time.

  1. 01·messages, roles, and the response — the call ai ships every time9
  2. 02·reading the response — content blocks, stop_reason, usage9
  3. 03·the model picker — when sonnet is wrong and haiku is right8
open chapter
+ch 14structured output17 steps · ~26m

free-form text breaks every pipeline. learn the schema-first pattern ai uses to get reliable json back, validate it with pydantic, and catch the model's lies before they hit prod.

  1. 01·schemas, pydantic, and validation — making the model return real data9
  2. 02·why schemas eat prompts — the boundary contract pattern8
open chapter
+ch 15mcp26 steps · ~40m

mcp is the new standard for plugging tools and data sources into ai agents. learn what an mcp server actually is, how claude code lists tools, and why this is replacing one-off integrations everywhere.

  1. 01·servers, tools, and the protocol — how ai agents plug into your stack9
  2. 02·writing a tiny mcp server — registries, dispatch, and the response shape9
  3. 03·why mcp won — the protocol wars of 2024-258
open chapter
+ch 16agent loops45 steps · ~1h 4m

an agent isn't a magic. it's a while loop. learn the actual cycle claude code, cursor, and every other agent uses: model returns tool_use, you run the tool, you send the result back, repeat until end_turn.

  1. 01·stop_reason, tool_use, tool_result — the loop every agent runs9
  2. 02·multi-step tools — when one tool isn't enough9
  3. 03·routing — pick the path before doing the work9
  4. 04·evaluator-optimizer — write a draft, let a judge critique it, revise9
  5. 05·why every framework is the same thirty lines — and what that means for buy-vs-build9
open chapter
phase 04

shipping discipline

git, secrets, prompting, traces, evals, retrieval, tradeoffs

ch 17–24
~4h 57m
+ch 17git and github cli17 steps · ~28m

cursor and claude code commit on your behalf. reading those commits — and undoing the bad ones — is your job. learn the four-state model, the commands you'll run every day, and what `gh` does that `git` can't.

  1. 01·working tree, staging, commit — the model ai breaks first9
  2. 02·three git disasters ai shipped — and what got rotated8
open chapter
+ch 18secrets9 steps · ~8m

ai ships keys to github all the time. learn the .env pattern, why os.getenv is non-negotiable, what to do when a key leaks, and the gitignore lines you need on day one.

  1. 01·.env, os.getenv, and the leak recovery you'll do at least once9
open chapter
+ch 19prompting cursor and claude code effectively35 steps · ~51m

the difference between a one-shot ai session and a four-hour debugging spiral is almost always the first prompt. learn the structure that gets you usable code.

  1. 01·the six-knob prompt for shipping code9
  2. 02·few-shot and reasoning — examples that work, and the cot trap on reasoning models9
  3. 03·claude.md, agents.md, .cursor/rules — the system prompt your agent reads every session9
  4. 04·what aged: the 2023 prompting tricks that became 2026 traps8
open chapter
+ch 20reading agent traces and telemetry18 steps · ~22m

when an agent fails, the trace tells you exactly where. learn to read tool calls, tool results, and stop reasons — the json breadcrumbs every agent leaves behind.

  1. 01·what an agent leaves behind9
  2. 02·trace-driven debugging — turn a 4-hour panic into a 20-minute investigation9
open chapter
+ch 21eval-driven ai development26 steps · ~41m

if you can't test it, you can't ship it. learn the simple-but-strict eval patterns that separate ai features that work from ones that just feel like they do.

  1. 01·assertions on ai output, not vibes9
  2. 02·llm-as-judge — when the judge is another model9
  3. 03·how evals went from research curiosity to the only thing that ships — a five-year history8
open chapter
+ch 22context and retrieval36 steps · ~58m

rag without the overengineering. chunking, embeddings, vector search, and the small set of patterns that make a model answer from your data instead of its training set.

  1. 01·chunking that respects structure — don't shred your own documents9
  2. 02·embedding that fits the budget — pick a model that matches your corpus9
  3. 03·retrieval that finds the right thing — top-k, thresholds, and the rerank step everyone skips9
  4. 04·rag vs long context vs fine-tune — the decision that's killed more ai startups than any model swap9
open chapter
+ch 23production tradeoffs26 steps · ~42m

the three numbers every shipped llm feature lives or dies by. token math, caching, streaming, batching, and the small set of decisions that move the product more than a model swap ever will.

  1. 01·prompt caching correctly — the variable input goes last9
  2. 02·read the token bill — what your llm feature actually costs9
  3. 03·the 2023-2026 model price war — and why your cost model is already obsolete8
open chapter
+ch 24debugging broken ai output27 steps · ~47m

when the model lies to your customer. the methodology for narrowing down what went wrong, the four most-common breakage classes, and the discipline that separates 'we shipped a fix' from 'we blamed the model and shrugged'.

  1. 01·read the trace, not the chat — find the broken turn before reading the user's complaint9
  2. 02·the four breakage classes — sort any llm failure before you touch the prompt9
  3. 03·five postmortems — three public, two composite — and the one fix that would have caught all of them9
open chapter
phase 05

capstone

ship a working cli agent in 12 steps. ~100 lines of python.

ch 25
~1h 24m
+ch 25capstone55 steps · ~1h 24m

wire it all together. context, retrieval, the prompt, the call, the trace, the eval, the cost. less a tutorial demo, more the smallest end-to-end llm feature you could ship to a real user.

  1. 01·why most beginner agents die in production — and how to pick one that ships7
  2. 02·wire it all together — a cli agent in 12 steps12
  3. 03·wire the real model — swap fake_llm for the anthropic sdk shape9
  4. 04·validate tool inputs — when the model invents arguments9
  5. 05·add evals and traces — measure the agent, don't trust it9
  6. 06·wire an mcp tool — load tools from a server, not a registry9
open chapter
phase 06

applied builds

agent harnesses, ai image gen, ai video gen, programmatic design, harness engineering

ch 26–30
~5h 15m
+ch 26agent harnesses27 steps · ~47m

claude code, cursor, aider, codex cli — they're all the same four layers wrapped around the same model api. learn what those layers are, what each adds, and what you'd build yourself if you had to.

  1. 01·what a harness is — the four layers under every coding agent9
  2. 02·architecting an ai-native workflow — a 5-step playbook in code9
  3. 03·five industries walked through — what ai-native looks like in the wild9
open chapter
+ch 27ai image generation24 steps · ~1h

the 2026 image model landscape, the prompts that work, and the pipeline that turns one good idea into a hundred ready-to-ship images. nano-banana, flux, midjourney, ideogram — when each wins and what they cost.

  1. 01·the image model landscape — six families and what each is for9
  2. 02·prompting for real output — composition, control, and the eight knobs that matter8
  3. 03·the image pipeline — turning one idea into a hundred shipped assets7
open chapter
+ch 28ai video generation23 steps · ~50m

video is the hardest content type to generate, the most expensive, and the most strategically interesting. learn the 2026 model lineup, the camera-control patterns that separate slop from craft, and the cost math that decides whether your idea is viable.

  1. 01·the 2026 video model lineup — what each one is actually good at9
  2. 02·camera control and motion — what separates slop from craft8
  3. 03·the cost math — when ai video is viable and when it bankrupts you6
open chapter
+ch 29programmatic design24 steps · ~46m

ai generates raw assets; code stitches them into something shippable. hyperframes, remotion, claude design — when each tool wins, how they combine, and the data-driven workflows that turn one template into a hundred videos.

  1. 01·why programmatic video — when ai gen alone isn't enough7
  2. 02·hyperframes and remotion — the two tools that own this space9
  3. 03·the ai-native design pipeline — concept to shipped mp4 in one workflow8
open chapter
+ch 30harness engineering45 steps · ~1h 52m

every coding agent is a model plus a harness. the model is bought; the harness is engineered. learn the craft: how to ratchet rules from failures, fight context rot, design long-horizon loops, wire hooks as enforcement, and read the haas shift that's reshaping what you build vs buy.

  1. 01·the harness-engineering mindset — agent equals model plus harness8
  2. 02·the ratchet — every mistake becomes a rule9
  3. 03·context engineering — fighting the rot9
  4. 04·long-horizon execution — loops, planning, splits, hooks10
  5. 05·the haas shift — harness-as-a-service and what to build vs buy9
open chapter