Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.
JavaScript agent-skillsagentic-codingai-agentsanthropicanthropic-claudebest-practicesclaudeclaude-aiclaude-codeclaude-code-guideclaude-code-hooksclaude-code-pluginsclaude-code-skillsclaude-code-tutorialclaude-code-workflowsguidelearn-claude-codemcpsubagentstutorial
checks: compare a warm-up's quotes with the earlier lesson it names, and count the capstone's task steps (#110)
Wesam Abousaide094e3ddc423
diff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/fixture.json b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/fixture.jsonnew file mode 100644index 0000000..dc64551--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "fail",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "A Worked example step with a from line: only a warm-up quotes an earlier lesson, so its quotes still come from its own page."+}diff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/.github/compat/learn.txtnew file mode 100644index 0000000..d72ca41--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/.github/compat/learn.txt@@ -0,0 +1,2 @@+b-1 docs/beginner/01-demo.md+b-2 docs/beginner/02-demo.mddiff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/01-demo.md b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/01-demo.mdnew file mode 100644index 0000000..e229fc3--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/01-demo.md@@ -0,0 +1,16 @@+# Demo lesson++<sub>**Beginner** · Lesson 1 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Type `/status`.+2. End the session with `/exit`.++## Your turn++1. Ask a question of your own.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/02-demo.md b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/02-demo.mdnew file mode 100644index 0000000..3054a89--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/docs/beginner/02-demo.md@@ -0,0 +1,15 @@+# Second demo++<sub>**Beginner** · Lesson 2 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Press `Shift+Tab` until the status bar reads plan mode.++## Your turn++1. Ask for a change.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-1.md b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-1.mdnew file mode 100644index 0000000..8dc7989--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-1.md@@ -0,0 +1,36 @@+---+lesson: b-1+title: "Demo lesson"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## steps++### W1 | Worked example step 1 of 2 | Look at /status+- tier: guided+- skill: status+- where: claude+- beat: do+- verify: self+- do: "Type `/status`."++### Y1 | Your turn step 1 of 1 | Your own question+- tier: hinted+- skill: ask+- where: claude+- beat: do+- verify: self+- goal: "Ask a question of your own."+- ask: Did Claude answer?+- right: Yes+- because: "Ask a question of your own."+- option: Not yet++## ladder++### `.practice/version.txt` holds the output of `claude --version`+- narrow "No `.practice/version.txt` yet": Which folder does the check name?+- bottom: "End the session with `/exit`."diff --git a/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-2.md b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-2.mdnew file mode 100644index 0000000..29e0941--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-from-outside-warmup/tree/practice/b-2.md@@ -0,0 +1,40 @@+---+lesson: b-2+title: "Second demo"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## warm-up++### R1 | Warm-up | Status+- tier: challenge+- skill: status+- from: b-1+- beat: ask+- ask: Which command shows the status?+- right: "`/status`"+- wrong: "`/exit`"+- because: "End the session with `/exit`."+- reveal: "Type `/status`."++## steps++### W1 | Worked example step 1 of 1 | Plan mode+- tier: guided+- skill: plan-mode+- from: b-1+- where: claude+- beat: do+- verify: self+- do: "Type `/status`."++### Y1 | Your turn step 1 of 1 | Your change+- tier: hinted+- skill: plan-ask+- where: claude+- beat: do+- verify: self+- goal: "Ask for a change."diff --git a/.github/scripts/fixtures/lesson-quotes-task-step-added/fixture.json b/.github/scripts/fixtures/lesson-quotes-task-step-added/fixture.jsonnew file mode 100644index 0000000..2b10da2--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-task-step-added/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "fail",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "The capstone gained a step in The task."+}diff --git a/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/.github/compat/learn.txtnew file mode 100644index 0000000..6275c5d--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/.github/compat/learn.txt@@ -0,0 +1 @@+b-capstone docs/beginner/capstone.mddiff --git a/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/docs/beginner/capstone.md b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/docs/beginner/capstone.mdnew file mode 100644index 0000000..56f7cb8--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/docs/beginner/capstone.md@@ -0,0 +1,13 @@+# Demo capstone++<sub>**Beginner** · Capstone · 30 to 60 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## The task++1. Save the version.+2. Plan the fix.+3. Commit the fix.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/practice/b-capstone.md b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/practice/b-capstone.mdnew file mode 100644index 0000000..e829ee4--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-task-step-added/tree/practice/b-capstone.md@@ -0,0 +1,15 @@+---+lesson: b-capstone+title: "Demo capstone"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## steps++### T1 | The task step 1 of 2 | Version+- tier: challenge+- skill: save-version+- where: terminal+- beat: do+- verify: self+- goal: "Save the version."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/fixture.json b/.github/scripts/fixtures/lesson-quotes-warmup-gone/fixture.jsonnew file mode 100644index 0000000..642d572--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "fail",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "A warm-up quotes text that is in its own lesson but no longer in the lesson its from line names."+}diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/.github/compat/learn.txtnew file mode 100644index 0000000..d72ca41--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/.github/compat/learn.txt@@ -0,0 +1,2 @@+b-1 docs/beginner/01-demo.md+b-2 docs/beginner/02-demo.mddiff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/01-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/01-demo.mdnew file mode 100644index 0000000..e229fc3--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/01-demo.md@@ -0,0 +1,16 @@+# Demo lesson++<sub>**Beginner** · Lesson 1 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Type `/status`.+2. End the session with `/exit`.++## Your turn++1. Ask a question of your own.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/02-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/02-demo.mdnew file mode 100644index 0000000..a3b7a79--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/docs/beginner/02-demo.md@@ -0,0 +1,15 @@+# Second demo++<sub>**Beginner** · Lesson 2 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Press `Shift+Tab` until the status bar reads plan mode.++## Your turn++1. Ask for a change.++## Check++Run the check. Type `/help`.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-1.md b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-1.mdnew file mode 100644index 0000000..8dc7989--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-1.md@@ -0,0 +1,36 @@+---+lesson: b-1+title: "Demo lesson"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## steps++### W1 | Worked example step 1 of 2 | Look at /status+- tier: guided+- skill: status+- where: claude+- beat: do+- verify: self+- do: "Type `/status`."++### Y1 | Your turn step 1 of 1 | Your own question+- tier: hinted+- skill: ask+- where: claude+- beat: do+- verify: self+- goal: "Ask a question of your own."+- ask: Did Claude answer?+- right: Yes+- because: "Ask a question of your own."+- option: Not yet++## ladder++### `.practice/version.txt` holds the output of `claude --version`+- narrow "No `.practice/version.txt` yet": Which folder does the check name?+- bottom: "End the session with `/exit`."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-2.md b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-2.mdnew file mode 100644index 0000000..cf980ac--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-gone/tree/practice/b-2.md@@ -0,0 +1,39 @@+---+lesson: b-2+title: "Second demo"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## warm-up++### R1 | Warm-up | Status+- tier: challenge+- skill: status+- from: b-1+- beat: ask+- ask: Which command shows the status?+- right: "`/status`"+- wrong: "`/exit`"+- because: "End the session with `/exit`."+- reveal: "Type `/help`."++## steps++### W1 | Worked example step 1 of 1 | Plan mode+- tier: guided+- skill: plan-mode+- where: claude+- beat: do+- verify: self+- do: "Press `Shift+Tab` until the status bar reads plan mode."++### Y1 | Your turn step 1 of 1 | Your change+- tier: hinted+- skill: plan-ask+- where: claude+- beat: do+- verify: self+- goal: "Ask for a change."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/fixture.json b/.github/scripts/fixtures/lesson-quotes-warmup-match/fixture.jsonnew file mode 100644index 0000000..4f2d6c7--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "pass",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "A warm-up's quotes match the earlier lesson its from line names, not the lesson that holds it."+}diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/.github/compat/learn.txtnew file mode 100644index 0000000..d72ca41--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/.github/compat/learn.txt@@ -0,0 +1,2 @@+b-1 docs/beginner/01-demo.md+b-2 docs/beginner/02-demo.mddiff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/01-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/01-demo.mdnew file mode 100644index 0000000..e229fc3--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/01-demo.md@@ -0,0 +1,16 @@+# Demo lesson++<sub>**Beginner** · Lesson 1 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Type `/status`.+2. End the session with `/exit`.++## Your turn++1. Ask a question of your own.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/02-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/02-demo.mdnew file mode 100644index 0000000..3054a89--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/docs/beginner/02-demo.md@@ -0,0 +1,15 @@+# Second demo++<sub>**Beginner** · Lesson 2 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Press `Shift+Tab` until the status bar reads plan mode.++## Your turn++1. Ask for a change.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-1.md b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-1.mdnew file mode 100644index 0000000..8dc7989--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-1.md@@ -0,0 +1,36 @@+---+lesson: b-1+title: "Demo lesson"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## steps++### W1 | Worked example step 1 of 2 | Look at /status+- tier: guided+- skill: status+- where: claude+- beat: do+- verify: self+- do: "Type `/status`."++### Y1 | Your turn step 1 of 1 | Your own question+- tier: hinted+- skill: ask+- where: claude+- beat: do+- verify: self+- goal: "Ask a question of your own."+- ask: Did Claude answer?+- right: Yes+- because: "Ask a question of your own."+- option: Not yet++## ladder++### `.practice/version.txt` holds the output of `claude --version`+- narrow "No `.practice/version.txt` yet": Which folder does the check name?+- bottom: "End the session with `/exit`."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-2.md b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-2.mdnew file mode 100644index 0000000..7630454--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-match/tree/practice/b-2.md@@ -0,0 +1,39 @@+---+lesson: b-2+title: "Second demo"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## warm-up++### R1 | Warm-up | Status+- tier: challenge+- skill: status+- from: b-1+- beat: ask+- ask: Which command shows the status?+- right: "`/status`"+- wrong: "`/exit`"+- because: "End the session with `/exit`."+- reveal: "Type `/status`."++## steps++### W1 | Worked example step 1 of 1 | Plan mode+- tier: guided+- skill: plan-mode+- where: claude+- beat: do+- verify: self+- do: "Press `Shift+Tab` until the status bar reads plan mode."++### Y1 | Your turn step 1 of 1 | Your change+- tier: hinted+- skill: plan-ask+- where: claude+- beat: do+- verify: self+- goal: "Ask for a change."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/fixture.json b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/fixture.jsonnew file mode 100644index 0000000..101d670--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "fail",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "A warm-up's from line names a lesson that learn.txt doesn't list."+}diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/.github/compat/learn.txtnew file mode 100644index 0000000..d72ca41--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/.github/compat/learn.txt@@ -0,0 +1,2 @@+b-1 docs/beginner/01-demo.md+b-2 docs/beginner/02-demo.mddiff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/01-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/01-demo.mdnew file mode 100644index 0000000..e229fc3--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/01-demo.md@@ -0,0 +1,16 @@+# Demo lesson++<sub>**Beginner** · Lesson 1 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Type `/status`.+2. End the session with `/exit`.++## Your turn++1. Ask a question of your own.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/02-demo.md b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/02-demo.mdnew file mode 100644index 0000000..3054a89--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/docs/beginner/02-demo.md@@ -0,0 +1,15 @@+# Second demo++<sub>**Beginner** · Lesson 2 of 5 · about 20 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## Worked example++1. Press `Shift+Tab` until the status bar reads plan mode.++## Your turn++1. Ask for a change.++## Check++Run the check.diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-1.md b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-1.mdnew file mode 100644index 0000000..8dc7989--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-1.md@@ -0,0 +1,36 @@+---+lesson: b-1+title: "Demo lesson"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## steps++### W1 | Worked example step 1 of 2 | Look at /status+- tier: guided+- skill: status+- where: claude+- beat: do+- verify: self+- do: "Type `/status`."++### Y1 | Your turn step 1 of 1 | Your own question+- tier: hinted+- skill: ask+- where: claude+- beat: do+- verify: self+- goal: "Ask a question of your own."+- ask: Did Claude answer?+- right: Yes+- because: "Ask a question of your own."+- option: Not yet++## ladder++### `.practice/version.txt` holds the output of `claude --version`+- narrow "No `.practice/version.txt` yet": Which folder does the check name?+- bottom: "End the session with `/exit`."diff --git a/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-2.md b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-2.mdnew file mode 100644index 0000000..bd59e4e--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-warmup-unlisted/tree/practice/b-2.md@@ -0,0 +1,39 @@+---+lesson: b-2+title: "Second demo"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## intro+- minutes: "about 20 minutes"++## warm-up++### R1 | Warm-up | Status+- tier: challenge+- skill: status+- from: b-9+- beat: ask+- ask: Which command shows the status?+- right: "`/status`"+- wrong: "`/exit`"+- because: "End the session with `/exit`."+- reveal: "Type `/status`."++## steps++### W1 | Worked example step 1 of 1 | Plan mode+- tier: guided+- skill: plan-mode+- where: claude+- beat: do+- verify: self+- do: "Press `Shift+Tab` until the status bar reads plan mode."++### Y1 | Your turn step 1 of 1 | Your change+- tier: hinted+- skill: plan-ask+- where: claude+- beat: do+- verify: self+- goal: "Ask for a change."diff --git a/.github/scripts/rules/lesson-quotes.mjs b/.github/scripts/rules/lesson-quotes.mjsindex 448c3c6..c91e9f3 100644--- a/.github/scripts/rules/lesson-quotes.mjs+++ b/.github/scripts/rules/lesson-quotes.mjs@@ -1,16 +1,17 @@// The practice template's learning app, `npm run learn`, quotes lessons word// for word, from one lesson file per lesson (learn/lessons/<id>.md in the// template); .github/compat/learn.txt lists them. In a lesson file, every-// double-quoted `- key: "…"` value is the lesson's own text. This rule fails-// when such a quote, the title, the Stamp or a step count no longer matches-// its lesson. It reads each line and the front matter as the app does-// (learn/lib/content.mjs and checks/frontmatter.mjs in the template), so no-// spacing, quoting or line ending the app accepts can hide a quote. It needs-// the template's lesson files: with LEARN_DIR set to a template checkout's-// learn/lessons folder, any mode reads them there; the weekly scheduled run-// fetches them from the template's main branch. A pull request run without-// LEARN_DIR stays offline and only warns when the change touches a listed-// lesson.+// double-quoted `- key: "…"` value is the lesson's own text, except in a+// warm-up block, whose `- from: <lesson>` line points its quotes at that+// earlier lesson's page. This rule fails when such a quote, the title, the+// Stamp or a step count no longer matches its lesson. It reads each line and+// the front matter as the app does (learn/lib/content.mjs and+// checks/frontmatter.mjs in the template), so no spacing, quoting or line+// ending the app accepts can hide a quote. It needs the template's lesson+// files: with LEARN_DIR set to a template checkout's learn/lessons folder, any+// mode reads them there; the weekly scheduled run fetches them from the+// template's main branch. A pull request run without LEARN_DIR stays offline+// and only warns when the change touches a listed lesson.import { existsSync, readFileSync } from 'node:fs';import { join, resolve } from 'node:path';import { readText } from '../lib/tree.mjs';@@ -106,7 +107,9 @@ function stepCount(text, name) {return count;}-function compare(lesson, page, rawPage, rawFile) {+// `pages` maps every listed lesson id to its page and text, for warm-ups;+// `listed` holds every listed lesson id.+function compare(lesson, page, rawPage, rawFile, pages, listed) {const pageText = rawPage.replace(/\r\n?/g, '\n');const file = rawFile.replace(/\r\n?/g, '\n');const problems = [];@@ -121,19 +124,34 @@ function compare(lesson, page, rawPage, rawFile) {if (title !== h1) say(`is titled "${title}", but the lesson's heading is "${h1}".`);const recounted = new Set();let heading = '(front matter)';+ let from = null;+ let warmup = false;for (const line of file.split('\n')) {const h = line.match(/^#{2,3} (.+)$/);if (h) {heading = h[1];- const counted = h[1].match(/(Worked example|Your turn) step \d+ of (\d+)/);+ from = null;+ warmup = /^R\d+ \| Warm-up \|/.test(h[1]);+ const counted = h[1].match(/(Worked example|Your turn|The task) step \d+ of (\d+)/);if (counted && !recounted.has(counted[1]) && stepCount(pageText, counted[1]) !== Number(counted[2])) {recounted.add(counted[1]);say(`counts ${counted[2]} steps in ${counted[1]}, but the lesson has ${stepCount(pageText, counted[1])}.`);}continue;}+ const f = line.match(/^- from: (\S+)$/);+ if (f) {+ if (!warmup) say(`has a from line in ${heading}, which isn't a warm-up: only a warm-up quotes an earlier lesson.`);+ else if (!listed.has(f[1])) say(`has a warm-up (${heading}) from ${f[1]}, which ${LIST} doesn't list.`);+ else from = f[1];+ continue;+ }const q = line.match(/^- [a-z-]+: (.+)$/)?.[1].trim().match(/^"(.*)"$/);- if (q && !body.includes(flat(q[1]))) say(`quotes "${q[1]}" (${heading}), which is no longer in the lesson.`);+ if (!q) continue;+ if (from) {+ const source = pages.get(from);+ if (source && !source.body.includes(flat(q[1]))) say(`quotes "${q[1]}" (${heading}, from ${source.page}), which is no longer in that lesson.`);+ } else if (!body.includes(flat(q[1]))) say(`quotes "${q[1]}" (${heading}), which is no longer in the lesson.`);}return problems;}@@ -152,12 +170,14 @@ export async function run(ctx) {};}const problems = [];+ const pages = new Map(lessons.filter((l) => existsSync(join(ctx.root, l.page)))+ .map((l) => [l.lesson, { page: l.page, body: flat(readText(ctx.root, l.page).replace(/\r\n?/g, '\n')) }]));for (const { lesson, page } of lessons) {if (!existsSync(join(ctx.root, page))) {problems.push(`${LIST} lists ${page}, which doesn't exist`);continue;}- problems.push(...compare(lesson, page, readText(ctx.root, page), await lessonFile(ctx.root, lesson)));+ problems.push(...compare(lesson, page, readText(ctx.root, page), await lessonFile(ctx.root, lesson), pages, new Set(lessons.map((l) => l.lesson))));}if (problems.length) return { status: 'fail', problems };return { status: 'pass', summary: `${lessons.length} lesson(s) in the app match their lesson files` };diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a7f6fd6..ba1db08 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -218,7 +218,7 @@ It needs Node.js LTS, git, Ruby (for YAML), jq (for the examples' smoke tests),| `static-validation` | JSON, YAML, skill or agent frontmatter, a workflow script or a shell script does not parse or lint || `inertness` | `examples/` holds a path Claude Code can load on its own, or a marketplace manifest not renamed to `dot-claude-plugin/`, or the repository root holds a `.claude-plugin/` folder || `smoke-tests` | An example's `test.sh` fails (only when the change touches `examples/`) |-| `lesson-quotes` | With `LEARN_DIR` set to a practice template checkout's `learn/lessons` folder, or in the weekly run: a quoted line, the title, the Stamp or a step count in a lesson file of the template's learning app no longer matches its lesson. On a pull request that changes a lesson listed in `learn.txt`, it only warns |+| `lesson-quotes` | With `LEARN_DIR` set to a practice template checkout's `learn/lessons` folder, or in the weekly run: a quoted line, the title, the Stamp or a step count in a lesson file of the template's learning app no longer matches its lesson (a warm-up's quotes, the earlier lesson its `from` line names). On a pull request that changes a lesson listed in `learn.txt`, it only warns |Each rule has known-bad fixtures under `.github/scripts/fixtures/`, one folder per case: `fixture.json` names the rule and the expected result, `tree/` holds the files, `base/` the state before a change, and `generate.mjs` writes anything that would be live Claude Code config if committed. If you change a rule, run the self-test too: