code-authoring
Skill1 starsChanged 23 days agoMITView on GitHub
How to write and fix the code of a codelabgen lesson from its spec — layout, pinned dependencies, teaching-grade comments, region markers for snippets, offline tests, environment variables, and getting `codelabgen verify` to pass — for Python (uv), Node (TypeScript), Go and Rust courses. Used by the code-author and code-fixer agents.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- badjano/skillstheir own version, first seen Oct 5, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- badjano/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- codelabgen-orchestratorSkill
- course-extensionSkill
- curriculum-designSkill
- diagrammingSkill
- example-designSkill
- lesson-reviewSkill
- notes-writingSkill
- readalong-writingSkill
- runtime-strategySkill
- site-assemblySkill
- source-articlesSkill
- source-books-coursesSkill
- source-digestSkill
- source-evaluationSkill
- source-github-reposSkill
- source-official-blogSkill
- source-official-docsSkill
- source-package-internalsSkill
- source-papers-specsSkill
- source-qaSkill
- source-talks-workshopsSkill
- source-universitySkill
- state-protocolSkill
- topic-extractionSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Create exactly the files in the spec's files.
- Very specific: line 29
Don't touch docs/, README.md or .codelabgen/.
- Distinctive: line 38
Every exported function and type gets a doc comment in the language's style.
- Very specific: line 41
Configuration through environment variables: Read them with the language's normal API, with a sensible default only for non-secret settings.
- Distinctive: line 54
If the formatter moves blank lines around a marker, that's expected.
- Distinctive: line 58
Write the tests the spec lists, where the reference says tests live.
- Distinctive: line 59
Offline only: no network, no API keys, no LLM, no Docker.
- Very specific: line 69
Run codelabgen verify <id> --course <course dir>.
- Very specific: line 70
Stop after 5 failed runs and report failed with the cause in notes.
- Very specific: line 72
Don't pass --update-state.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing lesson code
The code is what learners run, read and experiment with. It must work in the pinned version, read like a well-commented teaching example, and pass codelabgen verify.
First: your runtime's reference
The course runtime is runtime.kind in .codelabgen/config.yaml. Read its reference before writing anything. It covers the layout, dependencies, where installed library sources live, comment style, the formatter and linter, and how tests and the live run work:
runtime.kind | Reference |
python-uv | ${CLAUDE_PLUGIN_ROOT}/skills/code-authoring/references/python.md |
node | ${CLAUDE_PLUGIN_ROOT}/skills/code-authoring/references/node.md |
go | ${CLAUDE_PLUGIN_ROOT}/skills/code-authoring/references/go.md |
rust | ${CLAUDE_PLUGIN_ROOT}/skills/code-authoring/references/rust.md |
codelabgen curriculum lessons gives each lesson's directory, package and project names.
Files
- The lesson directory was created by
codelabgen scaffold. Keep its layout. - Create exactly the files in the spec's
files. If you need another file, say so in the statusnotes. - The scaffold's placeholder (
__init__.pydocstring,src/main.ts,main.goorsrc/main.rswith a comment) is yours to replace or keep. - Don't touch
docs/,README.mdor.codelabgen/.
Use only APIs you have seen
Before writing a call, confirm it exists in the installed version. The reference says where the installed sources are; grep them for the function or type and read the signature. Check .codelabgen/research/deprecations.md when it exists, and never use anything listed there. When the docs and the installed source disagree, the installed source wins.
Teaching-grade code
- Comments in English, more than in production code. Explain why and what the library does here, not what the syntax does. A learner should be able to follow the file without the read-along.
- Every exported function and type gets a doc comment in the language's style. Every non-obvious line involving the technology gets a comment.
- Simple over clever. Plain functions, explicit names, no premature abstraction, no metaprogramming. Prefer the library's most common, documented idiom.
- Types everywhere the language has them.
- Configuration through environment variables. Read them with the language's normal API, with a sensible default only for non-secret settings. Never hardcode secrets or connection strings.
codelabgen verifyloads the course and lesson.envfiles.
Region markers
Wrap every region the spec lists, in the language's line-comment syntax:
# region route (Python) // region route (TypeScript, Go, Rust)
… …
# endregion // endregion- Names exactly as in the spec's
regions. Regions may nest. Markers never appear in the docs. - If the formatter moves blank lines around a marker, that's expected; leave it.
Tests
- Write the tests the spec lists, where the reference says tests live.
- Offline only: no network, no API keys, no LLM, no Docker. Use fakes and in-memory backends: an in-memory store instead of Postgres, a fake chat model instead of a real one.
- Fast and deterministic.
The live run
The spec's run_cmd runs the lesson for real: with real services (for example Postgres through POSTGRES_URL) and real keys. It prints clear, readable output showing the concept at work, and exits by itself. Its output is quoted in the read-along, so make it worth reading: short labeled lines, no debug noise.
Finish with a green verify
- Format and lint with the commands from the reference.
- Run
codelabgen verify <id> --course <course dir>. It prints JSON. If it fails, readfailed_stepandlog_tail(the full log is in the course'srun_dir), fix, and run it again. - Stop after 5 failed runs and report
failedwith the cause innotes.
Don't pass --update-state; the orchestrator records the official result.
Fixing failures (code-fixer)
You get the failing verify summary. Work from the evidence:
env: a variable is missing. You can't fix it in code: reportneeds-userand name the variable.services: Docker or the service failed to start. Read the log's diagnosis. A port taken by another course's container, a service not published on its port, or Docker itself being unavailable all need the user: reportneeds-userwith the suggested command.sync: a dependency doesn't resolve. Fix the pins in the lesson's manifest (see the reference).lint/format: run the formatter and the linter's fixer, then fix what remains by hand.offline-tests/live-run: read the error, check the API against the installed source, and fix the code. Never weaken or delete a test to make it pass unless the test itself contradicts the spec, and say so innotes.
Make the smallest change that fixes the cause. Keep regions, comments and the spec's behaviour intact.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

