From mattpocock-skills
Reference for writing and editing predictable Claude Code skills: covers invocation models, description writing, information hierarchy, and pruning techniques.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mattpocock-skills:writing-great-skillsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Skill 的存在,是为了从随机系统中拧出 determinism。**Predictability** 是根本美德:agent 每次采取相同的 _process_,而不是产出相同的 output。下面所有杠杆都服务于它。
Skill 的存在,是为了从随机系统中拧出 determinism。Predictability 是根本美德:agent 每次采取相同的 process,而不是产出相同的 output。下面所有杠杆都服务于它。
粗体术语 在 GLOSSARY.md 中定义;需要完整含义时查那里。
两种选择,成本不同:
disable-model-invocation,并写 model-facing description,带丰富触发措辞("Use when the user wants..."、"mentions...")。disable-model-invocation: true;description 变成人类看到的一行摘要,不放触发列表。只有当 agent 必须自行找到该 skill,或另一个 skill 必须调用它时,才选择 model-invocation。如果它只会被手动触发,就做成 user-invoked,不付 context load。
当 user-invoked skills 多到用户记不住时,用一个 router skill 解决 cognitive load:一个 user-invoked skill,负责命名其他 user-invoked skills 以及何时使用它们。
Model-invoked description 做两件事:说明 skill 是什么,并列出应触发它的 branches。每个词都会增加 context load,所以 description 比正文更需要修剪:
Skill 由两类内容构成:steps 与 reference。它可以全是 steps、全是 reference,或两者都有。核心决策是把内容放在 information hierarchy 的哪一层:
SKILL.md 中的有序动作,是 primary tier。每个 step 以 completion criterion 结束。Criterion 要可检查,必要时要 exhaustive。SKILL.md 中的定义、规则或事实,按需查阅。SKILL.md 推到独立文件中,经 context pointer 触达。强 completion criterion 会驱动充分 legwork。把太少内容下放会让顶层膨胀;把太多内容下放会隐藏 agent 实际需要的材料。
Progressive disclosure 是把 reference 下移到链接文件中,让顶层保持清晰。Mechanics:skill folder 中的 linked .md 文件,用内容命名。多用途 skill 的每种用法都是一个 branch:所有 branches 都需要的内容内联,只有部分 branches 需要的内容放到 pointer 后面。Context pointer 的措辞,而不是目标文件,决定 agent 何时以及多可靠地触达材料。
Co-location 决定内容一旦下放后放在哪里:把一个概念的定义、规则和 caveats 放在同一 heading 下,而不是散落各处。
Granularity 是 skill 切分粒度。每次切分都会花两种 load 之一,所以只有切分有收益时才切。
让每个 meaning 都有 single source of truth:一个权威位置,行为变化时只改一处。
逐行检查 relevance:它是否仍支撑 skill 的工作?
然后逐句寻找 no-ops。把每个句子单独做 no-op test;失败时删除整句,而不是只修剪词。要激进;多数失败 prose 应删除,不应重写。
Leading word 是一个已经存在于模型预训练中的紧凑概念,agent 会在运行 skill 时用它思考(例如 lesson、fog of war、tracer bullets)。它在文本中反复出现,累积 distributed definition,并用最少 tokens 固定一片 behavior。
它从两方面服务 predictability。正文中它锚定 execution;description 中它锚定 invocation。当相同词出现在 prompts、docs 和 codebase 中,agent 更容易把 shared language 连到该 skill。
寻找机会把 skills 重构为使用 leading words。三处重复展开的 triad、花一句话绕一个概念的 description,都可能能 collapse 成一个 token。例如:
你同时赢得更少 tokens 和更尖锐的 thinking hook。
npx claudepluginhub vinvcn/mattpocock-skills-zh-cnGuide for writing predictable, maintainable skills with principles on invocation modes, description writing, information hierarchy, granularity, and progressive disclosure.
Reference for writing and editing skills that are predictable. Covers invocation mechanics, description writing, and information hierarchy.
Reference for writing and editing skills with predictable behavior. Covers model-invoked vs user-invoked invocation, description writing, and context load tradeoffs.