context7-docs-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

何时使用此技能

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.)
当用户出现以下情况时激活此技能:
  • 询问设置或配置问题(如“如何配置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
  • 保持具体:传入用户的完整问题作为查询参数,以获得更好的结果
  • 版本感知:当用户提及版本(如“Next.js 15”、“React 19”)时,如果解析步骤中提供了对应版本的库ID,请优先使用
  • 优先官方来源:当存在多个匹配结果时,优先选择官方/核心包而非社区分支