再学 AI
第 40 课 / writing-great-skills
历史对照阅读 → 对照 → 问答 → 场景

历史对照:技能可预测性的设计语言

这篇历史参考文档把可预测性定义为反复遵循稳定过程,而不是每次输出完全相同。

历史文件,不在当前目录

本课使用下方注明的历史提交原文,帮助理解旧文章和旧提示词。请勿据此认定当前版本仍能直接调用该名称。

还不清楚 Skill、Agent、安装和调用?先读 从零开始的6节入门课

在关系图中查看 writing-great-skills 与其他技能的关联 →

先把必要的概念讲清楚

这是专门讨论 skill 写法的历史参考。与当前 writing-for-agents 对照,可以看见同一套设计思想从技能文档扩展到所有 Agent 读取的文档。

下面是老师补充的入门说明;原作者的要求保留在中英对照正文中。所有例子均为帮助理解而构造的教学情境。

frontmatter|Markdown 文件头元数据

文档最前面两条 --- 之间的键值信息,如 name、description。正文讲怎样做事,文件头帮助宿主识别名称、用途和调用方式。保留字段名称是为了维持技术含义,不是要求你熟悉英文;具体支持哪些字段取决于客户端。

context pointer|上下文资料指引

告诉 Agent 在什么条件下去读哪份材料的短指引。例如“新增或修改数据写入时,先读权限规则文档”。它同时承担地址与触发条件两项作用。只有“见文档”太模糊,可能找不到或不知道何时需要;一股脑放入所有内容又会占用上下文。

context|Agent 当前可用的上下文

模型这一轮实际能使用的请求、对话、指令和已读文件内容。它不是电脑上所有资料,也不是永久记忆。文件存在但没被读到,就不一定参与推理。交接文档应指明当前目标、进度、关键证据位置和下一步,让新会话能够恢复必要背景。

context load / cognitive load|上下文负担与人的认知负担

前者是材料占用模型当前可处理的容量与注意力;后者是人需要记住有哪些工具、何时该用的负担。把所有指令都常驻会增加前者;把所有技能都藏起来靠人记忆会增加后者。目标是合理分配,而非单纯追求文档最短。

acceptance criteria|验收条件

明确规定结果满足什么才算完成,应尽量可观察、可检验。例如“收藏后刷新页面仍可见,重复点击只保留一条”。“体验很好”“代码完善”没有明确边界,难以判断。验收条件关注结果,不是把实现步骤换个标题列出来。

读原文,理解每一步为什么这样做

左右内容按小节对应;窄屏先中文、后英文。两种语言均完整展示,对应讲解紧接在小节之后。译文传达原文要求;老师讲解补充概念、原因、例子与适用边界。

译注

本文是历史版本,对调用方式的说明依赖具体宿主实现。学习时区分作者的规则与跨客户端通用规范。

中文译文English · 英文原文
中文译文
name: writing-great-skills
description: "编写和编辑优秀 skill 的参考:让 skill 可预测的词汇与原则。"
disable-model-invocation: true
English · 英文原文
name: writing-great-skills
description: Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.
disable-model-invocation: true
中文译文

技能尝试让具有随机性的系统遵循更稳定的过程。核心品质是可预测:每次走相同的工作方法,而非生成相同输出。下面原则都为这个目标服务。

加粗术语的完整定义见 GLOSSARY.md

English · 英文原文

A skill exists to wrangle determinism out of a stochastic system. Predictability — the agent taking the same process every run, not producing the same output — is the root virtue; every lever below serves it.

Bold terms are defined in GLOSSARY.md; look them up there for the full meaning.

中文译文

选择调用方式

两种安排承担不同成本:

  • 模型可调用:保留面向模型的描述,Agent 可自行选择,其他技能也可引用,人仍能输入名称。描述始终占上下文。原文配置方式是不设置 disable-model-invocation,并在描述中写清适用请求、关键词等触发情形。
  • 用户主动调用:原文描述为只有人输入名称才触发,模型及其他技能不主动调用。设置 disable-model-invocation: true,描述改为供人阅读的一句话简介,去掉触发清单。按作者的模型,这降低上下文成本,但人需要记住技能存在。

只有 Agent 需要自行发现,或其他技能需要使用时,才选择模型调用。始终由人手动启动的,采用用户调用。

当手动技能多得难记,可以增加一个路由技能,集中说明其他技能分别什么时候使用。

English · 英文原文

Invocation

Two choices, trading different costs:

  • A model-invoked skill keeps a description, so the agent can fire it autonomously and other skills can reach it (you can still type its name too). It contributes to context load — the description sits in the window every turn. Mechanics: omit disable-model-invocation, and write a model-facing description with rich trigger phrasing ("Use when the user wants…, mentions…").
  • A user-invoked skill strips the description from the agent's reach: only you, typing its name, can invoke it — and no other skill can. Zero context load, but it spends cognitive load: you are the index that must remember it exists. Mechanics: set disable-model-invocation: true; the description becomes human-facing — a one-line summary, trigger lists stripped.

Pick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.

When user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a router skill: one user-invoked skill that names the others and when to reach for each.

老师讲解 · 对应上方原文 · 含教学举例

调用方式决定谁负责发现这项能力

模型调用的描述留在可见技能目录里,Agent 可以根据触发条件选择;用户调用的技能则更多依赖人记得何时使用。作者通过 disable-model-invocation 表达这种区分,实际解释仍取决于宿主。

例如通用设计参考需要被其他技能找到,就需要可访问的入口。一个只由你手工触发的写作命令,可以减少常驻描述负担。

路由 skill 像目录,帮助人不用记住所有命令。它不会因为列出了名字就自动安装依赖,也不能保证所有客户端的模型调用规则相同。

安装、发现和调用分别意味着什么?

安装通常是把技能放到支持它的客户端能够发现的位置,或通过该客户端的管理方式注册。 它不是把 Markdown 训练进模型,也不是让所有聊天自动拥有脚本权限。

发现阶段,客户端可能向模型提供技能名称和描述。模型根据任务判断需要哪些说明,再读取正文;用户也可能显式选技能。正文中引用其他文件时,还要按需要继续读取。

例如“检查测试入口”这个请求,可以与清楚描述的 tdd 相关联。但只有名字叫 tdd、描述却写“帮助开发”,发现就不可靠。

本历史文档将 disable-model-invocation 的可见性和跨技能调用讲得很绝对。实际元数据支持、描述是否仍显示、手动语法和工具行为由客户端实现,不能把作者此处的模型套到所有 Codex、Claude 或 ChatGPT 版本。

路由技能像索引,帮助你选择;它不能凭列出名称就让未安装技能存在。学习使用前,分别确认客户端能找到说明、实际已加载说明,以及执行需要的工具是否可用。

中文译文

描述怎样写

模型可见的 description 要说明能力和不同触发分支。每个词都增加上下文成本,因此更需要节制:

  • 核心词放在前面,帮助触发。
  • 一种分支只描述一次。同义说“用 TDD 开发”和“先测试再开发”,并不一定是两种不同用途。
  • 删除正文已有的身份介绍,保留触发条件,以及其他技能何时应调用它。
English · 英文原文

Writing the description

A model-invoked description does two jobs — state what the skill is, and list the branches that should trigger it. Every word increases context load, so a description earns even harder pruning than the body:

  • Front-load the skill's leading word — the description is where it does its invocation work.
  • One trigger per branch. Synonyms that rename a single branch are duplication — "build features using TDD … asks for test-first development" is one branch written twice. Collapse them; keep only genuinely distinct branches.
  • Cut identity that's already in the body. Keep the description to triggers, plus any "when another skill needs…" reach clause.
老师讲解 · 对应上方原文 · 含教学举例

描述是触发线索,不是宣传口号

“帮助处理文档”过于宽泛,Agent 无法区分它与其他文档能力。“处理 PDF 的文本提取、表单填写或合并”给出更具体边界。

但同一用途重复多个近义词也会增加负担。应保留真正不同的分支,例如阅读提取与编辑填写,而不是把“写功能、开发功能、实现功能”列三次。

描述需要足够明确以便发现,正文再说明执行步骤。不要把整个详细流程挤进 description。

中文译文

信息层次

技能由步骤与参考组成,可以只有一种,也可以混合。按当前使用需要分层:

  1. 主文件步骤:说明按顺序做什么,每步有完成条件。条件应可检查,需要时要求完整覆盖,例如每个修改模型都被说明,而不是只交一份可能不完整的清单。模糊条件容易使 Agent 提前结束。
  2. 主文件参考:按需查询定义、规则和事实。审查规则全部同级很合理;本文自身就是参考型技能。
  3. 独立参考资料:放到 SKILL.md 之外,由 context pointer 指向,只在相关条件下加载。可以是技能目录中的 GLOSSARY.md,也可以是技能系统之外的文档。

要求充分的完成标准,会推动深入调查。它既适用于步骤,也适用于“每条规则都已检查”的平行参考。

放出去太少,主文件臃肿;太多,又可能隐藏必需材料。逐步披露就是把部分参考移到明确命名的链接文件,让主流程清楚。所有分支都需要的留在正文,只有部分分支需要的按条件读取。

能否稳定读到资料,取决于引用的措辞。概念定义、规则和注意事项还应就近放在同一标题下,不分散到各处。

English · 英文原文

Information hierarchy

A skill is built from two content types — steps and reference — that mix freely: a skill can be all steps, all reference, or both. The core decision is which to use and where each sits on the information hierarchy, a ladder ranked by how immediately the agent needs the material:

  1. In-skill step — an ordered action in SKILL.md, the primary tier: what the agent does, in order. Each step ends on a completion criterion, the condition that tells the agent the work is done. Make it checkable (can the agent tell done from not-done?) and, where it matters, exhaustive ("every modified model accounted for", not "produce a change list") — a vague criterion invites premature completion.
  2. In-skill reference — a definition, rule, or fact in SKILL.md, consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung) — a fine arrangement, not a smell. This skill is all reference.
  3. External reference — reference pushed out of SKILL.md into a separate file, reached by a context pointer, loaded only when the pointer fires. (Spans disclosed reference — a sibling file like GLOSSARY.md, still part of the skill — through fully external reference that lives outside the skill system and any skill can point at.)

A demanding completion criterion drives thorough legwork — the digging the agent does within the work — whether the skill has steps or not, since "every rule applied" binds flat reference just as "every step done" binds a sequence.

Push too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.

Progressive disclosure is the move down the ladder — out of SKILL.md into a linked file — so the top stays legible. Mechanics: a linked .md file in the skill folder, named for what it holds (this skill discloses its full definitions to GLOSSARY.md). Some skills are used in more than one way, and each distinct way is a branch — different runs taking different paths through the skill. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. A context pointer's wording, not its target, decides when and how reliably the agent reaches the material.

Where the ladder decides how far down a piece sits, co-location decides what sits beside it once there: keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it.

老师讲解 · 对应上方原文 · 含教学举例

把行动步骤放在容易看见的位置

步骤是执行顺序,参考是按需查阅的规则或定义。无关分支的详细说明放外部文件,用明确指针触发;每条分支都需要的内容留正文。

例如评审的通用比较范围所有任务都要知道,数据库迁移细则只有迁移变更需要。这样每次执行看到的重点更集中。

完成标准要可检查且必要时要求完整覆盖。它不仅适用于步骤清单,也能要求“所有适用规则已检查”,使参考型文档同样有清楚结束条件。

中文译文

什么时候拆成多个技能

拆分粒度增加时,会增加模型上下文或人的选择负担,因此要有明确收益。

按调用拆:某个独立核心概念应能自行触发,或者别的技能必须调用它,才值得新增模型可见描述。

按执行顺序拆:后续步骤吸引 Agent 赶进度、提前结束当前步骤时,可以分开,让它集中完成当前工作。

English · 英文原文

When to split

Granularity is how finely you divide skills, and each cut spends one of the two loads, so split only when the cut earns it. Two cuts:

  • By invocation — split off a model-invoked skill when you have a distinct leading word that should trigger it on its own, or another skill must reach it. You pay context load for the new always-loaded description, so that independent reach has to be worth it.
  • By sequence — split a run of steps when the steps still ahead (a step's post-completion steps) tempt the agent to rush the one in front of it (premature completion). Keeping them out of view encourages the agent to do more legwork on the current task.
老师讲解 · 对应上方原文 · 含教学举例

拆分需要收益,否则只是增加记忆与导航成本

按调用拆分,是为了一个独立概念能被单独找到;按顺序拆分,是为了后续内容不诱使当前步骤过早结束。不能因为文档超过某个机械字数就无限拆碎。

例如调查尚未完成,Agent 一直想着后面的实现,可以先改善调查完成标准;只有真实观察到仍赶进度,才考虑跨会话分开。普通文件链接不一定清除已经进入上下文的后续计划。

对初学者而言,先学会问“为什么拆、谁负责找到、何时加载”,比背长度门槛更有用。

中文译文

删减

每种含义保留一个权威位置。逐行检查是否仍相关。再逐句判断是否改变实际行为;无效句子应删除,不只是修短。作者主张对无作用的说明积极清理。

English · 英文原文

Pruning

Keep each meaning in a single source of truth: one authoritative place, so changing the behaviour is a one-place edit.

Check every line for relevance: does it still bear on what the skill does?

Then hunt no-ops sentence by sentence, not just line by line: run the no-op test on each sentence in isolation, and when one fails, delete the whole sentence rather than trim words from it. Be aggressive — most prose that fails should go, not be rewritten.

中文译文

核心词

leading word 是能让模型联想到一组行为的紧凑概念,例如 lesson、fog of war、tracer bullets。文中使用这个词,可以借助已有知识组织行为;强的词甚至不必反复出现。

正文中它帮助执行稳定,描述中它帮助触发。当提示、文档、代码使用相同语言时,更容易关联到技能。

寻找可以用准确概念替代反复说明的位置。例如多处写“快速、稳定、开销低”,可在明确定义后用 tight;“相信这条流程”太主观,改成 red,即它确实能对 bug 判失败。

作者希望同时减少文字和提高行为提示的清晰度,而不只是用缩写让文字变短。

English · 英文原文

Leading words

A leading word is a compact concept already living in the model's pretraining that the agent thinks with while running the skill (e.g. lesson, fog of war, tracer bullets). Repeated throughout the text (though not necessarily - a strong leading word might only be needed once), it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds.

It serves predictability twice. In the body it anchors execution: the agent reaches for the same behaviour every time the word appears. In the description it anchors invocation: when the same word lives in your prompts, docs, and code, the agent links that shared language to the skill and fires it more reliably.

Hunt for opportunities to refactor skills to use leading words. A triad spelled out at three sites (duplication), a description spending a sentence to gesture at one idea — each is a passage begging to collapse into a single token. Examples include:

  • "fast, deterministic, low-overhead" -> tight — one quality restated across a phase — into a single pretrained word (a tight loop).
  • "a loop you believe in" -> red — converts a fuzzy gate into a binary observable state (the loop goes red on the bug, or it doesn't).

You win twice over: fewer tokens, and a sharper hook for the agent to hang its thinking on. Assume every skill is carrying restatements that leading words retire — go find them.

中文译文

常见失败方式

  • 提前完成:还没做足就宣布结束。先明确完成条件;只有它无法更清楚且确实观察到抢跑时,才按顺序拆分。
  • 重复:同一含义多处维护,增加负担,还让其重要性被放大。
  • 沉积:旧规则因不敢删而层层累积,变得难以辨认。
  • 蔓延:每行都有用却整体过长。通过分层、引用和分支拆分,让每次只携带必要内容。
  • 无效指令:模型默认就做的事,重复说明不改变行为。通过与默认执行比较判断;模糊核心词没有作用时,改成更明确要求。
  • 否定式引导:作者认为禁止行为反复被提及,可能反而强化它。优先说明目标行动;必要硬限制仍保留,并同时说明应该怎样做。
English · 英文原文

Failure modes

Use these to diagnose issues the user may be having with the skill.

  • Premature completion — ending a step before it's genuinely done, attention slipping to being done. Defence, in order: sharpen the completion criterion first (cheap, local); only if it is irreducibly fuzzy and you observe the rush, hide the post-completion steps by splitting (the sequence cut).
  • Duplication — the same meaning in more than one place. Costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank.
  • Sediment — stale layers that settle because adding feels safe and removing feels risky. The default fate of any skill without a pruning discipline.
  • Sprawl — a skill simply too long, even when every line is live and unique. Hurts readability and maintainability and wastes tokens. The cure is the ladder: disclose reference behind pointers, and split by branch or sequence so each path carries only what it needs.
  • No-op — a line the model already obeys by default, so you pay load to say nothing. The test: does it change behaviour versus the default? A weak leading word (be thorough when the agent is already thorough-ish) is a no-op; the fix is a stronger word (relentless), not a different technique.
  • Negation — steering by prohibition backfires: don't think of an elephant names the elephant and makes it more available, not less. Prompt the positive — state the target behaviour so the banned one is never spoken; keep a prohibition only as a hard guardrail you can't phrase positively, and even then pair it with what to do instead.
老师讲解 · 对应上方原文 · 含教学举例

失败模式帮助你诊断指令,而非责怪模型不够聪明

重复使同一意思维护多份;沉积是旧规则不断累积;蔓延是每句都有用但总量仍太长;无效指令是不改变默认行为的要求;过早结束是没有做完就进入后续阶段。

**例子:**Agent 总是说“已理解”但没有读完必要文件,可以先改完成边界;若某规则已经由检查器准确执行,就无需在每轮反复提醒。

引导词与正面行为表达可能提高一致性,但没有脱离环境和模型的万能词。真正检验是运行效果与可核对结果。

原作者:Matt Pocock · 中文翻译为非官方译本

来源:skills/productivity/writing-great-skills/SKILL.md ↗

固定版本:af6d6922c3e2b5288eef155346cbe319e4ed3bd0

先作答,再看参考思路

Q1 · 理解

用自己的话说明:它解决什么问题,完成后会留下什么?

请各用一句话回答。若它只做规划或解释,不要把“已开发”“已部署”写成产物。

Q2 · 判断

稳定过程与稳定输出有什么区别?

我已思考,查看参考思路

研究任务每次内容可以不同,但都应查来源、区分推断、记录缺口。过程稳定不意味着模型输出逐字一致。

Q3 · 追问

原文中哪条要求在你的环境下可能不成立?

说出具体一句及其前提,例如工具不可用、资料缺失、已有项目约定冲突,或它只是作者偏好。把你的答案带回课堂,我们据此继续讨论。

课堂回传格式:第 40 课 / 我的理解 / Q2 回答 / 仍不理解的原句。这里是阅读教材;实时问答在我们的对话中进行。

把方法放进一个具体情境

教学案例:“核验全部来源”比“认真研究”更具体,但若没有定义何为核验,仍可能提前结束。改成逐项检查来源支持关系,并列出无法支持的主张,更容易验收。

边界与容易误读的地方

原文是参考而非安装执行流程。压缩词数不能牺牲关键条件;保持一个权威定义比多处重复更容易维护。

讨论后再实践:先判断上述情境是否适用,再选择真实任务。现在无需安装、运行命令或修改现有项目。

关联阅读