跳到正文
Skillpedia
通用编程64k · #3164

context7-mcp

它能做什么

这项技能让你的智能体在回答之前,先查阅软件库和框架的最新文档。适用于希望获得准确代码、而非过时示例的开发者。

适用场景

  • ✓当你请智能体编写使用 React、Next.js 或 Prisma 等库的代码的时候。
  • ✓当你询问某个框架的设置或配置问题的时候。
  • ✓当你需要你正在使用的工具的确切 API 方法的时候。

技能链接

https://github.com/upstash/context7/blob/master/packages/opencode/skills/context7-mcp/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/upstash/context7/blob/master/packages/opencode/skills/context7-mcp/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请用最新文档向我展示如何设置 Next.js 代理。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能首先在 Context7 的索引中找到正确的库,然后获取与你的问题相关的文档。智能体会依据该文档作答,而不只是依靠记忆。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.

When to Use This Skill

Activate this skill when the user:

  • Asks setup or configuration questions ("How do I configure a Next.js proxy?")
  • 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.)

How to Fetch Documentation

Step 1: Resolve the Library ID

Call resolve-library-id with:

  • libraryName: The library name extracted from the user's question
  • query: What to look up in the library's documentation (improves relevance ranking)

Step 2: Select the Best Match

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

Step 3: Fetch the Documentation

Call query-docs with:

  • libraryId: The selected Context7 library ID (e.g., /vercel/next.js)
  • query: What to look up in the library's documentation, scoped to a single concept

If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate query-docs call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.

Step 4: Use the Documentation

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: Describe what to look up in the library's documentation, but keep each query to a single concept
  • One topic per query: Split multi-topic questions into separate query-docs calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact
  • Version awareness: When users mention versions ("Next.js 16", "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
常见问题

为什么不依赖智能体的记忆?

库经常变化,记忆可能已经过时。最新文档有助于避免旧的代码示例。

它能查找特定版本的文档吗?

可以。如果你指定某个版本,例如 React 19,这项技能会优先使用该版本的文档。

它支持很多工具吗?

它支持许多库和框架,例如 React、Vue、Next.js、Prisma 和 Supabase。

详情

作者的原始描述

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

repo: upstash/context7

热度

GitHub 星标
64k
排名
#3164
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能