skill-eval-builder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Eval Builder
Skill 评估构建器
Overview
概述
Set up a small, real eval for a skill: an folder next to it with a few
real cases, a runnable script, and a scorecard. It measures what scripts can't pin
down — does the skill fire when it should (and stay quiet when it shouldn't),
is its output valid, is it within a time budget.
evals/Core principle: an eval is a folder, not a framework. Keep it that small.
为某个Skill搭建小型真实评估:在Skill目录旁创建一个文件夹,包含若干真实测试用例、可运行脚本和评分卡。它能测量脚本无法确定的内容——Skill是否在应当触发时触发(且在不应触发时保持静默)、输出是否有效、是否在时间预算内完成。
evals/核心原则: 评估是一个文件夹,而非框架。保持轻量化。
Inputs
输入
- Target skill — path or name (the dir with its ).
SKILL.md - A few real cases — should-fire and shouldn't-fire prompts + real inputs; help the user find them if needed.
- Which dimensions matter — default invocation + validation; add duration/others if they fit.
- 目标Skill —— 路径或名称(包含的目录)。
SKILL.md - 若干真实用例 —— 应当触发和不应触发的提示词+真实输入;必要时协助用户寻找这些用例。
- 关键评估维度 —— 默认包含触发验证+输出验证;若适用可添加时长等其他维度。
Steps
步骤
- Read the target skill — its , references, and scripts, so you know what it does and what it produces.
SKILL.md - Pick dimensions that fit it, from . Workflow skill → invocation + duration; capability skill → validation-heavy.
references/eval-dimensions.md - Gather 3–5 real cases — should-fire and shouldn't-fire prompts plus real inputs. Always include at least one quiet case.
- Define "good" per case — a side-effect check, a
fired_whencommand, and avalidatefrom a real baseline (seebudget_s).references/eval-anatomy.md - Scaffold the artifact next to the skill:
Then fill inbash
python3 "${CLAUDE_SKILL_DIR}/scripts/scaffold-evals.py" <target-skill-dir>with the cases from steps 3–4.evals/cases.md - Check, then run the baseline:
bash
python3 <target-skill-dir>/evals/run.py --dry-run # cases parse? python3 <target-skill-dir>/evals/run.py # real run (calls claude -p) - Report the scorecard and where it lives.
- 读取目标Skill —— 查看其、参考文档和脚本,明确其功能与输出内容。
SKILL.md - 选择适配的评估维度,参考。工作流类Skill → 触发验证+时长;能力类Skill → 侧重输出验证。
references/eval-dimensions.md - 收集3–5个真实用例 —— 包含应当触发和不应触发的提示词及真实输入。务必至少包含一个静默用例。
- 为每个用例定义“合格标准” —— 包括副作用检查、
fired_when命令,以及基于真实基准的validate(详见budget_s)。references/eval-anatomy.md - 在Skill旁生成评估工件:
随后将步骤3–4中的用例填入bash
python3 "${CLAUDE_SKILL_DIR}/scripts/scaffold-evals.py" <target-skill-dir>。evals/cases.md - 检查并运行基准测试:
bash
python3 <target-skill-dir>/evals/run.py --dry-run # 验证用例是否可解析? python3 <target-skill-dir>/evals/run.py # 真实运行(调用claude -p) - 报告评分卡结果及其存储路径。
Testing a classification gate
分类网关测试
If the skill opens with a classifier (routes feature vs bug, or decides whether to continue), test that gate:
python3 "${CLAUDE_SKILL_DIR}/scripts/scaffold-evals.py" <target> --classify- Fill with the labels, the gate's own instruction, and real labeled examples (e.g. the last 10 tracker tickets + their existing labels as ground truth). See
evals/classify-cases.md.references/eval-anatomy.md - → an accuracy + confusion scorecard.
python3 <target>/evals/classify.py
若Skill以分类器开头(区分功能与Bug,或决定是否继续执行),需测试该网关:
python3 "${CLAUDE_SKILL_DIR}/scripts/scaffold-evals.py" <target> --classify- 在中填入标签、网关自身指令,以及真实标注示例(例如最近10个跟踪工单及其现有标注作为基准)。详见
evals/classify-cases.md。references/eval-anatomy.md - → 生成准确率+混淆矩阵评分卡。
python3 <target>/evals/classify.py
Output format
输出格式
The scorecard (dimensions × cases) plus the saved artifact path:
┌───────────────────────────────┬──────────┬────────┬────────────────────┐
│ Case │ Fires? │ Valid? │ Duration vs budget │
├───────────────────────────────┼──────────┼────────┼────────────────────┤
│ "add tests for X" │ ✅ │ ✅ │ 40s / 60s ✅ │
│ "refactor Y" (shouldn't fire) │ ✅ quiet │ – │ – │
└───────────────────────────────┴──────────┴────────┴────────────────────┘Saved to (cases.md, run.py, results.md).
<target-skill>/evals/评分卡(维度×用例)加上保存的工件路径:
┌───────────────────────────────┬──────────┬────────┬────────────────────┐
│ Case │ Fires? │ Valid? │ Duration vs budget │
├───────────────────────────────┼──────────┼────────┼────────────────────┤
│ "add tests for X" │ ✅ │ ✅ │ 40s / 60s ✅ │
│ "refactor Y" (shouldn't fire) │ ✅ quiet │ – │ – │
└───────────────────────────────┴──────────┴────────┴────────────────────┘保存至(包含cases.md、run.py、results.md)。
<target-skill>/evals/Guidelines
指南
- Prefer an observable side-effect for firing (a file the skill produces) over grepping prose.
- Runs are not byte-identical — a skill eval runs a model; that variance is what you measure. Don't fake determinism, and don't eval what a deterministic script already guarantees (unit-check the script instead).
- Keep it to 3–5 real cases with at least one quiet case. See .
references/eval-anatomy.md
- 优先使用可观测的副作用(如Skill生成的文件)来判断是否触发,而非搜索文本内容。
- 运行结果并非字节级完全一致——Skill评估会调用模型;这种差异正是需要测量的内容。不要伪造确定性,也不要评估确定性脚本已能保证的内容(这类内容应通过单元测试验证)。
- 保持3–5个真实用例,且至少包含一个静默用例。详见。
references/eval-anatomy.md
Files
文件说明
- — creates
scripts/scaffold-evals.py, or theevals/{cases.md, run.py, results.md}set withclassify-*.--classify - — runs cases via
scripts/run-evals.py, times each, checks firing + validation, prints/saves the scorecard.claude -pparses without spending tokens.--dry-run - — classifies labeled examples via
scripts/classify-evals.py, reports accuracy + confusion.claude -pparses without tokens.--dry-run - — the dimension menu + when each applies.
references/eval-dimensions.md - — cases format, the side-effect pattern, anti-patterns.
references/eval-anatomy.md
If a script can't run here (needs and the CLI, or a different OS): don't abandon the task — an eval is just a plus a small runner, so run the cases and tally the scorecard with whatever tools are available.
python3claudecases.md- —— 创建
scripts/scaffold-evals.py,添加evals/{cases.md, run.py, results.md}参数则生成--classify系列文件。classify-* - —— 通过
scripts/run-evals.py运行用例,记录每个用例的时长,检查触发情况与输出有效性,打印并保存评分卡。claude -p参数仅解析用例,不消耗token。--dry-run - —— 通过
scripts/classify-evals.py对标注示例进行分类,报告准确率+混淆矩阵。claude -p参数仅解析用例,不消耗token。--dry-run - —— 评估维度选项及适用场景说明。
references/eval-dimensions.md - —— 用例格式、副作用模式及反模式说明。
references/eval-anatomy.md
若脚本无法在此运行(需要和 CLI,或不同操作系统):不要放弃任务——评估本质上就是加一个小型运行器,因此可以使用任何可用工具运行用例并统计评分卡结果。
python3claudecases.md