context7-expert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext7 Expert
Context7 专家
This file is the routing and decision layer. Load only the reference needed for the current step.
本文件是路由和决策层。仅加载当前步骤所需的参考文档。
Priority hierarchy
优先级层级
When rules conflict, resolve in this order:
- Safety boundaries: never initiate installation, login, credential changes, or destructive commands without explicit authorization.
- Explicit user authorization: the user's direct instruction overrides convenience defaults.
- Repository-local evidence: lockfiles, manifests, and project docs define the actual version and behavior.
- Context7 lookup rules: fetch only when the question is version-sensitive or API-specific.
- Convenience optimization: caching, mode preference, and query shortcuts apply last.
当规则冲突时,按以下顺序解决:
- 安全边界:未经明确授权,绝不发起安装、登录、凭据更改或破坏性命令。
- 明确的用户授权:用户的直接指令优先于便利性默认设置。
- 仓库本地证据:lockfile、manifest 和项目文档定义了实际版本和行为。
- Context7 查找规则:仅当问题对版本敏感或涉及特定 API 时才进行获取。
- 便利性优化:缓存、模式偏好和查询快捷方式最后应用。
Step 0: Decide whether current documentation is actually needed
第 0 步:判断是否确实需要最新文档
Use this skill when the answer could be wrong because an API, CLI, SDK, framework, service,
or version has changed. Strong triggers include a named dependency plus a concrete API question,
a version number, migration work, generated code against an external API, or uncertainty about
the current signature.
Do not use Context7 when:
- The question is about a general programming concept that does not depend on a specific library version (for example, "what is an array in JavaScript").
- The repository already contains the authoritative answer in local documentation, README, lockfiles, or manifests.
- The answer can be explained from stable, widely-known language semantics without consulting version-specific documentation.
Do not use documentation lookup as ritual. If the task is pure reasoning, refactoring, or
language syntax that does not depend on a third-party API, skip it.
当 API、CLI、SDK、框架、服务或版本已发生变化导致答案可能出错时,使用本技能。强触发条件包括:指定依赖加上具体的 API 问题、版本号、迁移工作、针对外部 API 生成的代码,或对当前签名存在不确定性。
以下情况不要使用 Context7:
- 问题涉及不依赖特定库版本的一般编程概念(例如"JavaScript 中的数组是什么")。
- 仓库中的本地文档、README、lockfile 或 manifest 已包含权威答案。
- 答案可以从稳定、广为人知的语言语义中解释,无需查阅特定版本的文档。
不要将文档查询当作例行仪式。如果任务是纯粹的逻辑推理、重构或不依赖第三方 API 的语言语法问题,请跳过本技能。
Step 1: Choose the strongest available source
第 1 步:选择最强的可用来源
Use this evidence order:
- Repository-local documentation and lockfiles, when they define the project's actual version.
- Official vendor documentation for that exact product and version.
- Context7's indexed documentation for the requested library or platform.
- Other primary sources only when the above are unavailable.
Never silently substitute a different major version because it is easier to find.
按以下证据顺序使用:
- 仓库本地文档和 lockfile(当它们定义了项目的实际版本时)。
- 该产品和版本对应的官方厂商文档。
- Context7 索引的所请求库或平台的文档。
- 仅当以上来源均不可用时,才使用其他主要来源。
绝不要因为更容易找到就悄悄替换成不同的主版本。
Step 2: Choose the available Context7 mode
第 2 步:选择可用的 Context7 模式
- MCP available: use the Context7 MCP tools. Read .
references/mcp-mode.md - CLI available: use the installed CLI. Read
ctx7.references/cli-mode.md - Neither available: read before considering a network-backed fallback. Do not invent an installation state or execute an unapproved transient package command.
references/risk-and-budget.md
- MCP 可用:使用 Context7 MCP 工具。阅读 。
references/mcp-mode.md - CLI 可用:使用已安装的 CLI。阅读
ctx7。references/cli-mode.md - 两者均不可用:在考虑基于网络的回退方案之前,先阅读 。 不要虚构安装状态,也不要执行未经批准的临时包命令。
references/risk-and-budget.md
Step 3: Resolve the technology precisely
第 3 步:精确定位技术
Identify the product/library, ecosystem, and relevant version before querying. If the project
contains a lockfile or manifest, use it to constrain the lookup. If multiple similarly named
libraries exist, disambiguate before fetching docs.
在查询之前,识别产品/库、生态系统和相关版本。如果项目包含 lockfile 或 manifest,请使用它们来约束查找范围。如果存在多个名称相似的库,请在获取文档之前先进行消歧。
Step 4: Fetch narrowly and apply the result
第 4 步:精准获取并应用结果
Query for the exact task, not "everything about the library". Prefer primary API/reference
sections and version-specific migration notes. When documentation conflicts with memory,
trust the verified documentation.
When writing code, preserve the project's existing API style and dependency version. Do not
upgrade a dependency merely because newer documentation was found.
针对确切任务进行查询,而不是查询"关于该库的所有内容"。优先使用主要 API/参考章节和特定版本的迁移说明。当文档与记忆冲突时,相信经过验证的文档。
编写代码时,保持项目现有的 API 风格和依赖版本。不要仅仅因为找到了更新的文档就升级依赖。
Step 5: Report uncertainty honestly
第 5 步:如实报告不确定性
If the source does not answer the question, say what was verified and what remains uncertain.
Do not fabricate a method, option, version, or compatibility claim.
如果来源未能回答问题,请说明已核实的内容和仍存在不确定性的内容。不要编造方法、选项、版本或兼容性声明。
Anti-patterns
反模式
- Looking up documentation after already committing to an API from memory.
- Mixing examples from different major versions.
- Treating Context7 output as proof that the project has that dependency installed.
- Upgrading dependencies solely to make an example work.
- Querying broad documentation when one targeted reference would suffice.
- Claiming a tool was used when it was not available.
- 在已经凭记忆确定 API 之后才去查找文档。
- 混用不同主版本的示例。
- 将 Context7 的输出视为项目已安装该依赖的证据。
- 仅仅为了让示例能够运行而升级依赖。
- 当一个有针对性的参考就足够时,却查询宽泛的文档。
- 在工具不可用时谎称使用了该工具。
Bundled references
附带参考文档
- : when to activate Context7 without waiting for the user to name it, the confidence threshold, and what not to narrate.
references/proactive-trigger.md - : how to pick the best library match and write good scoped queries.
references/selection-and-query-writing.md - : MCP tool name variance, resolve/fetch mechanics, result handling, and error recovery.
references/mcp-mode.md - : CLI command shape, resolve/fetch mechanics, version-specific IDs, optional flags, authentication, error handling, and common mistakes.
references/cli-mode.md - : operation budget tiers, when to increase budget, and rules for counting operations.
references/risk-and-budget.md - : generic adapter contract, known examples, and portability rule for host-specific configuration.
references/agent-adapters.md - : setup modes, authentication, what gets written, and how to choose between MCP and CLI modes.
references/setup.md - : install, search, suggest, generate, list, remove, and info commands for
references/cli-skills-management.mdskills.ctx7 - : verify the smallest controlling fact, prefer primary sources, distinguish checked from unchecked, safe static fallback, and never invent execution or compatibility.
references/verification-and-failure.md
- :何时无需用户点名即可主动激活 Context7、置信度阈值,以及哪些内容不需要叙述。
references/proactive-trigger.md - :如何选择最佳的库匹配并编写良好的限定范围查询。
references/selection-and-query-writing.md - :MCP 工具名称差异、resolve/fetch 机制、结果处理和错误恢复。
references/mcp-mode.md - :CLI 命令形式、resolve/fetch 机制、版本特定 ID、可选标志、身份验证、错误处理和常见错误。
references/cli-mode.md - :操作预算层级、何时增加预算以及操作计数的规则。
references/risk-and-budget.md - :通用适配器契约、已知示例以及主机特定配置的可移植性规则。
references/agent-adapters.md - :设置模式、身份验证、会写入什么内容,以及如何在 MCP 和 CLI 模式之间选择。
references/setup.md - :
references/cli-skills-management.mdskills 的安装、搜索、建议、生成、列出、删除和 info 命令。ctx7 - :验证最小的控制性事实、优先使用主要来源、区分已检查和未检查的内容、安全的静态回退,并且绝不虚构执行或兼容性。
references/verification-and-failure.md