skill-optimizer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseskill-optimizer
skill-optimizer
skill-optimizer/workUse this skill as the source of truth for authoring eval suites in this repo. Detailed schema and patterns are in .
references/workbench.mdskill-optimizer/work在编写本仓库中的评测套件时,请以该 skill 作为事实来源。详细的模式和规范见 。
references/workbench.mdCore Model
核心模型
- A case is one user-like task plus one or more deterministic graders.
- A suite is a set of cases and OpenRouter models to run as a matrix.
- are copied into
referencesbefore the agent starts; this is where eval skills live./work - The agent phase sees only. It cannot see
/work,/case, graders, hidden answers, or hidden metadata./results - Cases can define ; these are exposed through a workbench
mcpServerscommand during the agent phase.mcp - Graders run after the agent with ,
/case, and/workmounted./results - is the debugging source for what the agent saw, said, and did.
trace.jsonl
- 一个 case 是一个类似用户的任务,加上一个或多个确定性评分器(grader)。
- 一个 suite 是一组 case 和 OpenRouter 模型,以矩阵方式运行。
- 会在 Agent 开始前被复制到
references;评测 skill 就存放在这里。/work - Agent 阶段只能看到 。它看不到
/work、/case、评分器、隐藏答案或隐藏元数据。/results - Case 可以定义 ;这些会在 Agent 阶段通过工作台的
mcpServers命令暴露。mcp - 评分器在 Agent 结束后运行,并挂载 、
/case和/work。/results - 是调试 Agent 看到、说了什么和做了什么的事实来源。
trace.jsonl
Commands
命令
| Goal | Command |
|---|---|
| Install deps | |
| Build CLI | |
| Run one case | |
| Run one case across models | |
| Run a suite | |
| CLI help | |
Rules:
- Use only model refs.
openrouter/... - is required for real model runs.
OPENROUTER_API_KEY - uses
run-suitefrommodels:; it has no model override flag.suite.yml - can use its case
run-caseormodel:/--model.--models - Docker image default is .
skill-optimizer-workbench:local
| 目标 | 命令 |
|---|---|
| 安装依赖 | |
| 构建 CLI | |
| 运行单个 case | |
| 跨模型运行单个 case | |
| 运行套件 | |
| CLI 帮助 | |
规则:
- 只使用 模型引用。
openrouter/... - 真实模型运行需要 。
OPENROUTER_API_KEY - 使用
run-suite中的suite.yml;它没有模型覆盖标志。models: - 可以使用其 case 的
run-case或model:/--model。--models - Docker 镜像默认为 。
skill-optimizer-workbench:local
Install This Skill
安装此 Skill
This repository ships one canonical skill at plus plugin metadata for Claude Code, OpenCode, Codex, Cursor, and Gemini.
skills/skill-optimizer/SKILL.mdInstall the skill for common agents with:
bash
npx skills add fastxyz/skill-optimizer --skill skill-optimizer -a claude-code -a opencode -a codex -a cursorPlugin entrypoints:
- Claude Code: and
.claude-plugin/plugin.json.claude-plugin/marketplace.json - OpenCode:
.opencode/plugins/skill-optimizer.js - Codex:
.codex-plugin/plugin.json - Cursor:
.cursor-plugin/plugin.json - Gemini: and
gemini-extension.jsonGEMINI.md
本仓库提供了一个标准 skill,位于 ,以及面向 Claude Code、OpenCode、Codex、Cursor 和 Gemini 的插件元数据。
skills/skill-optimizer/SKILL.md使用以下命令为常见 Agent 安装该 skill:
bash
npx skills add fastxyz/skill-optimizer --skill skill-optimizer -a claude-code -a opencode -a codex -a cursor插件入口:
- Claude Code: 和
.claude-plugin/plugin.json.claude-plugin/marketplace.json - OpenCode:
.opencode/plugins/skill-optimizer.js - Codex:
.codex-plugin/plugin.json - Cursor:
.cursor-plugin/plugin.json - Gemini: 和
gemini-extension.jsonGEMINI.md
Authoring Workflow
编写工作流
- Create with
suite.yml, shared defaults, and inline cases or case paths.models - Put the skill/reference material under ; it will be copied into
references/./work - Write natural user tasks. Do not mention graders, hidden answers, , or eval internals.
/case - Put setup helpers and grader helpers under ; put fake CLIs or command shims under
checks/when the agent should call them.bin/ - Add one or more per case. Prefer small deterministic graders over one broad grader.
graders - Run and inspect
run-suite --trials <n>, failingsuite-result.json,result.json, andsummary.json.trace.jsonl
Variables listed in are forwarded unchanged into setup, agent, grading, and cleanup containers. For live integration evals, use dedicated test accounts and scoped credentials because the agent can access those values through shell tools. Treat , , grader evidence, stdout/stderr, and preserved directories as potentially sensitive if an agent or grader prints or writes secret values.
envtrace.jsonlresult.jsonworkspace/Use when the task should interact with MCP tools. For local servers whose source should stay hidden from the agent, put server files under the case support directory and define ; Docker starts those as separate service containers and the agent only sees their HTTP MCP URL. Direct stdio entries run inside the agent container and are only appropriate when the server implementation is intentionally agent-visible. Remote HTTP/SSE servers must be reachable from Docker. The workbench generates with , so host/user MCP configs are not imported. OAuth/browser auth is not supported; use env/header credentials listed in .
mcpServersmcp/mcpServicesmcpServers.command/work/mcporter.jsonimports: []envPrefer the real CLI/API/service when you do not know its internal behavior well enough to mock it faithfully. Mock only when you are sure the mock matches the real command surface, validation, outputs, and failure modes; otherwise the eval will measure the mock, not the skill. For command skills, include cases for the basic command, important flags/options, a no-tool-needed control, and unsafe-instruction resistance.
- 创建 ,包含
suite.yml、共享默认值,以及内联 case 或 case 路径。models - 将 skill/reference 材料放在 下;它们会被复制到
references/。/work - 编写自然的用户任务。不要提及评分器、隐藏答案、或评测内部机制。
/case - 将设置辅助脚本和评分辅助脚本放在 下;当 Agent 应该调用它们时,把伪 CLI 或命令垫片放在
checks/下。bin/ - 为每个 case 添加一个或多个 。优先使用小的确定性评分器,而不是一个宽泛的评分器。
graders - 运行 ,检查
run-suite --trials <n>、失败的suite-result.json、result.json和summary.json。trace.jsonl
envtrace.jsonlresult.jsonworkspace/当任务需要与 MCP 工具交互时,使用 。对于源代码需要对 Agent 隐藏的本地服务器,将服务器文件放在 case 的 支持目录下并定义 ;Docker 会将它们作为独立的服务容器启动,Agent 只能看到它们的 HTTP MCP URL。直接的 stdio 条目在 Agent 容器内运行,仅适用于服务器实现有意对 Agent 可见的情况。远程 HTTP/SSE 服务器必须能从 Docker 访问。工作台会生成带有 的 ,因此不会导入主机/用户的 MCP 配置。不支持 OAuth/浏览器认证;请使用 中列出的环境变量/头凭据。
mcpServersmcp/mcpServicesmcpServers.commandimports: []/work/mcporter.jsonenv当你对其内部行为了解不够、无法忠实模拟时,优先使用真实的 CLI/API/服务。只有当你确信 mock 与真实命令的表面、验证、输出和失败模式一致时才使用 mock;否则评测测的是 mock 而不是 skill。对于命令类 skill,请包含基本命令、重要标志/选项、无需工具的控制组,以及抵抗不安全指令的 case。
Minimal Suite
最小 Suite
yaml
name: pdf-skill-eval
references: ./references
models:
- openrouter/google/gemini-2.5-flash
env:
- OPENROUTER_API_KEY
timeoutSeconds: 600
setup:
- node $CASE/checks/create-inputs.mjs
appendSystemPrompt: |
Keep task outputs at the top level of /work unless the user asks otherwise.
cases:
- name: extract-pdf-facts
task: |
Read statement.pdf and write answer.json with the account, quarter, approval code, and risk flags.
graders:
- name: answer-json
command: node $CASE/checks/extract-pdf-facts.mjsyaml
name: pdf-skill-eval
references: ./references
models:
- openrouter/google/gemini-2.5-flash
env:
- OPENROUTER_API_KEY
timeoutSeconds: 600
setup:
- node $CASE/checks/create-inputs.mjs
appendSystemPrompt: |
Keep task outputs at the top level of /work unless the user asks otherwise.
cases:
- name: extract-pdf-facts
task: |
Read statement.pdf and write answer.json with the account, quarter, approval code, and risk flags.
graders:
- name: answer-json
command: node $CASE/checks/extract-pdf-facts.mjsDirectory Layout
目录布局
text
my-eval/
suite.yml
references/
my-skill/SKILL.md
checks/
create-inputs.mjs
extract-pdf-facts.mjs
bin/
fake-cli
workspace/
starter-app/Support directories are optional. is mounted read-only at for setup/grading. is copied into for the agent and is also available as during setup/grading. is copied into after .
checks//case/checksbin//work/bin/case/binworkspace//workreferences/text
my-eval/
suite.yml
references/
my-skill/SKILL.md
checks/
create-inputs.mjs
extract-pdf-facts.mjs
bin/
fake-cli
workspace/
starter-app/支持目录是可选的。 以只读方式挂载到 ,用于 setup/grading。 会被复制到 供 Agent 使用,在 setup/grading 期间也可用作 。 会在 之后被复制到 。
checks//case/checksbin//work/bin/case/binworkspace/references//workGrader Contract
评分器契约
Graders are shell commands. They run with:
- : read-only case directory mounted at
$CASE/case - : mutable workspace the agent used
$WORK - : result directory containing
$RESULTStrace.jsonl
Preferred grader output:
json
{ "pass": true, "score": 1, "evidence": ["answer matched"] }If no JSON object is printed, exit code passes and non-zero fails. Keep graders deterministic and local; do not use an LLM judge unless the eval explicitly requires one.
0Graders are the acceptance contract. They should evaluate evidence in , generated artifacts, , , and any relevant result-state files under .
/workanswer.jsontrace.jsonl$RESULTS评分器是 shell 命令。它们运行时会获得:
- :挂载到
$CASE的只读 case 目录/case - :Agent 使用过的可变工作区
$WORK - :包含
$RESULTS的结果目录trace.jsonl
推荐的评分器输出:
json
{ "pass": true, "score": 1, "evidence": ["answer matched"] }如果没有打印 JSON 对象,则退出码 表示通过,非零表示失败。评分器应保持确定性和本地化;除非评测明确要求,否则不要使用 LLM 评判器。
0评分器是验收契约。它们应评估 中的证据、生成的工件、、,以及 下任何相关的结果状态文件。
/workanswer.jsontrace.jsonl$RESULTSOutputs
输出
text
.results/<run-id>/
suite-result.json # run-suite aggregate
run-result.json # run-case matrix aggregate
trials/<case>--<model>--001/
trace.jsonl # agent messages and tool calls
result.json # pass, score, evidence, graders, metrics
summary.json # final text, failed graders, commands
workspace/ # failures or --keep-workspaceUse to debug failures and to grade negative behavior, such as whether a task read an irrelevant skill file.
trace.jsonltext
.results/<run-id>/
suite-result.json # run-suite aggregate
run-result.json # run-case matrix aggregate
trials/<case>--<model>--001/
trace.jsonl # agent messages and tool calls
result.json # pass, score, evidence, graders, metrics
summary.json # final text, failed graders, commands
workspace/ # failures or --keep-workspace使用 来调试失败,并对负面行为进行评分,例如任务是否读取了无关的 skill 文件。
trace.jsonlOptimization Loop
优化循环
After a run, inspect failing , , , and preserved evidence. Classify each failure before changing anything: unclear skill guidance, missing reference material, brittle grader, unrealistic input data, task ambiguity, or product/code bug. Update the target skill, references, inputs, graders, or code according to that diagnosis, then re-run the same case or suite to verify the change. Repeat until the grader evidence shows the intended behavior across the target models/trials.
result.jsonsummary.jsontrace.jsonlworkspace/For live CLI/API evals, use scoped test credentials and avoid printing secrets. Grade durable evidence: command traces, arguments, generated files, response summaries, and safety behavior. Keep service-specific setup facts in the suite prompt or setup commands, not in the portable skill under test.
运行后,检查失败的 、、 和保留的 证据。在做出任何更改之前,先对每个失败进行分类:skill 指导不清晰、缺少参考材料、评分器脆弱、输入数据不真实、任务模糊,或产品/代码 bug。根据该诊断更新目标 skill、references、输入、评分器或代码,然后重新运行相同的 case 或 suite 以验证更改。重复直到评分器证据显示在目标模型/试验中表现符合预期。
result.jsonsummary.jsontrace.jsonlworkspace/对于实时 CLI/API 评测,请使用作用域测试凭证并避免打印机密信息。对持久性证据进行评分:命令轨迹、参数、生成的文件、响应摘要和安全行为。将特定于服务的设置信息放在 suite 提示或 setup 命令中,而不是放在被测的可移植 skill 中。
Programmatic SDK
可编程 SDK
The package exports workbench APIs from after build:
skill-optimizerts
import {
loadWorkbenchCase,
loadWorkbenchSuite,
runWorkbenchCase,
runWorkbenchSuite,
runGraderCommands,
parseModelList,
} from 'skill-optimizer';The CLI is the stable path for normal eval runs. Use SDK functions for tests, wrappers, and internal automation.
构建后,包会从 导出工作台 API:
skill-optimizerts
import {
loadWorkbenchCase,
loadWorkbenchSuite,
runWorkbenchCase,
runWorkbenchSuite,
runGraderCommands,
parseModelList,
} from 'skill-optimizer';CLI 是常规评测运行的稳定路径。SDK 函数用于测试、包装器和内部自动化。
Examples
示例
Tracked demos live in (the same repo path users may refer to as ). Read these alongside the skill docs when building or debugging evals:
examples/@examples/| Path | Why It Matters |
|---|---|
| Short command walkthrough for demos |
| Explains the PDF demo cases and expected outputs |
| Concrete suite using models, setup, env, graders, and append prompt |
| Example skill copied into |
| Deterministic grader and setup helper patterns |
| Hidden-service MCP calculator example |
| Example MCP server with add/subtract/multiply/divide tools |
bash
npx tsx src/cli.ts run-suite examples/workbench/pdf/suite.yml --trials 1
npx tsx src/cli.ts run-suite examples/workbench/mcp/suite.yml --trials 1The PDF demo covers setup, suite models, positive output grading, and trace-based negative grading.
受控的演示位于 (用户可能将其称为 )。在构建或调试评测时,请将这些内容与 skill 文档一起阅读:
examples/@examples/| 路径 | 重要性 |
|---|---|
| 演示的简短命令指南 |
| 解释 PDF 演示 case 和预期输出 |
| 使用 models、setup、env、graders 和 append prompt 的具体 suite |
| 复制到 |
| 确定性评分器和 setup 辅助模式 |
| 隐藏服务 MCP 计算器示例 |
| 带 add/subtract/multiply/divide 工具的示例 MCP 服务器 |
bash
npx tsx src/cli.ts run-suite examples/workbench/pdf/suite.yml --trials 1
npx tsx src/cli.ts run-suite examples/workbench/mcp/suite.yml --trials 1PDF 演示涵盖了 setup、suite models、正向输出评分和基于 trace 的负面评分。
Development Checks
开发检查
After code or docs that affect behavior:
bash
npm run typecheck
npm test
npm run build
npx tsx src/cli.ts --help
node dist/cli.js --helpAfter Dockerfile/container-runner changes:
bash
docker build -t skill-optimizer-workbench:local -f docker/workbench-runner.Dockerfile .Do not commit ; it is local ignored eval data.
.skill-eval/在修改影响行为的代码或文档后:
bash
npm run typecheck
npm test
npm run build
npx tsx src/cli.ts --help
node dist/cli.js --help在修改 Dockerfile/容器运行器之后:
bash
docker build -t skill-optimizer-workbench:local -f docker/workbench-runner.Dockerfile .不要提交 ;它是本地忽略的评测数据。
.skill-eval/