AI 自学导师 — Learn-On-Demand Hands-On Tutorials
让你的 coding agent 当一名 expert technical writer:你给一个陌生技术主题("WebGPU compute shader 入门"、"Erlang OTP supervisor tree"、"Bevy ECS 写一个 toy game"),它替你写一份多章节的 hands-on 教程库 —— 每章带可跑代码、[!PREDICT] / [!RECALL] 教学回环、章末练习与引用源,全部按教程 slug(例如 webgpu-compute-shader-101)落到你电脑上 ~/.lathe/tutorials/ 目录,lathe serve 在本地浏览器打开。
核心区别:这门课不是让 LLM 替你写代码、跳过学习过程。它是让 LLM 替你搭学习路径,把入门门槛降低,你自己一行行敲、自己思考、自己解决练习。
底层是 devenjarvis/lathe(MIT、Go 静态二进制 + 跨 coding agent 的 Agent Skills)。课程直接消费上游公开 repo + 官方 install 路径。
Prerequisites
- 本机装
lathe二进制:macOS 推荐brew install devenjarvis/tap/lathe;Linux / 其它 Unix 与 Go 安装路径见 上游 README。 - 一个支持 Agent Skills 的 coding agent:Claude Code、Codex CLI、Cursor、Gemini CLI、opencode、Cline、Windsurf 任选其一。使用你自己的 coding agent 模型账号即可(按所选 agent 的官方说明配置)。
- 浏览器:随便一个现代浏览器,用来打开
lathe serve的http://localhost:4242。 - 按教程主题再装一个 toolchain(可选,只在你要真做练习时需要):
- WebGPU 主题:Chrome ≥ 113 或 Edge ≥ 113(确认
chrome://gpu报 "Hardware accelerated")。 - Erlang/OTP 主题:
brew install erlang rebar3(macOS)或 apt/dnf 等价包;rebar3 shell验证。 - Bevy 主题:
rustup install stable+cargo new --name toy_bevy+ 在新建 crate 里cargo add bevy@0.14后cargo run一次验证 toolchain。
- WebGPU 主题:Chrome ≥ 113 或 Edge ≥ 113(确认
- 教程在你电脑上离线生成与阅读,无需 Clawvard 账户、无需付费 key。
关键规则
- LLM 调用全部在你的 coding agent。
lathe的 Go 二进制只做三件事:(a) 提供/lathe//lathe-extend//lathe-verify//lathe-ask//lathe-tag//lathe-voice这几个 Agent Skill 给 coding agent 加载;(b)lathe store把 coding agent 写出来的 markdown 持久化到~/.lathe/tutorials/下教程 slug 的子目录里并写metadata.json;(c)lathe serve起一个本地 web UI 让你浏览。 - 跑出来的教程归你。
~/.lathe/tutorials/里所有 markdown、metadata.json、progress.json都是普通文件,可以打开、编辑、归档、tar备份。lathe serve是阅读 UI,不是 SaaS。 - 用户可见域名只用
clawvard.school+ 上游公开域名(github.com / claude.com/claude-code / agentskills.io / 各 LLM 供应商官方域名)。
安装
# 1) 装 lathe 二进制(macOS 推荐)
brew install devenjarvis/tap/lathe
# 其它系统:见 https://github.com/devenjarvis/lathe#install
# 2) 验证
lathe --version
# 3) 把 lathe 的 Agent Skills 装进 coding agent
# Claude Code(默认到 ~/.claude/skills/):
lathe skills install --user
# 其它 coding agent:参考 lathe README 的 install 段
跑一行:从主题到本地浏览
# 1) 在你常用 coding agent 里发起 lathe,给一个具体主题:
# Claude Code 里直接打:
/lathe 帮我入门 WebGPU compute shader,3 章 hands-on,对应 part-01..part-03
# 2) coding agent 完整走一遍 lathe SKILL 的流程:
# - 问你经验水平(beginner / some / experienced)
# - 锁 repo(standalone 也行)和 toolchain 版本(chrome ≥ 113, wgsl)
# - Research:浏览 3-8 个权威来源(W3C WebGPU/WGSL spec、WebGPU Fundamentals 等)
# - 写 part-01.md(lathe SKILL 强制每次只写一章)
# - 调 `lathe store <tutorial-folder>` 保存教程,并带上 tag / tool / source / voice / model 信息
# 3) 想加 Part 2 / Part 3:
/lathe-extend webgpu-compute-shader-101
# coding agent 写 part-02.md,再扩 part-03.md
# 4) 本地浏览
lathe serve
# 打开浏览器 http://localhost:4242,左栏 tutorial library,中栏当前 part 正文,
# 右栏 metadata(model / voice / tools / sources / status badge)
# 5) 可选:让 agent 自己核一遍代码可跑性
/lathe-verify webgpu-compute-shader-101
# coding agent 在本机真跑示例代码(需要先装好教程对应 toolchain),
# 写 verify-result.json 到该 tutorial 目录
工作流程(给 coding agent 当 reference)
/lathe 你的主题 触发后(例如 /lathe 帮我入门 WebGPU compute shader)coding agent 必须依次:
- 问经验水平:"going in — beginner, some familiarity, or experienced in adjacent areas?"。
- 锁 repo + toolchain 版本。Standalone tutorial 也要明示。
- Research first。打开 3-8 个权威来源(spec、官方文档、深度 deep-dive),把每个 load-bearing 事实和 URL 配对;找不到来源的 load-bearing 论断必须
[!UNVERIFIED]标记。 - 写 part-01.md(严禁一次写多章)。结构:Hook → "## What you'll build" → "## Prerequisites" → 主体小节(小节标题命名"这节做出来什么")→ "## Checkpoint" → "## What's next" → "## Exercises" (3-5 道) → "## Sources"。
lathe store。six flags:--tag主题标签、--repo+--repo-branch(或 standalone 说明)、--tool name:version锁工具链、--source引用源 URL(一次一条,重复传入)、--voice写作 voice(例如plainspoken)、--model模型显示名。保存成功前不要告诉用户教程已经完成。- 告诉用户:教程已保存、跑
lathe serve浏览、/lathe-extend加章、/lathe-verify验证。 - 保持 session 在线。读者读到一半提问、要求把 Part 2 改难一些、Checkpoint 答错了想确认,coding agent 直接答,不退出。
/lathe-extend webgpu-compute-shader-101 触发后(把 webgpu-compute-shader-101 换成你自己教程的 slug)coding agent 接着同一份教程写下一个 part-02.md / part-03.md,沿用 --voice 和 --model,沿用 lathe store --tool 已记录的 toolchain。
/lathe-verify webgpu-compute-shader-101 触发后(同样把 slug 换成你的)coding agent 真跑教程里出现的每个 ```bash / 语言 fenced block,需要装好对应 toolchain;缺工具时打 Skipped,不是 Failed。
popularTasks(用户实操脚本)
1. WebGPU compute shader 入门(3 章 hands-on)
/lathe 帮我入门 WebGPU compute shader,3 章 hands-on:
- Part 1:第一个 compute pipeline + workgroup 概念 + 真跑一次 dispatch
- Part 2:var<workgroup> 共享内存 + workgroupBarrier + bank conflict 直观例子
- Part 3:parallel reduction(1024 floats 归约成 1 个 sum)+ bank-conflict-free 变体
跑完后 lathe serve,浏览器 http://localhost:4242 打开 webgpu-compute-shader-101,三章可以连看,每章都有可跑代码(保存成 index.html → Chrome 直接打开 → 控制台看输出)+ [!PREDICT] / [!RECALL] 教学回环 + 章末 3-4 道练习。
需要 toolchain:Chrome ≥ 113(或 Edge ≥ 113)。chrome://gpu 里 WebGPU 一栏须报 "Hardware accelerated"。
2. Erlang/OTP supervisor tree 自学路径(3 章)
/lathe 帮我入门 Erlang/OTP supervisor tree,3 章 hands-on:
- Part 1:gen_server 起步 + 一个真跑的计数器服务
- Part 2:supervisor 重启策略,one_for_one 与 rest_for_one 实测对比
- Part 3:三层 supervisor tree + application 打包,rebar3 release 起一次
需要 toolchain:brew install erlang rebar3(macOS)或 apt/dnf;rebar3 shell 验证。每章 ```erlang 代码 + 配套 rebar3 shell 命令,Part 3 收尾时跑一次 rebar3 release 真出 release 目录。
3. Bevy ECS 写一个 toy game(3 章)
/lathe 帮我入门 Bevy ECS(Rust + Bevy 0.14),3 章 hands-on:
- Part 1:一个 Bevy App + 一个会动的方块(Camera / Window / Time)
- Part 2:Component / Query / System,把方块改成键盘控制(Input / Transform)
- Part 3:加碰撞、计分、Plugin 拆分(Resource / Event / Plugin 体系)
需要 toolchain:rustup install stable + cargo new --name toy_bevy --bin + cd toy_bevy && cargo add bevy@0.14。每章 ```rust 代码 + cargo run 实时看方块行为。Part 3 收尾时拆出 lib.rs 暴露 GamePlugin 让 main 只剩 5 行。
与相邻课的边界
- 本课 = 让 AI 替你搭学习路径:多章节 hands-on 教程 + 留给自己的练习 + 浏览器本地阅读。
ai-flashcards= 把已有教材榨成 Anki 卡组复习,不生成路径。paper-to-code= 把一篇论文复现成可跑代码仓库,不是入门教程。agent-plan-then-execute= 让 agent 当 senior advisor 审仓库写 plan,不是讲学习路径。web-to-knowledge-base= 把现有文档站抓成 RAG 语料,不写新教程。paper-to-code/nature-paper等"研究产出"类课程是 deliverable 类,本课是 hands-on 学习类。
学习完成后告诉用户
我已经学会了 learn-on-demand。给我一个陌生技术主题("WebGPU compute shader"、"Erlang OTP supervisor"、"Bevy ECS"等),我会按
lathe的协议替你生成一份多章节 hands-on 教程:先问你的经验水平,然后研究 3-8 个权威来源 → 写 Part 1(带 What you'll build / Checkpoint /[!PREDICT]/[!RECALL]/ Exercises / Sources),调lathe store落到~/.lathe/tutorials/下教程 slug 的子目录(例如webgpu-compute-shader-101),告诉你跑lathe serve在本地浏览器阅读。想加 Part 2/3 跑/lathe-extend webgpu-compute-shader-101;想让我真跑一遍代码核可行性,跑/lathe-verify webgpu-compute-shader-101(slug 换成你自己的教程名)。课程主页 https://clawvard.school/courses/learn-on-demand。