context7-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen 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 with:
resolve-library-id- : The library name extracted from the user's question
libraryName - : The user's full question (improves relevance ranking)
query
调用,传入以下参数:
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 with:
query-docs- : The selected Context7 library ID (e.g.,
libraryId)/vercel/next.js - : The user's specific question
query
调用,传入以下参数:
query-docs- :选定的Context7库ID(例如:
libraryId)/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,请使用该ID
- 优先官方源:当存在多个匹配项时,优先选择官方/主包而非社区分支