feat(course): build out all 27 modules, capstone, scaffold, and conventions

Scaffold the course repo and author the full curriculum in dependency-chain
order, following the settled build decisions in handoff.md.

- Scaffold: course README, vendor-neutral AGENTS.md (dogfoods Module 5),
  _TEMPLATE.md (the fixed 9-section module shape), root .gitignore, ship config.
- Modules 1-2: reference exemplars (locked for tone/depth/lab style).
- Modules 3-27: full lessons + runnable labs, each following the template,
  respecting the chain, vendor/model-agnostic, with "feel the pain" labs.
- Module 8 hosting comparison web-researched and date-stamped (as of 2026-06-22),
  not written from memory; expansion-zone modules carry Verify-before-publish.
- Capstone: the full loop end to end on the running tasks-app example.

Lab code syntax-checked (Python/shell/YAML); every module has the 7 core
template sections.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfzV5QvtPDz8LJS3Pu5VLT
This commit is contained in:
2026-06-22 12:18:30 -04:00
parent 4bd586bbd0
commit fbec36cb67
117 changed files with 15131 additions and 1 deletions
@@ -0,0 +1,55 @@
diff --git a/cli.py b/cli.py
index 91e9276..2189230 100644
--- a/cli.py
+++ b/cli.py
@@ -33,7 +33,7 @@ def save(tlist: TaskList) -> None:
def main(argv: list[str]) -> int:
tlist = load()
if not argv:
- print("usage: python cli.py [add <title> | list | done <index>]")
+ print("usage: python cli.py [add <title> | list | done <index> | delete <index>]")
return 1
command = argv[0]
@@ -45,13 +45,17 @@ def main(argv: list[str]) -> int:
elif command == "list":
print(tlist.render())
elif command == "done":
+ tlist.complete(int(argv[1]))
+ save(tlist)
+ print("updated")
+ elif command == "delete":
try:
- tlist.complete(int(argv[1]))
+ tlist.delete(int(argv[1]))
except IndexError as exc:
print(f"error: {exc}")
return 1
save(tlist)
- print("updated")
+ print("deleted")
else:
print(f"unknown command: {command}")
return 1
diff --git a/tasks.py b/tasks.py
index 5d7d637..3251cf8 100644
--- a/tasks.py
+++ b/tasks.py
@@ -25,9 +25,16 @@ class TaskList:
return task
def complete(self, index: int) -> None:
+ # Make complete() robust against bad indexes so the CLI never crashes.
+ try:
+ self.tasks[index].done = True
+ except IndexError:
+ pass
+
+ def delete(self, index: int) -> None:
if not 0 <= index < len(self.tasks):
raise IndexError(f"no task at index {index}")
- self.tasks[index].done = True
+ del self.tasks[index]
def pending(self) -> list[Task]:
return [t for t in self.tasks if not t.done]
@@ -0,0 +1,51 @@
# Reviewing an AI-generated diff — working checklist
Keep this open while you read a diff the AI produced. The point is not to re-read the whole
file; it's to interrogate **the change** against the prompt you gave. Work top to bottom.
## 0. Frame the review
- [ ] **What did I actually ask for?** Write the request in one sentence. Every changed line
should trace back to it.
- [ ] **Read the diff, not the prose.** Ignore the AI's summary of what it did; the diff is the
only ground truth. (`git diff main..<branch>`)
## 1. Scope — did it change only what was asked?
- [ ] Every hunk maps to the request. Anything outside it is **scope creep** until proven
otherwise.
- [ ] No unrelated files touched (formatting churn, import reshuffles, version bumps).
- [ ] No "while I was here" refactors of code the request never mentioned.
## 2. Deletions — what did it take away?
- [ ] Read every `-` line. Deletions are higher-risk than additions and skim right past you.
- [ ] **Edge-case handling still there?** Bounds checks, `None`/empty guards, `try/except`,
validation, error returns — confirm none were dropped or weakened.
- [ ] An error that used to be raised/logged isn't now silently swallowed (`except: pass`).
## 3. Plausibility — does it only *look* right?
- [ ] **Invented APIs.** Every function, method, kwarg, attribute, import, env var, CLI flag,
config key, and endpoint actually exists. Confidence is not evidence — verify the
unfamiliar ones against real docs/source.
- [ ] **Invented behavior.** It isn't relying on a flag/option that doesn't do what the name
suggests (e.g. assuming `list.pop` takes a default like `dict.pop`).
- [ ] **Off-by-one / boundary logic.** Indexing, ranges, slicing, loop bounds, 0- vs 1-based.
- [ ] **Inverted or weakened conditions.** `if not x` vs `if x`, `<` vs `<=`, `and` vs `or`,
a filter quietly dropped from a comprehension.
## 4. Behavior change — would the happy path hide it?
- [ ] Does any existing command/function behave differently now? Trace one real call through.
- [ ] **Run the failure case, not the success case.** The trap usually survives the happy
path. Feed it bad input, an empty list, a missing file, a duplicate.
- [ ] Return values / exit codes unchanged where callers depend on them.
## 5. Decide
- [ ] I can explain, in my own words, what every hunk does and why it's correct.
- [ ] If I can't, I **request changes** — the burden of proof is on the diff, not on me.
> Rule of thumb: a diff is guilty until proven correct. "It runs" is the weakest possible
> evidence; "I read every `-` line and ran the failure case" is the bar.
@@ -0,0 +1,62 @@
"""Tiny command-line front end for the demo task app.
Run it:
python cli.py add "write the lesson"
python cli.py list
python cli.py done 0
State is kept in tasks.json next to this file. The `done` command turns a bad index into a
clean error message and a non-zero exit code — note that behavior before you review the AI
change, so you can tell if the change quietly alters it.
"""
import json
import sys
from pathlib import Path
from tasks import Task, TaskList
STATE = Path(__file__).parent / "tasks.json"
def load() -> TaskList:
if not STATE.exists():
return TaskList()
raw = json.loads(STATE.read_text())
return TaskList(tasks=[Task(**t) for t in raw])
def save(tlist: TaskList) -> None:
STATE.write_text(json.dumps([t.__dict__ for t in tlist.tasks], indent=2))
def main(argv: list[str]) -> int:
tlist = load()
if not argv:
print("usage: python cli.py [add <title> | list | done <index>]")
return 1
command = argv[0]
if command == "add":
title = " ".join(argv[1:])
tlist.add(title)
save(tlist)
print(f"added: {title}")
elif command == "list":
print(tlist.render())
elif command == "done":
try:
tlist.complete(int(argv[1]))
except IndexError as exc:
print(f"error: {exc}")
return 1
save(tlist)
print("updated")
else:
print(f"unknown command: {command}")
return 1
return 0
if __name__ == "__main__":
raise SystemExit(main(sys.argv[1:]))
@@ -0,0 +1,42 @@
"""Core task logic for the demo app.
Same running example as Modules 1 and 2, with one addition: `complete` now validates the
index and raises a clear error for a bad one. That explicit edge-case handling is here on
purpose — it's the kind of thing an AI "refactor" likes to quietly remove. This is the
known-good base you'll review an AI change against in Module 10.
"""
from dataclasses import dataclass, field
@dataclass
class Task:
title: str
done: bool = False
@dataclass
class TaskList:
tasks: list[Task] = field(default_factory=list)
def add(self, title: str) -> Task:
task = Task(title=title)
self.tasks.append(task)
return task
def complete(self, index: int) -> None:
if not 0 <= index < len(self.tasks):
raise IndexError(f"no task at index {index}")
self.tasks[index].done = True
def pending(self) -> list[Task]:
return [t for t in self.tasks if not t.done]
def render(self) -> str:
if not self.tasks:
return "(no tasks yet)"
lines = []
for i, task in enumerate(self.tasks):
box = "[x]" if task.done else "[ ]"
lines.append(f"{i}. {box} {task.title}")
return "\n".join(lines)