documentation-lookup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
当用户询问库、框架相关问题或需要代码示例时,请使用Context7获取最新文档,而非依赖训练数据。

When to Use This Skill

何时使用此Skill

Activate this skill when the user:
  • Asks setup or configuration questions ("How do I configure Next.js middleware?")
  • Requests code involving libraries ("Write a Prisma query for...")
  • Needs API references ("What are the Supabase auth methods?")
  • Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
在以下场景激活此Skill:
  • 用户询问设置或配置问题(例如:“如何配置Next.js中间件?”)
  • 用户请求涉及库的代码(例如:“编写一个Prisma查询来……”)
  • 用户需要API参考(例如:“Supabase的认证方法有哪些?”)
  • 用户提及特定框架(React、Vue、Svelte、Express、Tailwind等)

How to Fetch Documentation

如何获取文档

Step 1: Resolve the Library ID

步骤1:解析库ID

Call
resolve-library-id
with:
  • libraryName
    : The library name extracted from the user's question
  • query
    : The user's full question (improves relevance ranking)
调用
resolve-library-id
接口,传入:
  • libraryName
    :从用户问题中提取的库名称
  • query
    :用户的完整问题(提升相关性排序)

Step 2: Select the Best Match

步骤2:选择最佳匹配结果

From the resolution results, choose based on:
  • Exact or closest name match to what the user asked for
  • Higher benchmark scores indicate better documentation quality
  • If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
从解析结果中选择时,参考以下标准:
  • 与用户询问的名称完全匹配或最接近
  • 基准分数越高,代表文档质量越好
  • 如果用户提及了版本(例如:“React 19”),优先选择对应版本的ID

Step 3: Fetch the Documentation

步骤3:获取文档

Call
query-docs
with:
  • libraryId
    : The selected Context7 library ID (e.g.,
    /vercel/next.js
    )
  • query
    : The user's specific question
调用
query-docs
接口,传入:
  • libraryId
    :选中的Context7库ID(例如:
    /vercel/next.js
  • query
    :用户的具体问题

Step 4: Use the Documentation

步骤4:使用文档内容

Incorporate the fetched documentation into your response:
  • Answer the user's question using current, accurate information
  • Include relevant code examples from the docs
  • Cite the library version when relevant
将获取到的文档内容整合到回复中:
  • 使用最新、准确的信息回答用户问题
  • 包含文档中的相关代码示例
  • 相关时注明库的版本

Guidelines

指导原则

  • Be specific: Pass the user's full question as the query for better results
  • Version awareness: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
  • Prefer official sources: When multiple matches exist, prefer official/primary packages over community forks
  • 精准性:传入用户的完整问题作为query参数,以获得更优结果
  • 版本感知:当用户提及版本(例如:“Next.js 15”、“React 19”)时,如果解析步骤中提供了对应版本的库ID,请优先使用
  • 优先官方源:当存在多个匹配结果时,优先选择官方/主包而非社区分支