read-the-damn-docs
BuilderIO/skills
在实施、集成或调试第三方 API、库和服务之前,必须先进行网络搜索并阅读官方文档,以确保准确性并避免凭空猜测。
...展开全部仔细阅读那些该死的文档
如果权威文档能解答你的问题,就不要凭空猜测。 最常见的 正确做法是:在开始编码前,先通过网络搜索最新的官方文档,打开相关 页面并仔细阅读。无论是API、版本、服务提供商的行为、 配置、限制、生命周期钩子,还是涉及安全敏感的流程,都要以 文档中的实际说明为依据。
“文档优先”的触发条件
当出现以下任何一种情况时,请先阅读文档再继续操作:
- 用户询问“最新”、“当前”、“官方”、“受支持”、“最佳 实践”、“推荐”、“今天”、“现在”或“查一下”。
- 所需的文档尚未包含在代码库中,也未由用户提供。请通过 网络搜索官方文档,而非指望模型记忆中的信息是最新的。
- 该任务涉及添加、升级、配置或导入包、SDK、框架、 插件、CLI、模型、云资源或提供商集成。
- 该 API 发展迅速或对版本敏感:AI SDK、OpenAI/Anthropic/Google API、Next.js、React、Tailwind、Vite、Nitro、Drizzle、Prisma、Stripe、GitHub、 Slack、Notion、浏览器 API、部署平台、身份验证库以及类似组件。
- 实现涉及身份验证、OAuth 范围、权限、密钥、 Webhook、计费、支付、个人身份信息 (PII)、加密、数据保留、迁移、 重试、速率限制、配额、缓存、部署或合规性。
- 错误可能涉及弃用、未知选项、导出缺失、 配置无效、不支持的字段、默认值更改或版本不匹配。
- 一个代码库包含本地文档、ADR、生成的模式、OpenAPI 规范、路由/操作 注册表、设计系统文档或包级 README,这些内容可能定义了 契约。
- 该选择一旦确定便难以逆转:公开的传输格式、数据库模式、 迁移策略、持久化 ID、事件名称、客户可见的行为,或 外部自动化契约。
- 你会发现自己正要写下“通常”、“可能”、“我认为”、“凭 记忆”,或是从模型记忆中复制代码来实现外部 API。
什么算作文档
请使用现有的最具权威性的来源:
- 本地仓库文档、规范、ADR、模式、生成的类型、包 README 以及 针对项目特定行为的测试。
- 官方产品文档、API 参考、迁移指南、变更日志、发布 说明,以及用于描述第三方行为的 SDK 源代码/类型。若尚未掌握确切的 URL,可通过网络 搜索查找这些资源。
- 版本的包注册表元数据。在添加依赖项之前,运行
npm view,version pnpm view或生态系统中的 等效工具,然后阅读该主版本的文档。version - 当官方文档不完整时,可参考源代码或类型定义。将此 视为证据,而非道听途说。
若存在官方文档,请避免将 Stack Overflow、过时的博客文章、随机代码片段以及记忆作为主要 来源。仅在已知权威规范后,才将社区资源用于排查症状 。
必备工作流
- 确定确切的接口范围:包名、已安装版本、目标版本、 提供商端点、CLI 命令、配置文件、本地辅助程序、架构或产品 功能。
- 除非相关文档
已保存在本地或用户提供了 URL,否则应在网络上搜索当前的官方文档。使用有针对性的搜索,例如
,official docs ,或migration guide .API reference - 打开并阅读与该接口最相关的文档。对于 内部代码,优先使用本地文档,其次才是官方上游文档。对于新包,在编写导入、配置或安装命令之前,请先验证 最新版本。
- 提取任务所需的少量关键信息:选项名称、导入、生命周期 规则、默认行为、破坏性变更、限制、权限以及当前主版本的 示例。
- 利用这些事实进行实现或解答。如果文档与现有 代码存在冲突,请检查本地代码路径并指出差异。
- 使用最简有效的验证方法进行核查:类型检查、测试、构建、CLI 干跑、 API 模式验证或本地重现。
- 在最终答案中,若相关证据影响了建议或实现,请注明所参考的文档或本地文件。
必须触发文档的示例
- “向此应用添加 Tailwind。”在创建配置文件或假设旧版 PostCSS 设置之前,请先从网页上核对当前 Tailwind 的主版本及其安装 文档。
- “使用 AI SDK 进行响应流式传输。”请通过官方文档核实当前 AI SDK 的主版本号、 导入项、提供商包名、流式传输辅助函数以及服务器/运行时 示例。
- “连接 Stripe Webhook。”在编写代码前,请阅读 Stripe 当前的签名验证、 事件重试、端点密钥以及框架正文解析文档。
- “修复此 Next.js 缓存错误。”在推断缓存失效机制之前,请阅读已安装的 Next.js 主版本 及路由模式的相关文档。
- “添加 Drizzle 迁移。”在生成文件之前,请阅读当前 Drizzle 工具包文档以及现有代码库的 迁移规范。
- “创建 GitHub Action。”在编写代码前,请阅读官方的 Actions 语法和权限文档,
特别是关于
pull_request,workflow_run、OIDC、令牌和构建产物相关内容。 - “为什么这个 OAuth 流程会失败?”在修改代码之前,请阅读提供商的权限范围、重定向 URI、 PKCE、令牌刷新和应用验证文档。
- “使用本仓库的计划/评论/操作系统。”在设计端点或属性之前,请阅读本地文档、路由/操作 注册表、模式和测试。
- “升级 Vite/Nitro/React。”在编辑配置或导入文件之前,请阅读迁移指南,了解确切的目标 主要版本。
- “我们应该使用哪种模型?”在提出建议前,请先阅读当前提供商的模型文档、定价/限额 页面以及 SDK 示例。
何时只需快速浏览本地文档
不要为每个微小的修改都去浏览网页。当答案已经存在于仓库中时,可以快速浏览本地文档:现有辅助函数的使用方式、附近的测试、 类型化接口、生成的客户端、ADR 或包的 README。 但如果任务 依赖于外部工具、包、提供商或当前产品的行为,网络 搜索通常是正确的第一步。对于简单的语言语法、错别字修正、 格式调整,或没有外部契约的自包含代码,请按常规流程进行。
如果文档不可用
如果因网络访问、身份验证或本地文件缺失而无法查阅文档,请在 依赖记忆之前明确说明这一点。缩小不确定性范围,检查源代码或 类型(如果可用),并避免将结果呈现为“已确认最新”。
---
name: read-the-damn-docs
description: Forces web searches and reading of official docs before implementing, integrating, or debugging third-party APIs, libraries, and services to ensure accuracy and avoid guesswork.
---
# Read The Damn Docs
Do not guess where authoritative docs can answer the question. The most common
right move is to web-search for the current official docs, open the relevant
pages, and read them before coding. For APIs, versions, provider behavior,
config, limits, lifecycle hooks, or security-sensitive flows, ground the answer
in what the docs actually say.
## Docs-First Triggers
Read docs before proceeding when any of these are true:
- The user asks for "latest", "current", "official", "supported", "best
practice", "recommended", "today", "now", or "look it up".
- The needed docs are not already in the repo or supplied by the user. Search
the web for the official docs rather than hoping model memory is current.
- The task adds, upgrades, configures, or imports a package, SDK, framework,
plugin, CLI, model, cloud resource, or provider integration.
- The API is fast-moving or version-sensitive: AI SDKs, OpenAI/Anthropic/Google
APIs, Next.js, React, Tailwind, Vite, Nitro, Drizzle, Prisma, Stripe, GitHub,
Slack, Notion, browser APIs, deployment platforms, auth libraries, and similar.
- The implementation depends on auth, OAuth scopes, permissions, secrets,
webhooks, billing, payments, PII, encryption, data retention, migrations,
retries, rate limits, quotas, caching, deploys, or compliance.
- An error mentions deprecation, unknown options, missing exports, invalid
config, unsupported fields, changed defaults, or version mismatch.
- A repo has local docs, ADRs, generated schemas, OpenAPI specs, route/action
registries, design-system docs, or package-level READMEs that could define the
contract.
- The choice is expensive to reverse: public wire formats, database schema,
migration strategy, persistent IDs, event names, customer-visible behavior, or
external automation contracts.
- You catch yourself about to write "usually", "probably", "I think", "from
memory", or code copied from model memory for an external API.
## What Counts As Docs
Use the most authoritative source available:
- Local repo docs, specs, ADRs, schemas, generated types, package READMEs, and
tests for project-specific behavior.
- Official product docs, API references, migration guides, changelogs, release
notes, and SDK source/types for third-party behavior. Find these with web
search when you do not already have the exact URL.
- Package registry metadata for versions. Before adding a dependency, run
`npm view <pkg> version`, `pnpm view <pkg> version`, or the ecosystem
equivalent, then read the docs for that major version.
- Source code or type definitions when official docs are incomplete. Treat this
as evidence, not folklore.
Avoid Stack Overflow, old blog posts, random snippets, and memory as the primary
source when official docs exist. Use community sources only to debug symptoms
after the authoritative contract is known.
## Required Workflow
1. Identify the exact surface: package name, installed version, target version,
provider endpoint, CLI command, config file, local helper, schema, or product
feature.
2. Search the web for the current official docs unless the relevant docs are
already local or the user supplied a URL. Use targeted searches such as
`<product> <feature> official docs`, `<package> migration guide`, or
`<provider> API reference`.
3. Open and read the docs closest to that surface. Prefer local docs first for
internal code, then official upstream docs. For new packages, verify the
latest version before writing imports, config, or install commands.
4. Extract the few facts needed for the task: option names, imports, lifecycle
rules, default behavior, breaking changes, limits, permissions, and examples
for the current major version.
5. Implement or answer using those facts. If the docs conflict with existing
code, inspect the local code path and call out the discrepancy.
6. Verify with the smallest useful check: typecheck, tests, build, CLI dry run,
API schema validation, or a local reproduction.
7. In the final answer, name the docs or local files consulted when that
evidence affects the recommendation or implementation.
## Examples That Must Trigger Docs
- "Add Tailwind to this app." Check the current Tailwind major and its install
docs from the web before creating config files or assuming old PostCSS setup.
- "Use the AI SDK to stream responses." Verify the current AI SDK major,
imports, provider package names, streaming helpers, and server/runtime
examples from official docs.
- "Wire up Stripe webhooks." Read Stripe's current signature verification,
event retry, endpoint secret, and framework body-parsing docs before coding.
- "Fix this Next.js caching bug." Read the docs for the installed Next.js major
and router mode before assuming cache invalidation semantics.
- "Add Drizzle migrations." Read the current Drizzle kit docs and existing repo
migration conventions before generating files.
- "Create a GitHub Action." Read official Actions syntax and permissions docs,
especially for `pull_request`, `workflow_run`, OIDC, tokens, and artifacts.
- "Why does this OAuth flow fail?" Read the provider's scopes, redirect URI,
PKCE, token refresh, and app verification docs before changing code.
- "Use this repo's plan/comment/action system." Read local docs, route/action
registries, schemas, and tests before inventing endpoints or props.
- "Upgrade Vite/Nitro/React." Read the migration guide for the exact target
major before editing config or imports.
- "What model should we use?" Read current provider model docs, pricing/limits
pages, and SDK examples before recommending.
## When A Quick Local Read Is Enough
Do not browse the web for every tiny edit. A docs pass can be local and brief
when the answer is already in the repo: existing helper usage, nearby tests,
typed interfaces, generated clients, ADRs, or package READMEs. But if the task
depends on an external tool, package, provider, or current product behavior, web
search is usually the right first step. For trivial language syntax, typo fixes,
formatting, or self-contained code with no external contract, proceed normally.
## If Docs Are Unavailable
If network access, auth, or missing local files prevents reading the docs, say
that plainly before relying on memory. Narrow the uncertainty, inspect source or
types if available, and avoid presenting the result as confirmed-current.





首页
