Project Programming Lessons Cheat Sheet

Sidebar

AI · Project Programming Lessons Cheat Sheet

How standalone programming lessons and their exercise chapters are generated. From rules/programming_lesson_rules.md: rules P8 and PL1-PL3. Python is the established case.

Prompts (PL1, PL2)

<language>: <topic>e.g. python: for loops. A standalone lesson, generated directly with no outline step, plus its exercise chapter.
... no ex / no exercisesLesson only.
... ex only / exercises onlyExercise chapter only, e.g. to add one to an older lesson.
matchingBased on the trailing phrase; small punctuation differences are fine. If genuinely ambiguous, Claude asks.
other languagesNo lesson exists yet, so Claude asks about storage before generating the first one.

Lesson structure, in order (P8)

1 .section-introIntro paragraph framing the topic.
2 .java-boxA comparison callout (for Python: coming from Java / JavaScript).
3 .fastapi-boxOnly when the topic genuinely connects to FastAPI or web work. Omitted otherwise.
4 .concept-gridCards for the core pieces, each with a short code example.
5 .example-blockRealistic, slightly longer examples in context.
6 .ref-tableQuick-reference table of syntax and operations.
7 .tip-boxClosing gotchas, specific traps rather than generic warnings.

Banner and styling

bannerPYTHON LESSON: <Topic>, a Level: line, then the Date Created / Date Updated line last.
self-containedThe lesson embeds its own <style> block, wrapper .py-lesson.
highlight classes.cm .kw .st .nu .fn .cl .op.
paletteBlue #4f8ef7, green #7ecfa0, amber #ffd580, purple #7c5cbf, red #f08080.
no numbersNo chapter or course numbers in the banner or filename.

Audience and tone

readerSomeone who already knows Java and JavaScript well.
approachActively contrast Python with both, rather than explaining Python alone.
sizeA big topic may take two lessons. Say so rather than cramming.
other languagesAdapt the comparison callout to the relevant background instead of forcing Java/JavaScript.

Files

python_lesson_<topic>.htmlIn programming/general-purpose-languages/python/python-lessons/; lowercase, underscores.
pdfs/Sibling folder for the PDFs.
PDF commandpy scripts/python/build_python_lesson_pdf.py <file.html> "<Title>"
solutions/Sibling folder for the exercise .txt solutions.

Exercise chapter (PL3)

python_lesson_<topic>_exercises.htmlA separate fragment, not appended to the lesson.
bannerPYTHON LESSON EXERCISES: <Topic> plus the date line.
stylingThe same lesson-family CSS as the paired lesson, so the two read as one unit.
at least 10 exercisesIn a .challenges-grid of .challenge-cards: title, problem, and a → Solution link opening a new tab.
depthMeaty problems native to the theme, not one-line fill-ins and not forced reskins of another exercise.
introA short .section-intro saying it is the companion set.

Solution files (PL3)

python_lesson_<topic>_exercise<N>.txtOne per exercise.
layoutTitle line, a ==== divider, the solution code, then Output: where relevant.
closing sectionWHY THIS WORKS AS AN ANSWER with a --- divider.
linksSolution links are rewritten for the live site by the build, whatever path the source has.
Snapshot
Snapshot of the rule files as at 2026-11-08, summarised by reading them. Nothing was run to test it. If this sheet and a rule file ever disagree, the rule file wins, and the sheet needs regenerating. The rule file also holds a backlog of exercise chapters still to be written; that list is not repeated here.