scaffold-exercises
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScaffold Exercises
搭建习题框架
Create exercise directory structures that pass , then commit with .
pnpm ai-hero-cli internal lintgit commit创建可通过检查的习题目录结构,随后使用提交。
pnpm ai-hero-cli internal lintgit commitDirectory naming
目录命名规则
- Sections: inside
XX-section-name/(e.g.,exercises/)01-retrieval-skill-building - Exercises: inside a section (e.g.,
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - Section number = , exercise number =
XXXX.YY - Names are dash-case (lowercase, hyphens)
- 章节:在目录下创建
exercises/格式的文件夹(例如:XX-section-name/)01-retrieval-skill-building - 习题:在章节文件夹内创建格式的文件夹(例如:
XX.YY-exercise-name/)01.03-retrieval-with-bm25 - 章节编号为,习题编号为
XXXX.YY - 名称采用短横线命名法(小写字母,用短横线分隔)
Exercise variants
习题变体类型
Each exercise needs at least one of these subfolders:
- - student workspace with TODOs
problem/ - - reference implementation
solution/ - - conceptual material, no TODOs
explainer/
When stubbing, default to unless the plan specifies otherwise.
explainer/每个习题至少需要包含以下子文件夹中的一个:
- - 包含待完成任务(TODOs)的学生工作区
problem/ - - 参考实现代码
solution/ - - 概念性内容,无待完成任务
explainer/
在创建 stub 时,默认使用文件夹,除非规划中有特别说明。
explainer/Required files
必填文件
Each subfolder (, , ) needs a that:
problem/solution/explainer/readme.md- Is not empty (must have real content, even a single title line works)
- Has no broken links
When stubbing, create a minimal readme with a title and a description:
md
undefined每个子文件夹(、、)都需要包含一个文件,该文件需满足:
problem/solution/explainer/readme.md- 不能为空(必须包含实际内容,哪怕只有一行标题也可以)
- 无无效链接
创建 stub 时,生成包含标题和描述的最简版 readme:
md
undefinedExercise Title
习题标题
Description here
If the subfolder has code, it also needs a `main.ts` (>1 line). But for stubs, a readme-only exercise is fine.描述内容
如果子文件夹包含代码,还需要一个行数大于1的`main.ts`文件。但对于 stub 来说,仅包含 readme 的习题也是符合要求的。Workflow
工作流程
- Parse the plan - extract section names, exercise names, and variant types
- Create directories - for each path
mkdir -p - Create stub readmes - one per variant folder with a title
readme.md - Run lint - to validate
pnpm ai-hero-cli internal lint - Fix any errors - iterate until lint passes
- 解析规划 - 提取章节名称、习题名称和变体类型
- 创建目录 - 使用命令创建每个路径对应的文件夹
mkdir -p - 创建 stub 版 readme - 为每个变体文件夹创建一个带标题的文件
readme.md - 运行代码检查 - 执行进行验证
pnpm ai-hero-cli internal lint - 修复错误 - 反复检查直到代码检查通过
Lint rules summary
代码检查规则摘要
The linter () checks:
pnpm ai-hero-cli internal lint- Each exercise has subfolders (,
problem/,solution/)explainer/ - At least one of ,
problem/, orexplainer/existsexplainer.1/ - exists and is non-empty in the primary subfolder
readme.md - No files
.gitkeep - No files
speaker-notes.md - No broken links in readmes
- No commands in readmes
pnpm run exercise - required per subfolder unless it's readme-only
main.ts
代码检查工具()会检查以下内容:
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
Moving/renaming exercises
移动/重命名习题
When renumbering or moving exercises:
- Use (not
git mv) to rename directories - preserves git historymv - Update the numeric prefix to maintain order
- Re-run lint after moves
Example:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings当需要重新编号或移动习题时:
- 使用命令(而非
git mv)重命名目录 - 这样可以保留 git 历史记录mv - 更新数字前缀以维持顺序
- 移动完成后重新运行代码检查
示例:
bash
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddingsExample: stubbing from a plan
示例:根据规划创建 stub
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 stubs:
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"给定如下规划:
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然后创建 stub 版 readme:
exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# 内存基础介绍"
exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# 短期内存"
exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# 短期内存"
exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# 短期内存"
exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# 长期内存"