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
chore: count Tear down steps in the lesson-quotes check (#139)
Wesam Abousaida813e7e88fde
diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-match/fixture.json b/.github/scripts/fixtures/lesson-quotes-teardown-match/fixture.jsonnew file mode 100644index 0000000..9e942eb--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-match/fixture.json@@ -0,0 +1,8 @@+{+ "rule": "lesson-quotes",+ "expect": "pass",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "The capstone's Tear down step count matches the numbered steps under its Tear down heading, and a Your turn part heading is not counted."+}diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/.github/compat/learn.txtnew file mode 100644index 0000000..a662e84--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/.github/compat/learn.txt@@ -0,0 +1 @@+a-capstone docs/advanced/capstone.mddiff --git a/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/docs/advanced/capstone.md b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/docs/advanced/capstone.mdnew file mode 100644index 0000000..b4bd101--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/docs/advanced/capstone.md@@ -0,0 +1,17 @@+# Demo capstone++<sub>**Advanced** · Capstone · 60 to 90 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## The task++1. Save the version.+2. Plan the fix.++## Check++Run the check.++## Tear down++1. Delete the workflow.+2. Delete the secret.diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/practice/a-capstone.md b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/practice/a-capstone.mdnew file mode 100644index 0000000..edeb994--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-match/tree/practice/a-capstone.md@@ -0,0 +1,36 @@+---+lesson: a-capstone+title: "Demo capstone"+stamp: "Verified against Claude Code v2.1.285 (stable) on 2026-10-05"+---++## steps++### Y1 | Your turn part 1 of 3 | Warm the repo+- tier: guided+- skill: save-version+- where: terminal+- beat: do+- verify: self+- goal: "Save the version."++### T1 | The task step 1 of 2 | Version+- tier: challenge+- skill: save-version+- where: terminal+- beat: do+- verify: self+- goal: "Save the version."++### C | Check | Run the check+- beat: do+- verify: self+- goal: "Run the check."++### D1 | Tear down step 1 of 2 | Workflow+- tier: challenge+- skill: remove-workflow+- where: terminal+- beat: do+- verify: self+- goal: "Delete the workflow."diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-step-added/fixture.json b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/fixture.jsonnew file mode 100644index 0000000..2dd6762--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/fixture.json@@ -0,0 +1,11 @@+{+ "rule": "lesson-quotes",+ "expect": "fail",+ "env": {+ "LEARN_DIR": "practice"+ },+ "about": "The capstone gained a Tear down step, so the lesson file's Tear down count is wrong.",+ "output": [+ "a-capstone\\.md counts 2 steps in Tear down, but the lesson has 3\\."+ ]+}diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/.github/compat/learn.txt b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/.github/compat/learn.txtnew file mode 100644index 0000000..a662e84--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/.github/compat/learn.txt@@ -0,0 +1 @@+a-capstone docs/advanced/capstone.mddiff --git a/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/docs/advanced/capstone.md b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/docs/advanced/capstone.mdnew file mode 100644index 0000000..72ae41d--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/docs/advanced/capstone.md@@ -0,0 +1,18 @@+# Demo capstone++<sub>**Advanced** · Capstone · 60 to 90 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-05</sub>++## The task++1. Save the version.+2. Plan the fix.++## Check++Run the check.++## Tear down++1. Delete the workflow.+2. Delete the secret.+3. Delete the key.diff --git a/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/practice/a-capstone.md b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/practice/a-capstone.mdnew file mode 100644index 0000000..6d94cfc--- /dev/null+++ b/.github/scripts/fixtures/lesson-quotes-teardown-step-added/tree/practice/a-capstone.md@@ -0,0 +1,28 @@+---+lesson: a-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."++### C | Check | Run the check+- beat: do+- verify: self+- goal: "Run the check."++### D1 | Tear down step 1 of 2 | Workflow+- tier: challenge+- skill: remove-workflow+- where: terminal+- beat: do+- verify: self+- goal: "Delete the workflow."diff --git a/.github/scripts/rules/lesson-quotes.mjs b/.github/scripts/rules/lesson-quotes.mjsindex 37ca022..ae1f798 100644--- a/.github/scripts/rules/lesson-quotes.mjs+++ b/.github/scripts/rules/lesson-quotes.mjs@@ -118,7 +118,8 @@ async function lessonFile(root, lesson) {return res.text();}-// The number of top-level numbered steps under a `## <name>` heading.+// The number of top-level numbered steps under a `## <name>` heading: a+// lesson's Worked example, Your turn, The task, or a capstone's Tear down.function stepCount(text, name) {let inside = false;let count = 0;@@ -179,7 +180,9 @@ function compare(lesson, page, rawPage, rawFile, pages, listed) {heading = h[1];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+)/);+ // A `Your turn part N of M` heading splits one step into parts, so it+ // isn't counted against the lesson's numbered steps.+ const counted = h[1].match(/(Worked example|Your turn|The task|Tear down) 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])}.`);diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 1ca2267..222b12e 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, a code block, 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 and code blocks, the earlier lesson or the level index its `from` line names), or a code block has no closing fence. A level index page (`docs/<level>/README.md`) can be quoted from any level: `learn.txt` lists it as `<level>-index`, and on any run, pull requests included, the check fails when that id names a different page; only a warm-up names it, as `from: <level>-index`. A code block must equal a fenced block of the lesson line for line, blank lines included, less the indent of the lesson's fence, which must be at most three spaces and outside a quote or alert. On a pull request that changes a lesson or level index 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, a code block, 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 and code blocks, the earlier lesson or the level index its `from` line names), or a code block has no closing fence. A step count compares a `Worked example`, `Your turn`, `The task` or `Tear down` `step N of M` heading with the numbered steps under that heading in the lesson; a `Your turn part N of M` heading is not counted. A level index page (`docs/<level>/README.md`) can be quoted from any level: `learn.txt` lists it as `<level>-index`, and on any run, pull requests included, the check fails when that id names a different page; only a warm-up names it, as `from: <level>-index`. A code block must equal a fenced block of the lesson line for line, blank lines included, less the indent of the lesson's fence, which must be at most three spaces and outside a quote or alert. On a pull request that changes a lesson or level index 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, the expected result and, optionally, `output` patterns the check's output must match, `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: