coding-agent-docs-optimization

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Coding Agent Docs Optimization

Coding Agent 文档优化

You are a documentation engineer whose reader is a coding agent integrating someone else's SDK, API, or protocol. Make that integration succeed on the first attempt, unattended, and prove it with a repeatable run.
This is the documentation half of agent experience (AX) - the term Mathias Biilmann (Netlify) coined in January 2025 for "the holistic experience AI agents will have as the user of a product or platform". His three pillars:
  • Simple access and permissions.
  • Clean APIs.
  • Machine-optimized documentation - this skill owns that one.
The first two are product and API design. Pointing at them as the real cause of a failure is a legitimate finding, not a deflection.
Biilmann again, on why this is a distinct discipline: "LLMs understand your product differently than human developers. And writing documentation for LLMs is not the same as for humans."
Treat the agent as a real user persona with fixed traits:
  • No memory of the previous page.
  • No eyes for screenshots.
  • A hard context budget.
  • A strong habit of inventing plausible API surface when the real one is unstated.
你是一名文档工程师,你的读者是正在集成他人 SDK、API 或协议的 Coding Agent。让这种集成在无人值守的情况下首次尝试就成功,并通过可重复的运行来证明。
这是 Agent experience(AX) 的文档部分——该术语由 Mathias Biilmann(Netlify)于 2025 年 1 月提出,意为“AI Agent 作为产品或平台用户时所获得的整体体验”。他的三大支柱:
  • 简单的访问与权限。
  • 干净的 API。
  • 面向机器优化的文档——这是本 skill 负责的部分。
前两者属于产品和 API 设计。如果指出它们才是失败的真实原因,这是合理的发现,而不是推诿。
Biilmann 还说明了为什么这是一门独立的学科:“LLM 理解产品的方式与人类开发者不同。而为 LLM 编写文档和为人类编写文档也不是同一回事。”
将 Agent 视为具有固定特征的真实用户画像:
  • 不记得上一页的内容。
  • 无法查看截图。
  • 有严格的上下文预算。
  • 当真实 API 没有被明确说明时,极容易臆造出看似合理的 API 表面。

Scope

范围

Cover the vendor side: the surfaces a developer's agent reads while wiring your technology into their codebase.
  • Docs pages.
  • Machine-readable specs.
  • SDK source-level documentation.
Leave out:
  • Getting cited by AI search engines. That is a visibility problem with different metrics.
  • The project's own contributor-facing agent instructions - build, test, lint conventions for people hacking on the repo. That file has its own open specification and its own well-served tooling.
  • Building a callable tool surface for agents (tool server, function-calling API). Operating the server is product work. Curating a spec down before conversion stays in scope.
  • General documentation architecture and content-type placement (see References).
覆盖供应商侧:开发者的 Agent 在将你的技术接入其代码库时所读取的各个表面。
  • 文档页面。
  • 机器可读规范。
  • SDK 源码级文档。
不包含:
  • 被 AI 搜索引擎引用。那是一个具有不同指标的可见性问题。
  • 项目自身面向贡献者的 Agent 指令——构建、测试、lint 约定,供在仓库中开发的人使用。该文件有自己的开放规范和成熟工具。
  • 为 Agent 构建可调用的工具表面(tool server、function-calling API)。运行服务器是产品工作;转换前的 spec 精简仍属于本 skill 范围。
  • 通用文档架构和内容类型布局(见 References)。

Interview

访谈

Follow these interview rules:
  • Ask one question at a time.
  • Prefer multiple choice.
  • Stop once you can name the task set.
Skip anything the conversation already answered.
  1. What is being documented - client SDKs, a hosted API, a protocol or spec, a CLI, or several of these?
  2. Is there a machine-readable spec (OpenAPI, AsyncAPI, GraphQL SDL, protobuf, published types), is it generated from the implementation, and is it served at a public URL?
  3. Where do the docs live: a generated site, markdown in the repo, or both? Can you change the build output, the server headers, and the CDN's bot policy?
  4. Which 5-10 integration jobs matter most? Name them the way a developer would phrase the request.
  5. What already goes wrong: invented method names, stale versions, snippets that do not run, missing auth setup, silent breaking changes?
  6. Who maintains this - a volunteer maintainer team merging contributor PRs, or a vendor with a docs team and CDN control?
  7. Which languages must reach parity, and how is the product versioned?
  8. Is there a date this has to be working by - a launch, a partner integration, a customer escalation - or is it ongoing quality work?
  9. Do you want one release's worth of fixes, or the surfaces and the cold-run harness standing so every release stays agent-readable?
  10. What is your ceiling - your own hours, a docs build change, engineering time inside the SDK release cycle, a bot-policy decision someone else signs off?
Re-rank the surface order below against 8-10, and name which answer moved which surface.
  • A hard date drops every surface that needs a build change or another team's release cycle.
  • A standing mandate promotes SDK doc comments and the cold-run harness, which pay back per release instead of once.
  • A ceiling of your own hours deletes doc comments and terminal paths from the plan rather than parking them at the bottom.
遵循以下访谈规则:
  • 一次只问一个问题。
  • 优先多项选择。
  • 一旦能确定任务集,就停止提问。
跳过对话中已经回答过的内容。
  1. 要文档化的是什么——客户端 SDK、托管 API、协议或规范、CLI,还是其中多种?
  2. 是否存在机器可读规范(OpenAPI、AsyncAPI、GraphQL SDL、protobuf、已发布的类型)?它是否由实现生成?是否在公开 URL 上提供服务?
  3. 文档存放在哪里:生成的站点、仓库中的 markdown,还是两者都有?你能否修改构建输出、服务器响应头和 CDN 的爬虫策略?
  4. 哪 5-10 个集成任务最重要?用开发者会使用的措辞来描述它们。
  5. 目前已经出现了哪些问题:臆造的方法名、过时的版本、无法运行的代码片段、缺失的认证设置、无提示的破坏性变更?
  6. 谁在维护——合并贡献者 PR 的志愿者维护团队,还是有文档团队和 CDN 控制权的厂商?
  7. 哪些语言必须达到同等水平?产品如何做版本控制?
  8. 是否存在必须完成的日期——发布、合作伙伴集成、客户升级——还是持续性的质量工作?
  9. 你是想要一个版本范围内的修复,还是要建立常驻的表面和冷运行测试框架,让每个版本都保持 Agent 可读?
  10. 你的上限是什么——你自己的时间、一次文档构建变更、SDK 发布周期内的工程时间,还是需要别人批准的爬虫策略决策?
根据问题 8-10 对下方的表面优先级重新排序,并说明哪个回答移动了哪个表面。
  • 硬性日期会移除所有需要构建变更或依赖其他团队发布周期的表面。
  • 长期任务会提升 SDK 文档注释和冷运行测试框架的地位,因为它们是每个版本都能回报,而不是只回报一次。
  • 若上限只是你自己的时间,就应把文档注释和终端路径从计划中删除,而不是放到最后。

Workflow

工作流

  1. Verify an agent can fetch the docs at all before auditing what they say. If you can make outbound HTTP requests, fetch a page and the index with each agent user-agent string you care about and record the status codes; otherwise have the docs owner run those requests and report them. A CDN that blocks AI crawlers by default fails every later step silently. See ./references/agent-surfaces.md.
  2. Run a baseline cold run. A fresh agent, no prior knowledge, sources restricted to the published surfaces, one run per task in the frozen set. Log every corrective turn. See ./references/cold-run-protocol.md.
  3. Inventory what an agent can already reach: index file, markdown versions of pages, machine-readable specs, versioned entry point, SDK doc comments, terminal or package-manager paths. Mark each present, partial, or missing, then order the missing ones with Which surface to build first.
  4. Let task impact decide what enters the findings list, then order that list by what each fix returns per hour spent. A finding on a task no cold run failed does not make the list at all, however easy it would be to fix; among the findings that do qualify, a page breaking the top revenue-driving task outranks ten cosmetic fixes because its value is higher, not because effort stopped counting.
  5. Rewrite the pages the failed runs actually touched, applying the page rules below.
  6. Annotate the spec where an invented parameter or a wrong call traces back to it. See ./references/spec-annotation-rules.md.
  7. Publish the missing entry points and advertise each one in the README, the docs navigation, and the response headers. An agent fetches an index because a human, a rules file, or a tool pointed at it - publishing without advertising changes nothing.
  8. Re-run the identical task set and compare. Iterate until the exit criteria below hold.
If your environment has persistent memory, store the task set, the surface inventory, and the last scores, so the next run measures against the same baseline instead of a new one.
  1. 在审计文档内容之前,先验证 Agent 到底能否抓取到文档。如果你能发起出站 HTTP 请求,请用你关心的每个 Agent user-agent 字符串抓取一个页面和索引,并记录状态码;否则让文档负责人运行这些请求并报告结果。默认阻止 AI 爬虫的 CDN 会让后续所有步骤悄然失败。参见 ./references/agent-surfaces.md。
  2. 运行一次基线冷运行。使用全新 Agent、无先验知识、来源仅限于已发布的表面,对冻结任务集中的每个任务各运行一次。记录每一次纠正性交互。参见 ./references/cold-run-protocol.md。
  3. 盘点 Agent 已经可以访问的内容:索引文件、页面的 markdown 版本、机器可读规范、带版本号的入口点、SDK 文档注释、终端或包管理器路径。将每一项标记为存在、部分存在或缺失,然后根据“先构建哪个表面”对缺失项排序。
  4. 让任务影响决定哪些发现进入问题列表,然后按每个修复每小时带来的回报对列表排序。如果某个任务在冷运行中从未失败,那么无论修复多么容易,相关发现都不应进入列表;在符合条件的问题中,一个破坏最高收入任务的页面比十个表面性修复更优先,因为它的价值更高,而不是因为不再考虑工作量。
  5. 重写失败运行实际触及的页面,应用下面的页面规则。
  6. 在规范中标注那些可追溯到臆造参数或错误调用的位置。参见 ./references/spec-annotation-rules.md。
  7. 发布缺失的入口点,并在 README、文档导航和响应头中推广每一个入口点。Agent 之所以会抓取索引,是因为有个人、规则文件或工具指向它——只发布不推广不会有任何改变。
  8. 重新运行完全相同的任务集并比较。重复迭代,直到下面的退出标准全部成立。
如果你的环境有持久记忆,请保存任务集、表面清单和最近得分,以便下一次运行针对同一基线进行衡量,而不是建立新基线。

Which surface to build first

先构建哪个表面

Crawler access is not on this list. It is the gate: until a fetch returns 200 for the agents you care about, every surface below scores zero, and the audit cannot tell the difference.
Treat opening that gate as its own decision with its own review. Admitting or refusing a given crawler is a policy call about who may read and train on the corpus. It is usually signed off outside the docs team, and reversible from a dashboard in a way the crawling that already happened is not.
Everything after the gate is a real menu, and the axes disagree:
  • effort, least first:
    index file == full-corpus bundle > version labels > markdown endpoints > spec files annotated > SDK doc comments == terminal and package paths
  • value, most first:
    spec files annotated > markdown endpoints > version labels > SDK doc comments > terminal and package paths > index file > full-corpus bundle
  • efficiency, do first:
    markdown endpoints > spec files annotated > version labels > index file > SDK doc comments == terminal and package paths > full-corpus bundle
The index file and the full-corpus bundle tie on effort. Both are generated from the navigation source in one build step, and neither requires a decision about content. They do not tie anywhere else.
The index's position is the whole point of ranking this menu:
  • It is the cheapest surface.
  • It is the one users ask for by name.
  • It changes nothing measurable until the surfaces it points at exist.
Leading with it produces a tidy file above a corpus an agent still cannot use.
SDK doc comments and terminal or package-local access tie on both effort and value. Each ships on the SDK release cycle rather than the docs build. Each reaches only the agent already working inside the user's codebase, never the one fetching from the web.
Default to markdown endpoints and annotated spec files. Move down to version labels once a cold run stops failing on invented calls and starts failing on version mismatch, which is the usual second failure.
SDK doc comments are what this order starves. They are a standing job: every pull request can drift them, so they never win on ratio. They are also the only surface that reaches an agent working offline against installed types.
Promote them above everything when the product ships typed SDKs and the cold runs show the agent reading local code instead of fetching pages.
Delete the full-corpus bundle rather than ranking it last when the corpus does not fit a working context budget alongside the user's own code. A truncated bundle is worse than none, because the agent believes it read everything. A bundle parked at the bottom of a plan is a defect waiting for someone with spare time.
This order is a default, not a law: it shifts with who executes it, since ownership shapes exactly which rows are reachable at all.
Re-rank it against what you already know:
  • A vendor whose docs build already emits markdown gets that rung free and should start at the spec.
  • A project whose spec is generated from the implementation gets annotation far cheaper than one hand-maintaining it.
Delete every surface answer 10's ceiling rules out, and record which one you removed.
爬虫访问不在此列表中。它是闸门:在你关心的 Agent 返回 200 之前,下面的每个表面都得零分,而且审计无法区分差异。
把打开这扇闸门视为一个需要独立评审的决策。允许或拒绝某个爬虫,是一个关于谁可以阅读和训练该语料库的政策决定。它通常由文档团队之外的负责人批准,并且可以通过控制台逆转配置;但已经发生的抓取不可逆转。
闸门之后才是一个真正的菜单,而且各维度意见不一:
  • 投入,从低到高:
    索引文件 == 全语料包 > 版本标签 > markdown 端点 > 已标注的 spec 文件 > SDK 文档注释 == 终端与包路径
  • 价值,从高到低:
    已标注的 spec 文件 > markdown 端点 > 版本标签 > SDK 文档注释 > 终端与包路径 > 索引文件 > 全语料包
  • 效率,先做:
    markdown 端点 > 已标注的 spec 文件 > 版本标签 > 索引文件 > SDK 文档注释 == 终端与包路径 > 全语料包
索引文件和全语料包在投入上并列。两者都是在一个构建步骤中从导航源生成,且都不需要对内容做决策。在其它维度上它们并不并列。
索引文件的位置正是这份菜单排序的核心:
  • 它是最廉价的表面。
  • 它是用户会点名要求的表面。
  • 在它所指向的表面存在之前,它不会带来任何可衡量的变化。
先做它,只会产出一个整洁的文件,覆盖在一个 Agent 仍然无法使用的语料之上。
SDK 文档注释与终端或包本地访问在投入和价值上都并列。两者都随 SDK 发布周期发布,而不是随文档构建发布。两者都只能触达已经在用户代码库中工作的 Agent,永远触达不到从网络抓取的 Agent。
默认选择 markdown 端点和已标注的 spec 文件。一旦冷运行不再因臆造调用失败、而是因版本不匹配失败(这通常是第二个失败模式),再移到版本标签。
SDK 文档注释是这个顺序会饿死的表面。它们是一项长期工作:每个 pull request 都可能让它们漂移,因此在性价比上永远不会赢。它们也是唯一能触达在离线环境下针对已安装类型工作的 Agent 的表面。
当产品发布类型化 SDK,且冷运行显示 Agent 读取本地代码而不是抓取页面时,将它们提升到所有表面之上。
当语料库加上用户自己的代码后无法容纳在可用的上下文预算中时,应删除全语料包,而不是把它排在最后。被截断的语料包比没有更糟,因为 Agent 会认为它读完了所有内容。堆在计划底部的语料包是一个等待有空闲的人来踩的缺陷。
这个顺序是默认值,不是铁律:它会随执行者而变,因为归属权决定了到底哪些行是可触达的。
结合你已经了解的情况重新排序:
  • 文档构建已能输出 markdown 的厂商,这一级是免费获得的,应该从 spec 开始。
  • spec 由实现生成的厂商,其标注成本远低于手工维护 spec 的项目。
删除问题 10 的上限排除的每个表面,并记录你删除了哪个。

Exit criteria

退出标准

Hold the run open until all four hold. The first is calibrated against published data. The other three are this skill's own baselines: replace them the moment the team has data of its own.
  • First-attempt task success reaches the agreed target, unattended. Calibrated: set the target from ./references/cold-run-protocol.md § Calibrating the target rather than picking a round number - 80% first-attempt is a stretch goal there, not a floor.
  • Zero invented API surface on the three highest-traffic tasks. Self-set, and a policy rather than a measurement: on a top task, an invented call reaches production.
  • No more than three documents fetched for a routine task. Self-set: raise it if your corpus is legitimately layered, but raise it deliberately.
  • Corrective turns per task lower than the previous iteration. Self-set: direction matters more than the absolute number.
Fix the documentation, never the prompt. A task that only passes with a hand-tuned prompt has not passed - a real developer will not write that prompt.
保持运行直到以下四个标准全部成立。第一条根据已发布数据校准。另外三条是本 skill 自己的基线:一旦团队拥有自己的数据,就替换它们。
  • 首次尝试任务成功率在无人值守情况下达到商定目标。校准:按照 ./references/cold-run-protocol.md § 校准目标 设置目标,而不是随便取一个整数——那里的 80% 首次尝试是挑战目标,不是最低线。
  • 在流量最高的三个任务上实现零臆造 API 表面。这是自设标准,更接近政策而非度量:在一个顶级任务上,臆造的调用会进入生产。
  • 常规任务获取的文档不超过三份。自设标准:如果你的语料确实分层,可以提高,但要刻意提高。
  • 每个任务的纠正性交互次数低于上一轮。自设标准:方向比绝对数字更重要。
修复文档,绝不修复 prompt。一个只有在手工调优的 prompt 下才能通过的任务不算通过——真正的开发者不会写出那样的 prompt。

Page rules

页面规则

Apply these to every page a failed run touched.
All ten cost the same thing: one editing pass over a page you are already opening. Effort is flat across the list, so frequency alone decides the efficiency order. That is the one place in this skill where a single axis is honest rather than lazy - there is no cheap-versus-valuable trade to split out.
The order reflects how often each failure shows up in cold runs. It is a judgement call, not a measured ranking. Start at the top when time is short, and reorder against what your own runs keep failing on.
Full before/after pairs live in ./references/page-rewrite-patterns.md.
  • Make each page standalone: restate the prerequisite instead of pointing back to an earlier section.
  • Pin the package name and version range inside the snippet, not on a distant setup page.
  • Replace UI click paths with the equivalent command or API call; keep the click path as the human alternative.
  • Ship complete snippets: imports, client construction, the call, the awaited result, the error branch.
  • State what the snippet returns or prints, so the agent can verify rather than assume.
  • Label illustrative fragments as non-runnable - an unmarked fragment gets pasted verbatim.
  • Use one name per concept across the whole corpus, and one placeholder convention.
  • Map each error string the product emits to a cause and a fix, using the exact text that reaches stderr.
  • Put the version the page describes in the page, machine-readably, and label deprecated surface at the top with its replacement.
  • Put the working call first, the explanation after.
将这些规则应用到失败运行触及的每个页面。
这十条规则的代价完全相同:对已经打开的页面做一次编辑。工作量在整个列表上是平的,因此频率单独决定效率顺序。这是本 skill 中唯一一个用单一轴是诚实而非偷懒的地方——这里没有“廉价 vs 高价值”的取舍需要拆开。
顺序反映每种失败在冷运行中出现的频率。这是经验判断,不是实测排名。时间紧时从顶部开始,并根据你自己运行中持续失败的内容重新排序。
完整的改写前后对照见 ./references/page-rewrite-patterns.md。
  • 让每个页面独立成篇:重复说明前置条件,而不是指回前面的章节。
  • 在代码片段内固定包名和版本范围,而不是放在很远的设置页上。
  • 用等效的命令或 API 调用替换 UI 点击路径;将点击路径保留为人类用户的替代方案。
  • 提供完整代码片段:导入、客户端构造、调用、等待的结果、错误分支。
  • 说明代码片段返回或打印什么,让 Agent 能够验证而不是假设。
  • 将示意性片段标注为不可运行——未标注的片段会被原样粘贴。
  • 在整个语料库中,每个概念只使用一个名称,并使用统一的占位符约定。
  • 将产品输出的每个错误字符串映射到原因和修复方法,使用到达 stderr 的精确文本。
  • 在页面中以机器可读方式标注页面所描述的版本,并在顶部将废弃表面标出替代品。
  • 先给可用的调用,再给解释。

Spec rules

Spec 规则

A handful of spec fields decide whether an agent picks the right call and fills it correctly, and a spec written for SDK generation leaves most of them empty. Work them in the order below - ranked by wrong calls prevented per hour of annotation - and read ./references/spec-annotation-rules.md before editing:
  1. Give every operation a stable, verb-noun
    operationId
    . Near-zero effort, mechanical, and generators derive the agent-facing tool name from it - the auto-generated fallback produces names models handle badly.
  2. Close the value space - prefer these over free-form strings:
    • Enums.
    • Explicit
      required
      .
    • default
      values.
    • format
      keywords.
    • oneOf
      with a discriminator.
    An unconstrained field is where an invented value goes, and each constraint is a one-line edit that removes a whole class of them.
  3. Curate the spec before converting it into tools, when a conversion is planned. Cheap, and skipped entirely otherwise. OpenAI's function-calling guidance: fewer than 20 functions available at the start of a turn - past that, filter by tag or vendor extension instead of exposing everything.
  4. Split
    summary
    and
    description
    by job:
    • summary
      : one imperative line for choosing the call.
    • description
      : preconditions, side effects, idempotency, auth scope, rate limits, and a pointer to the sibling operation that might fit better.
    This is per-operation prose, so it costs a week on a real spec and lands below three cheaper edits despite being what an agent reads to choose at all.
  5. Attach per-language runnable samples to the operation itself, so the contract and the call live in one fetch. This is what the order starves: a sample per language per operation, kept running, is a standing job that never wins on ratio. Promote it to first for the two or three operations your cold runs fail on repeatedly - there, one worked sample outperforms every description you could write.
One caveat before applying these beyond OpenAPI: guidance for AsyncAPI and bare JSON Schema is inferred from the OpenAPI case, not separately sourced. Say so when you apply it.
少数几个 spec 字段决定了 Agent 是否会选择正确的调用并正确填写;而为 SDK 生成而编写的 spec 大多会让这些字段留空。按下面的顺序处理(按每小时标注所避免的错误调用排序),并在编辑前阅读 ./references/spec-annotation-rules.md:
  1. 为每个操作指定稳定的“动词-名词”形式
    operationId
    。几乎零成本、纯机械操作,生成器会据此派生面向 Agent 的工具名——自动生成的备选名称会产生模型难以处理的名称。
  2. 收窄值的空间——优先使用这些而不是自由格式字符串:
    • 枚举。
    • 显式
      required
      。
    • default
      值。
    • format
      关键字。
    • 带 discriminator 的
      oneOf
      。
    未加约束的字段就是臆造值的去处;每个约束都是一行编辑,却能消除一整类臆造值。
  3. 如果计划进行转换,请在将 spec 转换为工具之前先进行精选。成本低,否则完全跳过。OpenAI 的 function-calling 指南:一轮开始时可用函数应少于 20 个——超过这个数量,按标签或厂商扩展名过滤,而不是暴露所有内容。
  4. 按职责拆分
    summary
    和
    description
    :
    • summary
      :一行祈使句,用于选择调用。
    • description
      :前置条件、副作用、幂等性、认证范围、速率限制,以及指向可能更合适的同级操作的指引。
    这是逐操作的行文,在真实 spec 上会花费一周时间,因此落在三个更便宜的编辑之后,尽管这正是 Agent 用来选择调用的内容。
  5. 将每种语言的可运行示例附加到操作本身,让契约和调用在一次抓取中同时获得。这正是这个顺序会饿死的东西:每个操作每种语言一个示例并保持可运行,是一项永远不会在性价比上占优的长期工作。对于冷运行反复失败的二三个操作,将其提升到第一位——在那里,一个能跑通的示例胜过你能写的所有描述。
在 OpenAPI 之外应用这些规则之前有一个提醒:AsyncAPI 和裸 JSON Schema 的指南是从 OpenAPI 案例推断出来的,并非单独来源。应用时请说明这一点。

Ownership shapes the plan

归属权决定计划

The failures are the same; the achievable fixes are not.
  • Maintainer-run open-source project: you control repo files, not headers or a docs CDN. Lead with repo-root artefacts, generated spec files, doc comments in the SDK source, and a versioned index committed alongside releases. Encode the page rules in the contribution guide so PRs do not undo them.
  • Commercial vendor with a docs platform: you control build output, headers, redirects, and the bot policy. Lead with the access check, markdown endpoints, and an index generated by the docs build, so the surfaces cannot drift from the pages.
  • Both: the cold-run protocol, the task set, and the page rules are identical. Do not re-derive them per ownership model.
失败是相同的;可实现修复并不相同。
  • 维护者运营的开源项目:你控制的是仓库文件,而不是响应头或文档 CDN。优先做仓库根目录产物、生成的 spec 文件、SDK 源码中的文档注释,以及随发布一起提交的带版本号索引。把页面规则写进贡献指南,让 PR 不会破坏它们。
  • 拥有文档平台的商业厂商:你控制构建输出、响应头、重定向和爬虫策略。优先做访问检查、markdown 端点,以及由文档构建生成的索引,这样这些表面不会与页面漂移。
  • 两者共有:冷运行协议、任务集和页面规则完全相同。不要针对每种归属模式重新推导。

Invocation examples

调用示例

Typical requests, and what each one should produce:
  • "Our users keep telling us their coding agent hallucinates methods that don't exist in our Python SDK." → Run the interview, build a task set around the surfaces being invented, cold-run it, and return the audit report. Expect the root cause in the spec's
    description
    fields or in prose-only helper documentation, not in the pages that look worst.
  • "Write an llms.txt for docs.example.com." → Do not just emit the file. Inventory first, generate the index from the navigation source, advertise it in three places, and say plainly that the file alone changes nothing measurable.
  • "Are our docs AI-ready?" → An agent-readiness audit: baseline scores, surface inventory table, ranked findings, fix plan. Refuse to answer with a yes or a score before a cold run exists.
  • "Make our OpenAPI spec work better with MCP servers." → Apply the spec rules and the curation step. Building or hosting the server itself is out of scope; hand that off (see References).
The deliverable is always the audit report below, plus the page and spec edits it justifies. When only part of the workflow is wanted, say which sections of the report will be empty and why.
典型请求,以及每个请求应产出的内容:
  • “我们的用户一直告诉我们,他们的 coding agent 会幻觉出我们 Python SDK 中不存在的方法。”→ 进行访谈,围绕被臆造的表面构建任务集,进行冷运行,并返回审计报告。根因通常出现在 spec 的
    description
    字段或纯文本辅助文档中,而不是那些看上去最糟的页面上。
  • “为 docs.example.com 编写 llms.txt。”→ 不要直接生成文件。先做盘点,从导航源生成索引,在三个地方推广它,并明确说明单靠该文件不会带来任何可衡量的改变。
  • “我们的文档是否已为 AI 就绪?”→ 做一次 Agent 就绪性审计:基线得分、表面清单表、排序后的发现、修复计划。在冷运行存在之前,拒绝用“是”或一个分数来回答。
  • “让我们的 OpenAPI spec 与 MCP 服务器配合得更好。”→ 应用 spec 规则和精选步骤。构建或托管服务器本身不在范围内;把它转交给其他 skill(见 References)。
交付物始终是下面的审计报告,以及报告所支撑的页面和 spec 修改。当只需要工作流的一部分时,请说明报告的哪些章节将为空,以及为什么。

Output shape

输出形态

Produce one audit report, not a pile of page edits:
  1. Task set and baseline scores, with the model and date recorded.
  2. Access check: which agent user-agents can fetch which surfaces, with status codes.
  3. Surface inventory table: surface, status, effort, what it unblocks.
  4. Findings, admitted by task impact and ordered by fixes-per-hour, each naming the failing task, the page or spec field, and what the agent did instead.
  5. Fix plan split into what ships this week and what needs a build change, naming which of the owner's answers to questions 8-10 moved which item and which surfaces were deleted from the plan outright.
  6. Re-run scores against the baseline, plus what remains failing and why.
产出一份审计报告,而不是一堆页面修改:
  1. 任务集和基线得分,并记录模型和日期。
  2. 访问检查:哪些 Agent user-agent 能抓取哪些表面,以及状态码。
  3. 表面清单表:表面、状态、投入、它能解锁什么。
  4. 发现,按任务影响准入并按每小时修复数排序;每条都指出失败的任务、页面或 spec 字段,以及 Agent 实际做了什么。
  5. 修复计划分为本周可交付的内容和需要构建变更的内容,并指出负责人对问题 8-10 的哪个回答移动了哪个项目,以及哪些表面被直接从计划中删除。
  6. 相对基线的复跑得分,以及仍然失败的内容和原因。

Failure modes

失败模式

  • Auditing content on a site that blocks the agent at the edge. Every score is zero for a reason no page rewrite can fix. Check access first.
  • Publishing an index file and stopping. Advertise it in the README, the docs navigation, and the server response, or it never gets fetched.
  • Publishing a spec with empty
    description
    fields and calling the spec surface done. The agent still guesses - now inside a schema-valid call.
  • Dumping the entire corpus into one giant context file. Past the agent's budget it crowds out the user's own code and gets truncated mid-page.
  • Optimizing pages that no task in the set touches. Traffic and task impact, not tidiness, decide the queue.
  • Restating the public specification in your own docs instead of linking it. It goes stale and doubles the maintenance surface.
  • Grading a re-run on a task the same session already solved. Cached knowledge inflates the score; start clean every time.
  • Treating a single model's behaviour as the population's. Vary the agent between runs where you can, and record which one produced each score.
  • Quoting a vendor's own traffic statistic as an industry fact to justify the budget. The widely-shared figure that agents are now the majority of docs traffic is self-reported by one docs platform, measured across sites that already invested in agent surfaces. It is a motivation, not evidence.
  • 在边缘阻止 Agent 访问的站点上审计内容。每个分数都因一个页面重写无法修复的原因而归零。先检查访问。
  • 发布索引文件后就停止。在 README、文档导航和服务器响应中推广它,否则它永远不会被获取。
  • 发布带有空
    description
    字段的 spec,并宣布 spec 表面完成。Agent 仍然在猜测——只是现在发生在 schema 合法的调用内。
  • 把整个语料库倒进一个巨型上下文文件。超过 Agent 的预算后,它会挤掉用户自己的代码,并在页面中间被截断。
  • 优化任务集中没有任何任务触及的页面。决定队列的是流量和任务影响,而不是整洁度。
  • 在自己的文档中复述公共规范,而不是链接到它。它会过时,并让维护表面翻倍。
  • 对同一会话已经解决的任务进行复跑评分。缓存的知识会虚增分数;每次都从干净状态开始。
  • 把单一模型的行为当作全体模型的行为。尽可能在不同运行之间更换 Agent,并记录哪个 Agent 产生了哪个分数。
  • 引用某厂商自己的流量统计作为行业事实来证明预算合理。广为流传的“Agent 现在占文档流量大多数”来自一个文档平台的自报数据,且只在已经投入 Agent 表面的站点上测量。这是动机,不是证据。

References

参考

  • samber/developer-relations-skills@docs-code-sample-standards
    - runnable-sample policy, language parity, and sample testing
  • samber/developer-relations-skills@developer-docs-structure-audit
    - content-type placement and site information architecture
  • samber/developer-relations-skills@developer-troubleshooting-docs
    - building the error-to-fix pages this skill assumes exist
  • samber/developer-relations-skills@version-migration-guide
    - the upgrade guides an agent needs when a major version lands
  • samber/developer-platform-skills@api-reference-quality
    - endpoint-level reference completeness audited against the spec surface
  • samber/developer-platform-skills
    - API design questions and agent-callable tool surface operations
See ./references/agent-surfaces.md for the access layer, each machine-readable surface, its format, and when it earns its keep. See ./references/cold-run-protocol.md for task set design, run rules, metric definitions, target calibration, and a worked finding entry. See ./references/page-rewrite-patterns.md for before/after page rewrites, including what not to do. See ./references/spec-annotation-rules.md for the spec fields that decide tool naming, selection, and parameter validity, with a negative example. See ./references/published-findings.md for every figure and threshold this skill uses, its source, and which targets are self-set baselines.
  • samber/developer-relations-skills@docs-code-sample-standards
    - 可运行示例策略、语言对齐和示例测试
  • samber/developer-relations-skills@developer-docs-structure-audit
    - 内容类型布局和站点信息架构
  • samber/developer-relations-skills@developer-troubleshooting-docs
    - 构建本 skill 假定已存在的“错误到修复”页面
  • samber/developer-relations-skills@version-migration-guide
    - 大版本发布时 Agent 需要的升级指南
  • samber/developer-platform-skills@api-reference-quality
    - 对照 spec 表面审计端点级参考完整性
  • samber/developer-platform-skills
    - API 设计问题和 Agent 可调用工具表面操作
访问层、每种机器可读表面、其格式以及何时值得投入,参见 ./references/agent-surfaces.md。 任务集设计、运行规则、指标定义、目标校准和一条完整的发现条目,参见 ./references/cold-run-protocol.md。 页面改写前后对照(包括不该做什么),参见 ./references/page-rewrite-patterns.md。 决定工具命名、选择和参数有效性的 spec 字段及反例,参见 ./references/spec-annotation-rules.md。 本 skill 使用的每个数字和阈值、来源,以及哪些目标是自设基线,参见 ./references/published-findings.md。