scaffold-exercises
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese搭建练习框架
Set Up Exercise Framework
创建能通过 检查的练习目录结构,然后使用 提交。
pnpm ai-hero-cli internal lintgit commitCreate an exercise directory structure that passes the check, then commit using .
pnpm ai-hero-cli internal lintgit commit目录命名规则
Directory Naming Rules
- 章节(Sections):位于 下的
exercises/格式(例如XX-section-name/)01-retrieval-skill-building - 练习(Exercises):位于章节内的 格式(例如
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - 章节编号 = ,练习编号 =
XXXX.YY - 名称使用短横线命名法(小写字母、连字符)
- Sections: Located under in the format
exercises/(e.g.,XX-section-name/)01-retrieval-skill-building - Exercises: Located within sections in the format (e.g.,
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - Section number = , Exercise number =
XXXX.YY - Names use kebab-case (lowercase letters, hyphens)
练习变体
Exercise Variants
每个练习至少需要以下子文件夹之一:
- — 学生工作区,包含 TODO
problem/ - — 参考实现
solution/ - — 概念讲解材料,不包含 TODO
explainer/
创建模板时,除非计划另有说明,否则默认使用 。
explainer/Each exercise requires at least one of the following subfolders:
- — Student workspace containing TODOs
problem/ - — Reference implementation
solution/ - — Concept explanation materials without TODOs
explainer/
When creating templates, use by default unless specified otherwise in the plan.
explainer/必需文件
Required Files
每个子文件夹(、、)需要一个 ,要求:
problem/solution/explainer/readme.md- 不能为空(必须有实际内容,哪怕只有一行标题也可以)
- 不能有损坏的链接
创建模板时,创建一个包含标题和描述的极简 readme:
md
undefinedEach subfolder (, , ) needs a with the following requirements:
problem/solution/explainer/readme.md- Cannot be empty (must have actual content, even just a one-line title is acceptable)
- No broken links
When creating templates, create a minimal readme with a title and description:
md
undefinedExercise Title
Exercise Title
Description here
如果子文件夹包含代码,还需要一个 `main.ts`(超过 1 行)。但对于模板来说,仅有 readme 的练习也是可以的。Description here
If the subfolder contains code, a `main.ts` (with more than 1 line) is also required. However, for templates, exercises with only a readme are acceptable.工作流程
Workflow
- 解析计划 — 提取章节名称、练习名称和变体类型
- 创建目录 — 使用 创建每个路径
mkdir -p - 创建 readme 模板 — 每个变体文件夹一个 ,包含标题
readme.md - 运行 lint — 执行 进行验证
pnpm ai-hero-cli internal lint - 修复错误 — 反复修改直到 lint 通过
- Parse the Plan — Extract section names, exercise names, and variant types
- Create Directories — Use to create each path
mkdir -p - Create Readme Templates — One per variant folder with a title
readme.md - Run Lint — Execute for validation
pnpm ai-hero-cli internal lint - Fix Errors — Revise repeatedly until lint passes
Lint 规则摘要
Lint Rules Summary
linter()检查以下内容:
pnpm ai-hero-cli internal lint- 每个练习都有子文件夹(、
problem/、solution/)explainer/ - 至少存在 、
problem/或explainer/其中之一explainer.1/ - 主要子文件夹中存在 且不为空
readme.md - 没有 文件
.gitkeep - 没有 文件
speaker-notes.md - readme 中没有损坏的链接
- readme 中没有 命令
pnpm run exercise - 每个子文件夹需要 ,除非仅有 readme
main.ts
The linter () checks the following:
pnpm ai-hero-cli internal lint- Each exercise has subfolders (,
problem/,solution/)explainer/ - At least one of ,
problem/, orexplainer/existsexplainer.1/ - exists in main subfolders and is not empty
readme.md - No files
.gitkeep - No files
speaker-notes.md - No broken links in readme
- No commands in readme
pnpm run exercise - Each subfolder requires unless it only has a readme
main.ts
移动/重命名练习
Moving/Renaming Exercises
在重新编号或移动练习时:
- 使用 (而不是
git mv)重命名目录 — 这样可以保留 git 历史mv - 更新数字前缀以保持顺序
- 移动后重新运行 lint
示例:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddingsWhen renumbering or moving exercises:
- Use (instead of
git mv) to rename directories — this preserves git historymv - Update numeric prefixes to maintain order
- Re-run lint after moving
Example:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings示例:根据计划创建模板
Example: Create Template from Plan
给定一个计划如:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term Memory创建:
bash
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然后创建 readme 模板:
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"Given a plan like:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term MemoryCreate:
bash
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/explainerThen create 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"