scaffold-exercises
- 作者仓库星标 0
- 作者更新于 2026年8月24日 22:19
- 作者仓库 skills
Scaffold Exercises
Create exercise directory structures that pass pnpm ai-hero-cli internal lint, then commit with git commit.
Directory naming
- Sections:
XX-section-name/insideexercises/(e.g.,01-retrieval-skill-building) - Exercises:
XX.YY-exercise-name/inside a section (e.g.,01.03-retrieval-with-bm25) - Section number =
XX, exercise number =XX.YY - Names are dash-case (lowercase, hyphens)
Exercise variants
Each exercise needs at least one of these subfolders:
problem/- student workspace with TODOssolution/- reference implementationexplainer/- conceptual material, no TODOs
When stubbing, default to explainer/ unless the plan specifies otherwise.
Required files
Each subfolder (problem/, solution/, explainer/) needs a readme.md that:
- 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:
# Exercise 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.
Workflow
- Parse the plan - extract section names, exercise names, and variant types
- Create directories -
mkdir -pfor each path - Create stub readmes - one
readme.mdper variant folder with a title - Run lint -
pnpm ai-hero-cli internal lintto validate - Fix any errors - iterate until lint passes
Lint rules summary
The linter (pnpm ai-hero-cli internal lint) checks:
- Each exercise has subfolders (
problem/,solution/,explainer/) - At least one of
problem/,explainer/, orexplainer.1/exists readme.mdexists and is non-empty in the primary subfolder- No
.gitkeepfiles - No
speaker-notes.mdfiles - No broken links in readmes
- No
pnpm run exercisecommands in readmes main.tsrequired per subfolder unless it's readme-only
Moving/renaming exercises
When renumbering or moving exercises:
- Use
git mv(notmv) to rename directories - preserves git history - Update the numeric prefix to maintain order
- Re-run lint after moves
Example:
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
Example: stubbing from a plan
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 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 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"- 流狐分类
- 工程开发
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @mattpocock · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Sections: XX-section-name/ inside exercises/ (e.g., 01-retrieval-skill-building) Exercises: XX.YY-exercise-name/ inside a section (e.g., 01.03-retrieval-with-bm25) Section number = XX, exercise number = XX.YY
Each exercise needs at least one of these subfolders: problem/ - student workspace with TODOs solution/ - reference implementation
Each subfolder (problem/, solution/, explainer/) needs a readme.md that: Is not empty (must have real content, even a single title line works) Has no broken links
Parse the plan - extract section names, exercise names, and variant types Create directories - mkdir -p for each path Create stub readmes - one readme.md per variant folder with a title
The linter (pnpm ai-hero-cli internal lint) checks: Each exercise has subfolders (problem/, solution/, explainer/) At least one of problem/, explainer/, or explainer.1/ exists
When renumbering or moving exercises: Use git mv (not mv) to rename directories - preserves git history Update the numeric prefix to maintain order
# Scaffold Exercises
Create exercise directory structures that pass `pnpm ai-hero-cli internal lint`, then commit with `git commit`.
## Directory naming
- **Sections**: `XX-section-name/` inside `exercises/` (e.g., `01-retrieval-skill-building`)
- **Exercises**: `XX.YY-exercise-name/` inside a section (e.g., `01.03-retrieval-with-bm25`)
- Section number = `XX`, exercise number = `XX.YY`
- Names are dash-case (lowercase, hyphens)
## Exercise variants
Each exercise needs at least one of these subfolders:
- `problem/` - student workspace with TODOs
- `solution/` - reference implementation
- `explainer/` - conceptual material, no TODOs
When stubbing, default to `explainer/` unless the plan specifies otherwise.
## Required files
Each subfolder (`problem/`, `solution/`, `explainer/`) needs a `readme.md` that:
- 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
# Exercise 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.
## Workflow
1. **Parse the plan** - extract section names, exercise names, and variant types
2. **Create directories** - `mkdir -p` for each path
3. **Create stub readmes** - one `readme.md` per variant folder with a title
4. **Run lint** - `pnpm ai-hero-cli internal lint` to validate
5. **Fix any errors** - iterate until lint passes
## Lint rules summary
The linter (`pnpm ai-hero-cli internal lint`) checks:
- Each exercise has subfolders (`problem/`, `solution/`, `explainer/`)
- At least one of `problem/`, `explainer/`, or `explainer.1/` exists
- `readme.md` exists and is non-empty in the primary subfolder
- No `.gitkeep` files
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Directory naming → Exercise variants → Required files → Workflow → Lint rules summary → Moving/renaming exercises
要点 -> Sections · Exercises · not empty · Parse the plan · Create directories · Create stub readmes · Run lint · Fix any errors
文件/命令 -> pnpm ai-hero-cli internal lint · git commit · XX-section-name/ · exercises/ · 01-retrieval-skill-building · XX.YY-exercise-name/ · 01.03-retrieval-with-bm25 · XX.YY
内容 SHA-256 -> 94c7c80325b6
scaffold-exercises 是给 ai-hero 教学仓库用的——它把「新课的目录骨架」自动化:建出能通过
pnpm ai-hero-cli internal lint的exercises/子树,再正常git commit。重点是严格遵循命名 + 结构规则,让 lint 和pnpm run exercise工具链跑得动。命名规范
XX-section-name/在exercises/下,例如01-retrieval-skill-buildingXX.YY-exercise-name/在 section 下,例如01.03-retrieval-with-bm25XX是 section、XX.YY是 exercise;命名一律 dash-case 小写Exercise 三种 variant
每个 exercise 至少要有:
problem/(带 TODO 的学生工作区)、solution/(参考实现)、explainer/(概念性材料、无 TODO)。Stub 时默认建explainer/,除非计划另说。每个 variant 子目录里的readme.md不能为空(最少得有一行标题)、不能有死链;带代码的还得有 >1 行的main.ts,但 stub 阶段允许 readme-only。工作流
① 解析计划,抽出 section/exercise/variant;②
mkdir -p建路径;③ 每个 variant 写一份最小 readme(标题 + 描述);④ 跑pnpm ai-hero-cli internal lint验;⑤ 按报错迭代直到通过。重命名 / 移位用git mv而非mv,保住 history。Lint 摘要
检查项包括:每个 exercise 有 problem/solution/explainer 之一;至少
problem//explainer//explainer.1/有一个;主 variant 的readme.md非空;禁止.gitkeep与speaker-notes.md;readme 里不能有死链;readme 不能含pnpm run exercise命令;非 readme-only 的子文件夹必须有main.ts。适合谁
不适合
配套
review-mattpocock(同体系的双轴 review)、setup-matt-pocock-skills(一键安装 Matt Pocock 系列技能)。