scaffold-exercises
创建包含章节、题目、解答和讲解、并能通过 lint 的练习目录结构。当用户想搭建练习脚手架、创建练习占位,或建立新的课程章节时使用。
- License 许可
- MIT
- 所属仓库
- luestr/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 94
- Forks
- 1
01 前言 Front Matter
- name
- scaffold-exercises
- metadata
- { "language": "zh-CN" }
- description
- 创建包含章节、题目、解答和讲解、并能通过 lint 的练习目录结构。当用户想搭建练习脚手架、创建练习占位,或建立新的课程章节时使用。
02 资源文件 1
- 参考文档agents/openai.yaml108 B
03 SKILL.md 正文
搭建练习脚手架
创建能通过 pnpm ai-hero-cli internal lint 的练习目录结构,然后用 git commit 提交。
目录命名
- 章节:
exercises/下的XX-section-name/(例如01-retrieval-skill-building) - 练习:章节内的
XX.YY-exercise-name/(例如01.03-retrieval-with-bm25) - 章节编号 =
XX,练习编号 =XX.YY - 名称为 dash-case(小写、连字符)
练习变体
每个练习至少需要以下子目录之一:
problem/:带 TODO 的学员工作区solution/:参考实现explainer/:概念材料,没有 TODO
创建占位时,除非计划另有说明,默认用 explainer/。
必需文件
每个子目录(problem/、solution/、explainer/)都需要一个 readme.md,它:
- 不为空(必须有真实内容,哪怕只有一行标题也行)
- 没有失效链接
创建占位时,写一个带标题和描述的最小 readme:
# 练习标题
在此填写描述
如果子目录里有代码,它还需要一个 main.ts(超过 1 行)。但对占位来说,只有 readme 的练习也没问题。
工作流程
- 解析计划 —— 提取章节名、练习名和变体类型
- 创建目录 —— 为每个路径执行
mkdir -p - 创建占位 readme —— 每个变体文件夹一个带标题的
readme.md - 运行 lint —— 用
pnpm ai-hero-cli internal lint校验 - 修复所有错误 —— 反复迭代直到 lint 通过
lint 规则概要
linter(pnpm ai-hero-cli internal lint)会检查:
- 每个练习都有子目录(
problem/、solution/、explainer/) problem/、explainer/或explainer.1/至少存在一个- 主(primary)子目录中的
readme.md存在且非空 - 没有
.gitkeep文件 - 没有
speaker-notes.md文件 - readme 里没有失效链接
- readme 里没有
pnpm run exercise命令 - 每个子目录都需要
main.ts,除非它只有 readme
移动/重命名练习
重新编号或移动练习时:
- 用
git mv(而不是mv)重命名目录 —— 保留 git 历史 - 更新数字前缀以维持顺序
- 移动后重新运行 lint
示例:
git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
示例:按计划创建占位
给定这样的计划:
Section 05: Memory Skill Building
- 05.01 Introduction to Memory
- 05.02 Short-term Memory (explainer + problem + solution)
- 05.03 Long-term Memory
创建:
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"
04 同仓库更多 Skills
write-ublock-origin-filters
完整的 uBlock Origin (uBO) 静态过滤语法参考。编写 uBlock Origin 自定义过滤规则时使用此技能,涵盖广告拦截、隐私保护或内容过滤。包含基础网络过滤模式(||、*、^、|)、所有网络过滤选项($domain、$third-party、$important、$redirect、$removeparam、$csp、$replace、$header、$method、$denyallow、$badfilter、$all 等)、内容类型选项($script、$image、$stylesheet、$font、$media、$xhr、$popup、$document、$frame 等)、元素隐藏规则(## 选择器、实体匹配、主机名正则)、过程式元素隐藏过滤器(:has、:has-text、:matches-css、:upward、:xpath、:matches-path、:watch-attr 等)、动作操作符(:remove、:style、:remove-attr、:remove-class)、HTML 过滤器(##^)、响应头过滤(##^responseheader)、脚本注入(##+js())以及预处理指令(!#include、!#if)。当用户提到 uBlock Origin 过滤规则、uBO 语法、广告拦截规则、元素隐藏规则、过程式选择器、脚本注入或希望编写/调试任何 uBO 兼容过滤列表时触发。即使用户只是在编写或调试 uBlock Origin 过滤规则、创建自定义过滤列表或从 AdBlock Plus/AdGuard 迁移过滤规则到 uBO,也应使用此技能。
write-ublock-origin-filters
Complete uBlock Origin (uBO) static filter reference. Use this skill when writing or debugging uBO custom filters or filter lists for ad blocking, privacy or content filtering, or when migrating filters from AdBlock Plus/AdGuard. Covers network patterns (||, *, ^, |) and options ($domain, $third-party, $important, $redirect, $removeparam, $csp, $replace, $header, $method, $badfilter, $all), content-type options ($script, $image, $stylesheet, $font, $media, $xhr, $popup, $document, $frame), cosmetic filters (##, CSS selectors, entity matching), procedural filters (:has, :has-text, :matches-css, :upward, :xpath, :matches-path, :watch-attr), action operators (:remove, :style, :remove-attr), HTML filters (##^), response-header filtering (##^responseheader), scriptlet injection (##+js()), and pre-parsing directives (!#include, !#if). Trigger whenever the user mentions uBO syntax, ad blocking rules, element hiding, procedural selectors, scriptlet injection, or a uBO-compatible filter list.
write-tampermonkey-scripts
引导 AI 代理规划、编写、调试、测试和维护 Tampermonkey 用户脚本。当用户请求用户脚本、浏览器页面自动化、DOM 增强、Tampermonkey 元数据、GM_* API、@match、@grant、@run-at、@connect、跨源请求、SPA 页面集成或脚本注入任务时使用此技能,即使用户没有明确提及 Tampermonkey。
write-tampermonkey-scripts
Guide an AI agent through planning, writing, debugging, testing, and maintaining Tampermonkey userscripts. Use this skill whenever a user asks for a userscript, browser-page automation, DOM enhancement, Tampermonkey metadata, GM_* API, @match, @grant, @run-at, @connect, cross-origin request, SPA page integration, or script injection task, even when Tampermonkey is not named explicitly.
write-adguard-filters
编写 AdGuard 自定义过滤规则时使用此技能。涵盖基本规则语法、所有修饰符($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp 等)、外观规则(元素隐藏/CSS/Extended CSS 选择器)、HTML 过滤、JavaScript/脚本片段规则、非基本规则修饰符、预处理器指令和调试技巧。当用户提及 AdGuard 过滤规则、广告拦截规则语法、过滤器列表编写、ABP 语法兼容、元素隐藏规则、Extended CSS 选择器(:has/:contains/:matches-css 等)时触发。即使用户只是在编写或调试任何类型的广告过滤规则,也应使用此技能。
write-adguard-filters
Complete AdGuard filtering rules syntax reference. Use this skill when writing AdGuard custom filters. Covers basic rule syntax, all modifiers ($domain/$third-party/$important/$redirect/$replace/$removeparam/$cookie/$csp etc.), cosmetic rules (element hiding/CSS/Extended CSS selectors), HTML filtering, JavaScript/scriptlet rules, non-basic rule modifiers, preprocessor directives, and debugging. Trigger when user mentions AdGuard filtering rules, ad blocking rule syntax, filter list authoring, ABP syntax compatibility, element hiding rules, Extended CSS selectors (:has/:contains/:matches-css etc.). Use this skill even when the user is just writing or debugging any type of ad filtering rules.