name: tutor-handouts
description: >
Generate a university-style course pack (PDF lecture handouts, programming-assignment
writeups, conceptual problem sets, topic cheatsheets, a capstone project, and a
one-page syllabus) plus matching graded programming-exercise scaffolds (CUDA / Triton /
PyTorch starters, a LeetGPU-style autograder harness, and gated solutions for hardest
exercises) from a StudyVault/ produced by cuda-tutor-setup or triton-tutor-setup.
Visual style modeled on CMU 15-418, Stanford CS149, MIT 6.172, OLCF CUDA Training
Series, and AlphaGPU LeetGPU challenges. Emits .tex + Makefile; compiles via
latexmk + pdflatex if available, otherwise gracefully falls back to source-only.
Use when the user wants to produce printable lecture handouts, programming assignments,
problem sets, an autograder, or a complete course pack from an existing StudyVault, or
says things like "make handouts for my StudyVault", "generate the course pack",
"build programming exercises for CUDA", "/tutor-handouts".
Tutor Handouts — Course Pack Generator
Consumes an existing StudyVault/ and produces a sibling Coursepack/ containing
printable lecture handouts, programming assignment writeups, autograded programming
exercises, cheatsheets, a final-project handout, and a one-page syllabus — all using
CMU 15-418 / Stanford CS149 / MIT 6.172-grade typography (LaTeX article 11pt,
lmodern, listings, fancyhdr, booktabs; no commercial fonts, no Pygments).
Prerequisite: Existing StudyVault
This skill requires a pre-built StudyVault in CWD. Run cuda-tutor-setup or
triton-tutor-setup first if no StudyVault/ exists. The skill auto-detects which
stack the vault contains from 00-Dashboard/MOC.md frontmatter.
If no
StudyVault/is found, tell the user: "No StudyVault found. Runcuda-tutor-setuportriton-tutor-setupfirst to generate one, then re-run this skill."
CWD Boundary Rule
NEVER access files outside CWD. All vault reads and Coursepack writes MUST stay within CWD and its subdirectories. No absolute paths in any emitted file.
Output Layout (canonical)
Coursepack/
├── Makefile # Top-level: make all / handouts / exercises / clean
├── README.md # Index of every artifact + how to build
├── Syllabus/
│ ├── syllabus.tex # One-page course syllabus
│ └── syllabus.pdf # (if latexmk available)
├── Handouts/
│ ├── _common/ # Shared LaTeX assets
│ │ ├── handout.cls # H1/H3/H5 base class
│ │ ├── cheatsheet.cls # H2 landscape 2-col
│ │ ├── problemset.cls # H4 short-answer
│ │ ├── solution.cls # E2 instructor variant
│ │ └── commonheader.sty # Shared typography + palette
│ ├── 01-cuda-kernels/ # One folder per vault topic
│ │ ├── lecture-handout.tex # H1 — 4–8 pp
│ │ ├── cheatsheet.tex # H2 — 1–2 pp
│ │ ├── problemset.tex # H4 — 2–4 pp
│ │ ├── assignment-01-vector-add.tex # H3 — 8–15 pp (1:1 with E1 folder)
│ │ ├── assignment-02-tiled-matmul.tex
│ │ └── ...
│ ├── 02-cutlass/ ...
│ └── final-project.tex # H5 — cross-topic capstone
└── Exercises/
├── _harness/ # Shared autograder
│ ├── challenge_base.py # Abstract base class
│ └── runner.py # Discovers and runs all challenges
├── 01-cuda-kernels/
│ ├── 01-vector-add/ # ★☆☆ Easy
│ │ ├── README.md # 10-section spec, mirrors H3
│ │ ├── challenge.py # Reference impl + test cases
│ │ ├── starter/{starter.cu, starter.triton.py, starter.pytorch.py}
│ │ ├── reference/{reference.cu, reference.triton.py, reference.pytorch.py}
│ │ └── Makefile
│ └── 03-cp-async-pipeline/ # ★★★ Hard — solutions gated
│ ├── starter/
│ ├── Solutions/{SOLUTION_KEY.md, reference.cu, ...}
│ └── Makefile
└── ...
Skill Flags (optional, parse from user message)
| Flag | Default | Values | Effect |
|---|---|---|---|
--scope |
full |
full, handouts-only, exercises-only, topic:{slug}, minimal |
Limits emission scope. minimal = 1 H1 + 1 H3 per topic for fast sanity check |
--palette |
generic-blue |
generic-blue, cmu-red, stanford-cardinal, mit-cardinal, berkeley-blue |
Switches commonheader.sty color block |
--emit-solutions |
hard |
none, hard, all |
Whether to render E2 solution PDFs into _instructor/ subdir |
--build |
auto |
auto, force, skip |
auto = build if latexmk present; force = fail loudly if missing; skip = emit .tex only |
--frameworks |
cuda,triton |
comma-list of cuda, triton, pytorch |
Which starter/reference variants to emit per exercise |
--exercises-per-topic |
auto (2–3 based on concept count) |
integer 1–5 | Caps exercise count per topic |
Hard Invariants (non-negotiable)
These have stable IDs used in the quality checklist:
- INV-1 (CWD boundary) — All reads/writes stay inside
<CWD>/StudyVault/and<CWD>/Coursepack/. No absolute paths emitted. - INV-2 (No commercial fonts) —
lmodernonly. No Minion Pro, no Adobe fonts. - INV-3 (No minted) — Use
listings. Avoids Python/Pygments dependency. - INV-4 (latexmk optional) — Skill emits
.tex + Makefileeven without latexmk. - INV-5 (Identifier preservation) — CUDA / Triton identifiers (
cp.async.bulk,tl.dot,cute::Layout,ncclAllReduce,nvshmem_quiet,tl.program_id) appear verbatim in English regardless of{LANG}. - INV-6 (Idempotence) — Re-running on the same vault produces byte-identical output. Hand-edited
Solutions/SOLUTION_KEY.mdfiles preserved via generated-at timestamp + user prompt before clobber. - INV-7 (Anti-AI-slop) — Every handout cites named primary sources, uses code blocks for API names, includes concrete numeric examples, banned fluff phrases per
references/content-rules/handout-content-rules.md. - INV-8 (Build verification) — TH8 MUST
latexmkevery emitted.texif--build != skip. Failures are NOT silently swallowed.
Workflow (phases TH0–TH8)
Phase TH0: Detect
- Scan CWD for
StudyVault/. If missing, tell user to run*-tutor-setupfirst. - Read
StudyVault/00-Dashboard/MOC.mdfrontmatter → determine taxonomy:topic: dashboard+ topics includecuda-kernels→ CUDA stacktopic: dashboard+ topics includetriton-basics→ Triton stack- Other → generic stack (use vault's topic slugs as-is)
- Read
Pitfall-Index.mdto discover available pitfalls per topic. - Detect
{LANG}from user message (prose language). Code/identifiers stay English. - Probe toolchain:
latexmk --versionandpdflatex --versionandnvcc --version.
Phase TH1: Scope
AskUserQuestion with these options:
- Topics: all topics (default) / per-topic subset
- Artifact scope: full bundle (default) / handouts-only / exercises-only / minimal
- Palette: generic-blue (default) / cmu-red / stanford-cardinal / mit-cardinal / berkeley-blue
- Solutions: gated for ★★★ only (default) / all / none
Phase TH2: Bootstrap
- Create
Coursepack/,Coursepack/Handouts/_common/,Coursepack/Exercises/_harness/,Coursepack/Syllabus/. - Copy
references/latex/*.clsandreferences/latex/commonheader.stytoCoursepack/Handouts/_common/. - Copy
references/exercise-templates/challenge_base.pytoCoursepack/Exercises/_harness/. - Copy
references/exercise-templates/runner.template.py→Coursepack/Exercises/_harness/runner.py. - Emit
Coursepack/.gitignorelisting*.aux *.log *.pdf *.fls *.fdb_latexmk *.synctex.gz build/.
Phase TH3: Per-topic handouts
For each topic from TH0 (one at a time — drop prior topic from working memory before reading next):
- Read
StudyVault/{NN-topic}/Overview.md,Concepts/*.md,Pitfalls.md,Milestones.md. - Read
references/content-rules/handout-content-rules.md. - Generate
Coursepack/Handouts/{NN-topic}/lecture-handout.texusinghandout.clswithlectureoption. - Generate
cheatsheet.texusingcheatsheet.cls. - Generate
problemset.texusingproblemset.clswith 6–10 conceptual short-answer problems.
Per-handout content checklist (enforced inline):
- 10-section template (Overview, Background, Task, Starter Code, Correctness, Performance, Submission, Rubric, Writeup, Due) for H3
- 1+ named primary citation per page
- 1+ concrete numeric example per page
- No banned fluff phrases (see
content-rules/handout-content-rules.md) - Header
% Generated by tutor-handouts at {ISO8601} — manual edits will be lost on re-run
Phase TH4: Programming assignments
- Read
references/exercise-banks/{cuda|triton}-exercise-bank.md. - For each topic, select 2–3 highest-priority entries that match the topic's concept-tracker contents.
- Generate H3
assignment-{N}-{slug}.texintoCoursepack/Handouts/{NN-topic}/usinghandout.clswithprogrammingoption. - Each H3 MUST reference the paired E1 folder by relative path in its Starter Code section.
Phase TH5: Exercise scaffolds
For each H3 from TH4, emit the matching E1 folder under Coursepack/Exercises/{NN-topic}/{NN-slug}/:
README.md— mirrors H3 sections in compressed form (≤2 lines/section)challenge.py— instantiated fromreferences/exercise-templates/challenge.template.pywith reference_impl + test cases from the exercise bank entrystarter/starter.cu,starter/starter.triton.py, (optional)starter/starter.pytorch.py— based on--frameworksflag; each MUST compile/import out of the box but not solve; ≥3 numberedFIXME N: ...markers per starterreference/reference.cu,reference/reference.triton.py, (optional)reference/reference.pytorch.py— full working solutions (for ★☆☆ and ★★☆)- For ★★★ exercises: emit
Solutions/instead ofreference/, plusSolutions/SOLUTION_KEY.md(1 para insight + 1 para common mistakes) Makefile— nvcc-direct build (make starter,make reference,make test,make bench,make clean)
Phase TH6: Capstone + syllabus
- Read
StudyVault/00-Dashboard/Prereq-DAG.mdto identify cross-topic interactions. - Generate
Coursepack/Handouts/final-project.tex(H5) — a multi-topic capstone (e.g., "NCCL-replacement using NVSHMEM" for CUDA; "FlashAttention with custom compiler pass" for Triton). - Generate
Coursepack/Syllabus/syllabus.tex(M1) — one-page table of contents + due-date grid + grading-weight table linking H1–H5.
Phase TH7: Solutions + orchestrator
- If
--emit-solutions={hard,all}: re-render each matching H3 with\solutionstrueintoCoursepack/Handouts/{NN-topic}/_instructor/{slug}-solution.texusingsolution.cls. - Emit
Coursepack/Makefile(M2) — orchestrator with targetsall,handouts,syllabus,exercises,test-exercises,clean. - Emit
Coursepack/README.md(M3) — index of every emitted artifact with relative links + "How to build" section + skill version.
Phase TH8: Build + self-review
- If
--build != skipANDlatexmkavailable:cd Coursepack && make all -k 2>&1 | tee build.log. - Parse
build.logper-file:- PASS = exit 0, no
Overfull/Underfull, PDF > 1 KB - WARN = exit 0 with overfull/underfull or missing refs
- FAIL = non-zero exit or missing PDF
- PASS = exit 0, no
- Run self-review against
references/quality-checklist.md(50+ gates). - Report results to user in the format documented in
references/handout-workflow.md.
Pairing with cuda-tutor / triton-tutor
After Coursepack/ is built, tell the user:
"Course pack built at
./Coursepack/. Usecuda-tutor(ortriton-tutor) in the same directory to drill the concepts from your StudyVault. Runcd Coursepack && make test-exercisesto verify the autograder harness."
Reference Files (lazy-loaded)
| File | Loaded in phase | Purpose |
|---|---|---|
references/handout-workflow.md |
TH0–TH8 | Procedural detail of every phase |
references/exercise-workflow.md |
TH4–TH5 | E1–E4 emission detail |
references/quality-checklist.md |
TH8 | 50+ self-review gates |
references/style-guide.md |
TH2, TH3 | Typography + palette swap |
references/content-rules/handout-content-rules.md |
TH3, TH4, TH6 | Per-section length budgets + anti-slop rules |
references/content-rules/exercise-content-rules.md |
TH5 | FIXME conventions + test-case sizing |
references/content-rules/rubric-rubric.md |
TH3, TH4 | How to write a non-vague grading rubric |
references/exercise-banks/cuda-exercise-bank.md |
TH4 (CUDA stack only) | 15 CUDA exercise seeds |
references/exercise-banks/triton-exercise-bank.md |
TH4 (Triton stack only) | 15 Triton exercise seeds |
references/latex/{handout,cheatsheet,problemset,solution}.cls, commonheader.sty |
TH2 (copied verbatim to Coursepack/Handouts/_common/) |
LaTeX document classes |
references/exercise-templates/* |
TH2 + TH5 | challenge_base.py, runner, starter/reference/Makefile templates |
Important Reminders
- READ
references/handout-workflow.mdbefore starting TH3 for per-phase detail. - READ
references/content-rules/handout-content-rules.mdbefore generating ANY handout prose. - READ
references/content-rules/exercise-content-rules.mdbefore generating ANY exercise scaffold. - READ
references/exercise-banks/{stack}-exercise-bank.mdto pick exercises in TH4. - READ
references/quality-checklist.mdin TH8 before reporting completion. - ALWAYS emit
Coursepack/.gitignoreto prevent accidental commit of*.aux *.log build/. - NEVER hand-write a
.clsfile — copy verbatim fromreferences/latex/. - NEVER emit absolute paths in any generated file.
- NEVER use
minted, onlylistings. - NEVER require commercial fonts;
lmodernis the only mandatory font. - For idempotence: every emitted file gets a
% Generated by tutor-handouts at {ISO8601}header; on re-run, hand-editedSOLUTION_KEY.mdfiles trigger a user prompt before clobber.