Lessons, manuals, cheat sheets, practice problems, projects, translations, fixes, outputs: all welcome. One contribution per pull request keeps reviews fast and lets contributor counts and credit work correctly.
AGENTS.md is the full operating manual for this repo, for people and for AI agents. Read it before your first pull request. This page is the short map: what you can add, where the deeper rules live, and which commands to run before you push.
site/build.js parses README.md, ROADMAP.md, and glossary/terms.md to
generate site/data.js. These patterns must stay intact in any pull request
that touches those files:
- Phase headers in either
### Phase N: Name \X lessons`form or thePhase N ... ...
` form. Copy an existing header line when you add one.X lessons... Description - Lesson tables with the column shape
| # | Lesson | Type | Lang |(or| # | Project | Combines | Lang |for capstone tables). TheLangcolumn accepts plain text (Python, TypeScript) or the legacy emoji flags (🐍 🟦 🦀 🟣 ⚛️); both are parser-equivalent. - Lesson rows link to the lesson folder:
[Title](phases/NN-phase/MM-lesson/). The site takes the lesson URL from that link. - ROADMAP status glyphs (
✅,🚧,⬚) on phase headers and lesson rows. Do not replace them with text. The parser keys off the exact characters.
Run node site/build.js after editing those files. git diff site/data.js
should show only the timestamp change if your edit was structural-safe. Then
restore it with git checkout -- site/data.js: CI rebuilds it on every push
to main, so it never goes in a pull request.
Every fenced code block needs a language tag. The tag sets how the site shows the block and what its Copy button copies:
| Tag | Use it for | The page shows |
|---|---|---|
bash, python, json and other languages |
commands or code that the reader runs or pastes | highlighted code with a Copy button |
console |
a terminal session: each command starts with $ , and output lines have no prompt |
the prompt, the command and the output in different colours. Copy copies the commands only |
text |
program output, logs and plain text | output with no Copy button |
ansi |
logs that keep their ANSI colour codes | coloured output with no Copy button |
Do not put a $ prompt in a bash block. Use console for a session, or
remove the prompts. Practice pages, cheat sheets and manuals are highlighted at
build time by site/lib/code.js. Lessons are highlighted in the browser and
use the same block markup.
Each lesson lives in phases/NN-phase-name/MM-lesson-name/:
| Path | What it holds |
|---|---|
docs/en.md |
Lesson documentation (required) |
code/ |
main.<lang> for each language in the Languages field |
code/tests/ |
5 or more tests, run with the language's stdlib runner |
quiz.json |
6 questions: 1 pre, 3 check, 2 post |
notebook/ |
Jupyter notebook for experimentation (optional) |
outputs/ |
Prompts, skills, or agents this lesson produces (if applicable) |
scripts/scaffold-lesson.sh <phase-dir> <lesson-slug> "<Title>" creates the
folders and a docs/en.md skeleton. LESSON_TEMPLATE.md
has the section order (The Problem, The Concept, Build It, Use It, Ship It,
Exercises). The Lesson contract in AGENTS.md has
the exact frontmatter (**Type:**, **Languages:**, **Prerequisites:**,
**Time:**), the quiz.json schema, and the rules for code/.
Then:
- Add the lesson row to
README.mdand its status row toROADMAP.md. - Add the lesson to a topic in
cheatsheets/topics.yaml. The cheat sheet check fails when a lesson has no topic (see Cheat sheets). - Add a term to
glossary/terms.mdwhen more than one lesson uses it.
Quizzes: keep the distractors comparable in length to the correct option, and
spread the correct answers across positions. python3 scripts/check_quiz_bias.py --check
and python3 scripts/debias_quizzes.py --check gate both in CI.
Math: write formulas as LaTeX ($...$ inline, $$...$$ for a block) outside
code. python3 scripts/find_plain_math.py --phase NN --list reports plain-text
math that could be LaTeX. node scripts/check_lesson_math.js --katex <path to katex.min.js> NN
renders every formula in a phase with the KaTeX build pinned in
site/lesson.html, and node --test site/test_lesson_math.js runs in CI.
Diagrams are Mermaid or SVG only, never ASCII or box-drawing art. A lesson
embeds a registered figure with a figure fence:
```figure
ctc-collapse
```
The figure ids are registered with LF.register in the site/figures-*.js
files. An isometric machine that follows the Build It steps is one entry in
MACHINES in site/figures-iso.js, embedded as:
```figure
iso-machine {"machine":"self-attention"}
```
node --test site/test_lesson_walkthrough.js covers the step sync.
node scripts/audit_lesson_figures.js mounts every lesson figure in Chrome at
desktop and phone width and must print TOTAL 0: no label overlaps another or
leaves the drawing, no text renders under 9 px (with 0.5 px allowed for rounding), and no drawing scrolls
sideways at desktop width. It needs CHROME_PATH and puppeteer-core on
NODE_PATH; --only <name> checks one figure and --shots <dir> saves a
picture of each failing one. The skills
in skills/ describe the house look: blueprint-figure for static SVG,
motion-figure for animated and interactive figures, isometric-explainer
for full machine pages, and course-style for colour tokens and prose rules.
A manual under manuals/<id>/ explains one subject at one pinned version.
manuals/AUTHORING.md is the contract: manual and
section shape, the markdown subset, figure kinds and colours, the capture kit,
and the prose limits. The short version:
- Every listing is cut from a capture file. The capture kit runs offline with
python3 capture/run.pyand checks for drift withpython3 capture/run.py --check, both from the manual directory, as declared inmanual.json. - Figures are drawn with the figure kit,
manuals/_shared/figkit.js. Save the source asfigures/src/<figure-id>.jsand runnode manuals/_shared/figkit.js build manuals/<id>. The audit fails when a committed SVG differs from its source. statusinmanual.jsonisdraftorready. A draft builds at/manual-<id>.htmlwithnoindexand is not listed. A ready manual is listed on the manuals page, gets a PDF on each release, and needsmanuals/<id>/README.md.- The build writes the manual page, one page per section under
/manual-<id>/, the manuals index, andsite/manuals-data.js. All of them are generated on deploy and never committed.
node --test site/test_manuals.js
node site/build-manuals.js --drafts
node scripts/audit_manuals.js --manual <id> # must report TOTAL 0The write-manual skill in skills/ walks through the same contract.
A cheat sheet is one topic in cheatsheets/<id>.md, with an evidence file in
cheatsheets/evidence/<id>.md and an entry in cheatsheets/topics.yaml.
cheatsheets/AUTHORING.md has the block types, the
fact rules, and the quality rubric.
node --test site/test_cheatsheets.js site/test_cheatsheet_topics.js scripts/cheatsheets/test_generate.js
node site/build-cheatsheets.js --check # coverage, facts, evidence, links, page count
node site/build-cheatsheets.js --check-quality # quality rubric on every sheet
node site/build-cheatsheets.js --status # missing and stale sheetsMost sheets are written by the generator. The Cheat sheets generate workflow
runs once a week, writes the missing and stale topics with
scripts/cheatsheets/generate.js, runs the gates, and opens a pull request for
review. It has cost guards: Haiku by default with one escalation to Sonnet,
Opus only on a manual run, at most 5 topics and 600,000 tokens per run in CI,
and no scheduled run while another cheat sheet pull request is open. To write
one sheet locally, set ANTHROPIC_API_KEY, install @anthropic-ai/sdk, and
run node scripts/cheatsheets/generate.js <id>. Pass --limit and
--token-budget to cap a local run.
- A practice problem lives in
practice/<id>/. Read practice/AUTHORING.md, then runpython3 scripts/practice/validate.py <id> --writeandpython3 scripts/practice/validate.py. ThePractice problems generateworkflow drafts problems from lesson paths on a manual run, with the same model choice and token budget inputs as the cheat sheet generator. - A project lives in
projects/<id>/. Read projects/AUTHORING.md, then runpython3 scripts/project_test.py <id> --all --solution --strictandnode site/build-projects.js --strict. Unbuilt ideas go inprojects/roadmap.jsonunderplanned.
English is canonical. Read docs/i18n.md before you translate.
- Lesson translations are never committed to
main. They live on thetranslationsbranch ati18n/<lang>/phases/<phase>/<lesson>/docs/<lang>.md. Do not addzh.mdor other locale files next todocs/en.md. - Automatic languages have
ci: trueinlanguages.json. Thetranslateworkflow (.github/workflows/translate.yml) translates their lessons with NLLB-200 inside the runner after each push to main that changes adocs/en.md. Do not hand-edit those files; fix the English instead. - Contributor-maintained languages have
site: true, such aszh-TW. Send reviewed lesson translations as a pull request against thetranslationsbranch. The workflow keeps them and does not overwrite them when the English changes. - The freshness table in each translate run summary lists current, stale,
missing, and orphaned lessons per language. For a contributor-maintained
language, the stale rows are the translations to update after an English
fix. Run it locally with
git fetch origin translations:refs/remotes/origin/translations && python3 scripts/translation_freshness.py. - README translations are full documents on
mainati18n/<lang>/README.md. When you change the English README, update every locale and runpython3 scripts/build_readme_i18n.py --checkandpython3 scripts/test_audit_readme_locales.py. - To propose a new language, open a pull request that adds its entry to
languages.jsonwith its FLORES-200nllbcode, as Add a language describes. A new README language must be a complete translation and joinsFULL_LOCALESinscripts/audit_readme_locales.py. Open an issue first if you are unsure whether it should be automatic or contributor-maintained.
Certification lessons and manuals stay English-only.
If a lesson should produce a reusable prompt, skill, agent, or MCP server:
- Create it in the lesson's
outputs/folder - Add a reference in the top-level
outputs/index
Prompt format:
---
name: prompt-name
description: What this prompt does
phase: 14
lesson: 01
---
[System prompt or template here]Skill format:
---
name: skill-name
description: What this skill teaches
version: 1.0.0
phase: 14
lesson: 01
tags: [agents, loops]
---
[Skill content here]The site is static. Build it and run its tests before you push:
npm install --no-audit --no-fund
node site/build.js
node --test site/test_*.jsnpm install gets the pinned build tools from package.json: Shiki for code
highlighting and Pagefind for the search index. Without them the build still
runs: code blocks fall back to the regex highlighter and the search index is
skipped. Do not commit package-lock.json. node site/build-search.js writes
the search index to site/pagefind/ after the manuals build.
site/build.js writes site/data.js and many other generated files
(sitemaps, site/langs.js, the agent pages, hubs, and more; .gitignore
lists them). Never commit site/data.js; CI rebuilds it on every push to
main. A new static page needs an entry in PAGES in lib/og-cards.js for
its social card, as Social cards describes.
- Fix code that doesn't run
- Improve explanations
- Add better diagrams
- Update outdated information
- Code must run. Every code file should execute without errors with the listed dependencies.
- No inline comments in code. The only comment is the short header that names the lesson doc and its spec sources. Use the docs for explanation.
- Stdlib first. Use only the dependencies on the allowlist.
- Best language for the job. Don't force Python where TypeScript or Rust is the better choice.
- Build from scratch first. Always implement the concept from first principles before showing the framework version.
- Keep it practical. Theory serves practice, not the other way around.
- No AI slop. Write like a human. Be direct. Cut filler.
Run the checks for what you changed. CI runs the same ones.
python3 scripts/audit_lessons.py # every lesson; add --phase N for one phase
python3 scripts/run_lesson_tests.py --phase NN-phase-name # each lesson's own tests
python3 scripts/audit_certifications.py # when certifications/ changes
node --test site/test_manuals.js && node scripts/audit_manuals.js --manual <id> # manuals
node site/build-cheatsheets.js --check && node site/build-cheatsheets.js --check-quality # cheat sheets
node site/build.js && node --test site/test_*.js # siterun_lesson_tests.py skips lessons whose tests need a scientific dependency
you have not installed, and runs the rest.
Sponsorship changes are not accepted through contributor pull requests. Sponsor names, logos, links, and tier assignments are managed by the maintainer. See SPONSORS.md for sponsorship enquiries.
- Fork the repository
- Create a feature branch (
git checkout -b add-lesson-phase3-gradient-descent) - Make your changes
- Run the checks for what you changed
- Submit a pull request with a clear description
Size commits by judgment, not by a fixed count. A small fix is 1 or 2 commits.
A large change is a few logical commits, each one a step a reviewer can read
on its own. Use conventional subjects of 72 characters or less, such as
feat(phase-NN/MM): <slug>, feat(manual/<id>): <section slug>, or
fix(site): <what>. The body explains why.
Do not force-push a branch that has open review comments. A force-push
detaches them. To catch up with main, merge it in:
git fetch origin main && git merge --no-edit origin/main.
CodeRabbit and Devin review every pull request. Answer every thread they open: fix the finding and say what changed, or reply with the reason it does not apply. Then resolve the thread. A pull request with unanswered bot threads is not ready for a maintainer review.
See CODE_OF_CONDUCT.md. Be kind, be helpful, be constructive.
- Direct prose. Cut filler. Match the manual's tone, not marketing copy.
- No decorative emojis in headings. Lang column emoji flags are the one exception and only because the parser maps them.
- Code runs as-is with the dependencies listed in the lesson.
- Build from scratch first, framework second.