开源 meta-skill skill-diet:给 Agent Skill 减重 70-80% token 并用评测保证不降级
开源 skill-diet:给 Agent Skill 减重 70-80% token 并用评测保证不降级
@nicopreme 开源了管理其他 skill 的 meta-skill skill-diet,可压缩臃肿的 SKILL.md、修正与工具不符的内容,并把分层加载原则写进后续增补规则。
meng shao· @shao__meng · X·2026-10-27 17:58· 58 分钟前AI 评分66
AI 导读
@nicopreme 开源了管理其他 skill 的 meta-skill skill-diet,可压缩臃肿的 SKILL.md、修正与工具不符的内容,并把分层加载原则写进后续增补规则。
正文 · 原文
[开源 Skills 推荐] skill-diet 给 Skill 减重:用评测保证「更瘦但不更差」
skill-diet 是一个管其他 skill 的 meta-skill:一边把臃肿 SKILL.md 压薄并校对工具是否过时,一边给后续每次改 skill 立规矩;瘦身版只有在「旧 skill / 新 skill / 无 skill」同任务评测里至少不输才会留下。作者 @nicopreme 测试在真实 skill 上可砍 70–80% token,且测出文档里已失效的命令。
https://github.com/nicobailon/skill-diet
Agent 每次用 skill 都会读完整 SKILL.md。常见冗余是:多数任务用不到的细节、模型本就会的常识、写给人看的说明、可用一条原则代替的长列表;教 CLI/API/SDK/MCP 的 skill 还会抄一份工具手册,工具一变就过期。让 agent「更新一下 skill」通常只会越写越长。
它做了两件事
· Put on a diet:重写、修与工具不符之处;只有评测过关才保留瘦版。
· Keep lean:之后每次增补都先过一套门槛,避免教训和代码变更把体积又养回来;相对上次 diet 大约涨 10% 就要再做一轮。
可以直接说:put the deploy skill on a diet / is this skill still accurate for the current CLI? / add this lesson to …。
分层:事实放在「刚好够用」的最低层
· skill description:每个场景一条触发,几乎每个会话
· SKILL.md:几乎每任务都要的规则,启用该 skill 时
· references/:少数任务才要的细节,点到该场景时
· 工具自带 help:flag、合法值、示例,选到那条命令时
· 工具回复 / 报错 / checker:正确名、修法、下一步,调用出错或猜错时
教工具的 skill 还多两步:精确字段名留在工具侧;机械错误优先靠更清晰报错、测试或 linter,而不是再写一段 prose。只用人工触发的 skill 可标 user-only,避免 description 每会话白占配额。
一次 diet 在做什么
测体积与典型任务加载量 →(若教工具)用运行或源码行证明 skill↔工具不一致;从 session log 找高频调用、只把高频写全;看 agent 是否真打开 skill,少打开则把规则下沉到工具报错;必要时裁自家工具 schema(schema 每请求都带)→ 砍模型已知与仅人类需要的文字 → 同任务跑旧 / 新 / 无 skill,瘦版不优于「随机波动可解释」就失败。命令优先写成 agent 会敲的 usage lines(作者给的相对代价:表 1.5×、TS 类型 1.6×、JSON Schema 2.8×、OpenAPI 4.7×)。
之后每次改 skill:停在第一个能处理的步骤
· 先修工具(报错 / check),别堆文。
· 新会话不写也会对,就别加。
· 改已有那一行,别另起一段。
· 放到仍「来得及」的最低层。
· 写规则不写故事(故事进 commit)。代码改了 skill 依赖的名字或行为,同一次变更里改 skill;commit 记前后体积。
I've been dogfooding "skill-diet", a skill for slimming down agent skills and keeping them correct. most skills load far more text than a task needs, and some parts often go stale. it also gets worse over time as AI updates skills. skill-diet cuts what the model already does without being told, moves rarely needed detail into files it only reads when needed, and fixes what no longer matches the tool. then it runs the same tasks with the old skill, the new one and no skill, and keeps the new one only if agents do at least as well. on my own skills: 70–80% fewer tokens, same results. http://github.com/nicobailon/skill-diet在 X 查看被引用的帖子
来源:meng shao · x.com
来源:RadarAI · aihot.news