Create an exercise directory structure that passes pnpm ai-hero-cli internal lint checks, then commit using git commit .
Directory naming rules
- Sections: located under
exercises/in theXX-section-name/format (e.g.01-retrieval-skill-building) - Exercises: located inside a section in the
XX.YY-exercise-name/format (e.g.01.03-retrieval-with-bm25) - Section number =
XX, exercise number =XX.YY - Names use kebab-case (lowercase letters, hyphens)
Exercise variants
Each exercise requires at least one of the following subfolders:
problem/— student workspace, contains TODOsolution/— reference implementationexplainer/— concept explanation material, does not contain TODO
When creating a template, use explainer/。
Required files
Each subfolder (problem/、solution/、explainer/) requires a readme.md, with the following requirements:
- Cannot be empty(must have actual content, even just a single heading is fine)
- Cannot have broken links
When creating a template, create a minimal readme containing a title and description:
# Exercise Title
Description here
If the subfolder contains code, a main.tsis also required (more than 1 line). But for templates, a readme-only exercise is also acceptable.
Workflow
- Parse the plan — extract section names, exercise names, and variant types
- Create directories — use
mkdir -pto create each path - Create readme templates — one
readme.mdper variant folder, containing a title - Run lint — run
pnpm ai-hero-cli internal lintto verify - Fix errors — keep modifying until lint passes
Lint rules summary
linter(pnpm ai-hero-cli internal lint) checks the following:
- Each exercise has subfolders (
problem/、solution/、explainer/) - at least one of
problem/、explainer/orexplainer.1/exists - The main subfolder contains
readme.mdand it is not empty - No
.gitkeepfiles - No
speaker-notes.mdfiles - No broken links in the readme
- No
pnpm run exercisecommands in the readme - Each subfolder requires
main.ts, unless it is readme-only
Move/rename exercises
When renumbering or moving exercises:
- Use
git mv(instead ofmv) to rename directories — this preserves git history - Update numeric prefixes to maintain order
- Re-run lint after moving
Example:
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
Example: create templates from a plan
Given a plan such as:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term Memory
Create:
mkdir -p exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer
mkdir -p exercises/05-memory-skill-building/05.02-short-term-memory/{explainer,problem,solution}
mkdir -p exercises/05-memory-skill-building/05.03-long-term-memory/explainer
Then create the readme templates:
exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# Introduction to Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# Short-term Memory"
exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# Long-term Memory"