| name | scaffold-exercises |
| description (EN) | Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section. |
| 說明 (繁中) | 建立帶有 section、題目、解答與講解、且能通過 lint 檢查的練習目錄結構。當使用者想要建立練習骨架、建立練習樁,或設定新的課程 section 時使用。 |
Create exercise directory structures that pass pnpm ai-hero-cli internal lint, then commit with git commit.
建立能通過 pnpm ai-hero-cli internal lint 的練習目錄結構,然後用 git commit 提交。
XX-section-name/ inside exercises/ (e.g., 01-retrieval-skill-building)XX.YY-exercise-name/ inside a section (e.g., 01.03-retrieval-with-bm25)XX, exercise number = XX.YYexercises/ 內部的 XX-section-name/(例如 01-retrieval-skill-building)XX.YY-exercise-name/(例如 01.03-retrieval-with-bm25)XX,練習號碼 = XX.YYEach exercise needs at least one of these subfolders:
每個練習至少需要以下子資料夾之一:
problem/ - student workspace with TODOssolution/ - reference implementationexplainer/ - conceptual material, no TODOsproblem/ - 帶有 TODO 的學生工作區solution/ - 參考實作explainer/ - 概念性材料,沒有 TODOWhen stubbing, default to explainer/ unless the plan specifies otherwise.
建立樁時,除非計畫另有指定,否則預設使用 explainer/。
Each subfolder (problem/, solution/, explainer/) needs a readme.md that:
每個子資料夾(problem/、solution/、explainer/)需要一個 readme.md,它必須:
When stubbing, create a minimal readme with a title and a description:
建立樁時,建立一個帶有標題與描述的最小 readme:
# Exercise Title
Description here
# 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.
如果子資料夾有程式碼,它也需要一個 main.ts(>1 行)。但對於樁,一個只有 readme 的練習也可以。
mkdir -p for each pathreadme.md per variant folder with a titlepnpm ai-hero-cli internal lint to validatemkdir -preadme.mdpnpm ai-hero-cli internal lint 來驗證The linter (pnpm ai-hero-cli internal lint) checks:
linter(pnpm ai-hero-cli internal lint)檢查:
problem/, solution/, explainer/)problem/, explainer/, or explainer.1/ existsreadme.md exists and is non-empty in the primary subfolder.gitkeep filesspeaker-notes.md filespnpm run exercise commands in readmesmain.ts required per subfolder unless it's readme-onlyproblem/、solution/、explainer/)problem/、explainer/ 或 explainer.1/ 至少有一個存在readme.md 存在且非空.gitkeep 檔案speaker-notes.md 檔案pnpm run exercise 命令main.ts,除非它只有 readmeWhen renumbering or moving exercises:
重新編號或移動練習時:
git mv (not mv) to rename directories - preserves git historygit mv(不是 mv)來重新命名目錄 - 保留 git 歷史Example:
範例:
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
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
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
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:
然後建立 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"
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"