/vault-software-development:skill-doctorfrom vault-software-development
从真实会话记录里给 Agent 和它正在用的 Skill 打分,只根据失败会话的证据起草一处最小改动,再走 PR、人审合并、可回滚、可回归。用户说「Agent 老犯同一个错」「Skill 不触发 / 改了没效果」「从会话日志里找问题改 skill」「给 agent 打分」「self-improving agent」「skill doctor」「让 agent 改自己的说明书」时使用。不用于从零写新 Skill、审查单个 Skill 文档质量、改业务代码或给模型本身评测。
Ships in vault-software-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
让 Agent 的每一次改进,像一次代码提交那样被管理:失败会话取证 → 最小改动 → PR 与人审合并 → 可回滚。
模型会把每一个会话当成第一次见面,所以「教过它一次」不会留下任何东西。这个 Skill 修的不是模型,是反馈回路:把人类纠正从聊天记录里捞出来,落到一个文件上,让下次真的生效,并且留下证据、审查记录和回退路径。
打分与写 diff 由模型完成;计数、加权、机械闸由脚本完成。没有任何一步允许 Agent 自己判定自己合格。
| 你手上是这种情况 | 用这个 Skill? |
|---|---|
| 同一个错误反复出现,每次都要重新纠正 | ✅ |
| 装了一份 Skill,但它从不触发,或者触发了也不按写的做 | ✅ |
| 有本地会话 / 日志 / PR 评论,想把「纠正」变成文件里的规则 | ✅ |
| 要给 Agent 或一套 Skill 打分,并给出可执行的最小改动 | ✅ |
| 从零写一份新 Skill | ❌ 用 skill-trigger(描述与触发)或 writing-for-agents |
| 只审一份 Skill 文档写得好不好 | ❌ 用独立评审清单,读文本就够 |
| 改业务代码、调模型参数、做模型选型 | ❌ 不是本 Skill 的范围 |
transcripts/。proposed/,由人把它变成 PR。0 预检(harness、隐私、变量) 🛑 读不到会话就停
1 收集 ── prepare_run.py → inventory.json 🛑 空窗就停
2 打分 ── 模型按四个 rubric 逐会话打标签 → scores.json
3 聚合 ── rubric_score.py → scorecard.json
4 取证 ── 只在失败会话里聚类,过 filing bar
5 改稿 ── proposed/<skill>/SKILL.md,最小 diff
6 机械闸 + 人审 ── check_skill_edit.py → PR → 合并
7 回归 ── 黄金集重跑,没有 harness 就不自动合并
8 报告、清理与交接
先把四个变量定下来(值按你的机器填),后面的命令只用变量:
SESSIONS_DIR="$HOME/agent-sessions" # 已导出的会话,jsonl,格式见第 1 步
SKILLS_REPO="$PWD/skills" # 项目自己的 skill 目录
SKILLS_GLOBAL="$HOME/skills" # 全局 skill 目录
CURRENT_SKILL="$SKILLS_REPO/example/SKILL.md" # 第 6 步要改的那份
REPORT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/skill-doctor-XXXXXXXX")"
export SESSIONS_DIR SKILLS_REPO SKILLS_GLOBAL CURRENT_SKILL REPORT_DIR
$REPORT_DIR。它是临时目录,关机器即失,不要往用户仓库里写。Windows(PowerShell)里 python3、mktemp、export 不可用,换成:
$SESSIONS_DIR = "$env:USERPROFILE\agent-sessions"
$SKILLS_REPO = "$PWD\skills"
$SKILLS_GLOBAL = "$env:USERPROFILE\skills"
$REPORT_DIR = Join-Path $env:TEMP ("skill-doctor-" + [guid]::NewGuid().ToString("N").Substring(0,8))
python -X utf8 scripts/prepare_run.py --sessions "$SESSIONS_DIR" `
--skills "repo=$SKILLS_REPO" --skills "global=$SKILLS_GLOBAL" --out "$REPORT_DIR"
收尾同样是 Remove-Item -Recurse -Force "$REPORT_DIR\transcripts"。
把会话导出成下面的行格式(每行一个会话),Skill 里的脚本只做校验、抽样和计数:
{"session_id": "2026-11-16T09-12-ab12", "started_at": "2026-11-16T09:12:00Z",
"project": "/repo/app",
"messages": [{"role": "user", "text": "..."}, {"role": "assistant", "text": "..."}]}
python3 scripts/prepare_run.py \
--sessions "$SESSIONS_DIR" \
--skills "repo=$SKILLS_REPO" --skills "global=$SKILLS_GLOBAL" \
--days 45 --max-sessions 12 --seed 7 \
--out "$REPORT_DIR"
0:inventory.json 里有 sessions_sampled、skills_found 与 sampling。2:窗口内确实没有会话。告诉用户可以放宽 --days 或换目录,然后停,不要凭空编造会话。3:参数写错、声明的 skill 目录不存在,或窗口内的会话全被拒(导出坏了)。修输入重跑,
不要按「空窗」处理,也不要把「目录名打错」当成「没有 Skill」。--seed 就按该种子打散。实际规则记在
sampling 里。抽样时还看不到哪次失败,所以它只保证「不被单个项目占满」,不保证失败样本均衡。inventory.json 里同时记了 retention:哪些文件跑完要保留、transcripts/ 什么时候删。rejected 里,不中断;rejected 非空时要在报告里说清丢了什么。skills_found 为 0 可以继续:此时报告的作用是证明「该建 Skill 了」,skill_coverage 记 0。逐个读 $REPORT_DIR/transcripts/*.txt,按 references/rubrics.md 的四个维度打标签:efficiency、
code_quality、procedure_compliance、verbosity。
把结果写进 $REPORT_DIR/scores.json,形状照 templates/scores.json:
skills_used(数组,没用到就写 [])。它决定 skill_coverage,不能省。insufficient_evidence 只允许出现在 code_quality;其它维度用它会被脚本拒绝。python3 scripts/rubric_score.py \
--scores "$REPORT_DIR/scores.json" \
--inventory "$REPORT_DIR/inventory.json" \
--out "$REPORT_DIR"
inventory.json 里,标签必须合法,理由不能为空。curve(x) = 0.5 + 0.5x 曲线化后计入。failed_conversations = 任一适用维度原始分低于 0.5 的会话。notes 与报告里写明;
这是保底,不是奖励。5:标签拼错、理由缺失、同一会话重复打分、会话 id 不在 inventory、某维度没有任何有效分数,
或 scores.json 覆盖的会话集合与抽样不一致。确实只能评一部分时显式加 --allow-partial,并把原因
写进报告。scorecard.json 会同时给出 failed_conversations 与 failed_dimensions(哪个会话的哪一维低于 0.5)。
取证时 scorer 必须取其中一个维度,否则闸门会指出这句证据没有落在失败维度上。只读 failed_conversations。读完 references/evidence.md 的准入条:一条改动要同时满足
不满足就明说「不改」及原因。零改动是好结果,不是失败。避免把「模型这次选了另一条路」当成规则缺口。
$REPORT_DIR/proposed/<skill-name>/SKILL.md,同时在 $REPORT_DIR/evidence.json 里给每条
改动挂上会话 id、维度、一句话引用。格式见 templates/evidence.json。evidence.json 里标明它的缺口来自哪些失败会话。references/change-discipline.md。python3 scripts/check_skill_edit.py \
--current "$CURRENT_SKILL" \
--proposed "$REPORT_DIR/proposed/example/SKILL.md" \
--scorecard "$REPORT_DIR/scorecard.json" \
--evidence "$REPORT_DIR/evidence.json" \
--base-dir "$(dirname "$CURRENT_SKILL")" \
--transcripts "$REPORT_DIR/transcripts" \
--name example
--current 必填:没有它就没有「改前」可比,行数上限会退化成新文件上限。只有创建一份从未发布过的
Skill 时才用 --new-skill。
--base-dir 是被改的那份 Skill 的真实目录:proposed 文件只装正文,相对链接要能对回原目录,
否则 references/… 会全部判成断链。省略时用 --current 的上级目录;新 Skill 才用 proposed 自己的目录。
闸门检查项(全部失败都会列出来):
| 检查 | 失败条件 |
|---|---|
| frontmatter | 缺 YAML 块;name 与目录名不符;description 短于 80 字 |
| 改动规模 | 与改前完全一致;变更行数超过 max(30, 原文行数 × 20%);或删掉原文 40% 以上 |
| 新文件规模 | --new-skill 时超过 400 行 |
| 证据来源 | 没有证据;session_id 不在 scorecard.failed_conversations 里;scorer 必须是该会话真正失败的维度 |
| 证据形态 | 引用少于 6 字或超过 400 字;声明的那句(≥6 字,空格归一化)出现在 proposed 正文里 |
| 引用真伪 | 传了 --transcripts 时,引用必须逐字出现在该会话的转写里(空格归一化后);找不到该会话的文件也算失败 |
| 整段照抄 | 传了 --transcripts 时,新增的行里出现中文 8 字以上(或纯英文 / 路径 24 字以上)的转写片段;跨行同样覆盖。原有行不算新照抄 |
| 敏感内容 | 密钥、私钥块、未完成标记与模板空字段(名单见 scripts/check_skill_edit.py 顶部) |
| 链接 | 相对链接或 references/… 路径在 --base-dir 下不存在 |
退出码:0 可提交;1 有拦截项;3 参数错误(含漏了 --current);5 文件读不到或不是 UTF-8。输出里的 policy
记录本次实际使用的上限,改过默认值要在 PR 里写明理由。它只能证明改动小、可追溯、能落地,不能证明
改得对——不要把它当成质量结论。
提交要求(细节见 references/pr-gate.md):
templates/pr-body.md,必须包含:失败会话 id、触发的维度、引用的一句话、改动前后行为差异、回归结果。git revert <sha> 即可恢复,不依赖记忆或数据库。| 任务类型 | 回归方式 | 能不能自动合并 |
|---|---|---|
| 可验证(能跑测试、能比对输出) | 先搭评测环境与参考语料,改前改后各跑一遍,差异要能解释 | 全绿 + 人审后可以 |
| 不可完全验证(评论质量、文案、判断类) | 黄金输出集 + 领域专家逐条看 | 不可以,必须人点头 |
顺序不能反:harness 没搭好之前,不让 Agent 自己挑自己;没有裁判的训练只会跑偏。细则见
references/verifiability.md。
按 templates/report.md 出报告:等级、三个最值钱的发现、每条建议的证据与 diff、没改的项及原因、
本次边界(样本量、窗口、未验证项)。
收尾:
: "${REPORT_DIR:?refusing to delete without REPORT_DIR}"
rm -rf "$REPORT_DIR/transcripts" # 会话原文只在本次运行内存在
保留 inventory.json(会话 id、项目、窗口、抽样规则)、scores.json、scorecard.json、evidence.json 与
proposed/;只删 transcripts/。报告里只留会话 id + 一句话,不留全文;需要回查的人用 id 自己去原始
记录里找。中断后重跑:inventory.json 还在,就不必重新导出会话;scores.json 已写完的会话照原样复用。
结尾必须回答:「要不要我把这几条应用到你的 Skill?应用时我会写 proposed/ 目录并跑机械闸,
合并仍然由你或你的 reviewer 做。」
| 命令 | 期望 | 说明 |
|---|---|---|
python3 scripts/selftest.py | 43/43 checks passed,退出 0 | 装完先跑;三个脚本合起来覆盖本文列出的 0/1/2/3/5 |
python3 scripts/prepare_run.py … | 退出 0;空窗退出 2;参数错退出 3 | 空窗要停下来说明,不编数据 |
python3 scripts/rubric_score.py … | 退出 0;参数错退出 3;非法输入退出 5 | 会话 id 与标签都可复核 |
python3 scripts/check_skill_edit.py … | 通过 0,拦截 1;参数错 3;读不到 5 | 只做机械判断,不是质量结论 |
Windows 下把表里的 python3 换成 python -X utf8,$(dirname "$X") 换成 (Split-Path $X)。
一次合格的运行,四个条件同时成立:报告目录里同时有 inventory.json、scores.json/scorecard.json、
evidence.json、proposed/;每条改动都能回到一个失败会话;check_skill_edit.py 退出 0;报告写明了
没改的项和原因。selftest.py 通过只证明脚本行为与本文的退出码一致,不证明这次改动是对的。
references/failure-modes.md。方法论来自 Warp 的自我改进闭环与 Anthropic 的 Agent 评估实践,本 Skill 是可独立运行的中文蒸馏版, 含自己的脚本与闸门:
scorers 评分表),抓取于 2026-11-11。案例与真实数字见 examples/worked-example.md。
LICENSE (opens in a new tab)PROVENANCE.md (opens in a new tab)examples/evidence.json (opens in a new tab)examples/sample-sessions.jsonl (opens in a new tab)examples/worked-example.md (opens in a new tab)references/change-discipline.md (opens in a new tab)references/evidence.md (opens in a new tab)references/failure-modes.md (opens in a new tab)references/pr-gate.md (opens in a new tab)references/rubrics.md (opens in a new tab)references/verifiability.md (opens in a new tab)scripts/check_skill_edit.py (opens in a new tab)scripts/prepare_run.py (opens in a new tab)scripts/rubric_score.py (opens in a new tab)scripts/selftest.py (opens in a new tab)templates/evidence.json (opens in a new tab)templates/pr-body.md (opens in a new tab)templates/report.md (opens in a new tab)templates/scores.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub yhyu13/agentskillsvault --plugin vault-software-developmentOther plugins' skills for the same job
25 skills in this plugin
/agent-desktopOperate desktop applications on macOS, Windows and Linux through native accessibility trees, using the agent-desktop CLI. Use when an AI agent must see or act on a desktop GUI: click buttons, fill forms, read UI state, navigate menus, toggle checkboxes, scroll, drag, type text, press shortcuts, take screenshots, manage windows, use the clipboard, launch or close apps, read notifications. Triggers on: "click button", "fill form", "open app", "read UI", "computer use", "operate desktop", "accessibility tree", "snapshot app", "type into field", "navigate menu", "toggle checkbox", "take screenshot", "desktop automation", "agent-desktop", or any desktop GUI task on macOS, Windows or Linux.
/agent-eval-loopBuild a Skill + Eval + Verification triad for any agent workflow, then
ascend the trust curve from local observation to cloud automation. Use
this when the user wants to (1) encode a team best practice as a reusable
skill, (2) write a unit test for an agent skill ("skill is hallucinating,
how do I check?"), (3) establish a trust loop before running cloud agents
at scale, or (4) move from "agent I have to babysit" to "agent I trust
to ship PRs to main." This skill teaches the methodology distilled from
the Cursor team's public talk by a SpaceXAI engineer.