write-lesson

Creates verified programming lessons with measured component lists and e2e-tested code.

9|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/timcsy/semorphe --skill write-lesson-timcsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-lesson
Source: https://github.com/timcsy/semorphe/tree/main/knowledge/skills/write-lesson
Command: npx skills add https://github.com/timcsy/semorphe --skill write-lesson-timcsy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing programming courseware by hand produces silent errors: component lists written from memory, expected console output that was never actually run, and code duplicated between lesson.json and lesson.md that drifts out of sync. This Skill enforces a measurement-first workflow so every lesson promise to students is verified before shipping. ## Core Features & Use Cases - Measured component lists: Uses the Playwright-based e2e/measure-lesson-codes.spec.ts tool to sync each code snippet, walk the semantic tree, run it, and record the real components and stdout instead of guessing. - Single source of truth for code: Code lives only in lesson.md under the '完成的樣子' section; guardrails extract and execute it, preventing dual-source drift. - Track and lesson structure: Defines track.json per learning track (beginner, bridge, advanced) and lesson.json/lesson.md per lesson, with numbering and cross-track referencing rules. - Exercise tasks with judges: Supports per-task checks, solution files, and multiple-choice distractors each annotated with the specific misconception it targets. - Use Case: When authoring a new C++ beginner lesson, run the measurement tool on all code snippets first, confirm zero raw_code nodes, fill pins.target with the correct target id, then write the seven-section lesson skeleton and let the data-driven e2e suite pick it up automatically. ## Quick Start Create a new lesson for the cpp-beginner track by first measuring all its code snippets with the lesson measurement spec, then writing lesson.json and lesson.md following the seven-section skeleton.

Frequently Asked Questions about write-lesson

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new programming lesson with verified code?

Measure every code snippet first using the e2e/measure-lesson-codes.spec.ts Playwright tool with a codes.json input, which syncs each snippet, walks the semantic tree, runs it, and records real components and stdout. Only then write the lesson text.

How do I measure expected console output for lesson code?

Feed a codes.json file mapping names to target and code into the measurement spec, which executes each snippet and writes measured.json with actual stdout. Never guess check.stdout values, since an unmeasured expectation is an unverified promise to students.

What is the difference between a topic and a target in lesson pins?

Topics like cpp-beginner or python-beginner are subject groupings, while targets like cpp, python, or arduino-uno are actual configuration ids. The pins.target field must contain a target id; using a topic id silently fails to apply the configuration.

Why does my lesson show raw_code blocks in the block view?

A raw_code node means the system could not parse that code into blocks, so the lesson is broken on the block side even though the text reads fine. Confirm measured results show zero raw_code before shipping the lesson.

Should each lesson get its own e2e test file?

No. The e2e lesson guardrail is data-driven and automatically picks up new lessons, so fifty lessons do not need fifty test files. Adding a lesson to the lessons directory is sufficient for coverage.

When should a lesson exercise not have an automated check?

Skip the check when the judge cannot distinguish correct from incorrect output, such as a task asking to rewrite code with a while loop that produces identical output. A judge that always says correct devalues all other checks.