context7 by intellectronica/agent-skills
npx skills add https://github.com/intellectronica/agent-skills --skill context7此技能通过 curl 查询 Context7 API,能够检索软件库和组件的当前文档。使用它来替代依赖可能已过时的训练数据。
要查找 Context7 库 ID,请查询搜索端点:
curl -s "https://context7.com/api/v2/libs/search?libraryName=LIBRARY_NAME&query=TOPIC" | jq '.results[0]'
参数:
libraryName (必填):要搜索的库名称(例如,"react"、"nextjs"、"fastapi"、"axios")query (必填):用于相关性排名的主题描述响应字段:
id:用于上下文端点的库标识符(例如,/websites/react_dev_reference)title:人类可读的库名称广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
description:库的简要描述totalSnippets:可用的文档片段数量要检索文档,请使用步骤 1 中获取的库 ID:
curl -s "https://context7.com/api/v2/context?libraryId=LIBRARY_ID&query=TOPIC&type=txt"
参数:
libraryId (必填):来自搜索结果的库 IDquery (必填):要检索文档的具体主题type (可选):响应格式 - json (默认) 或 txt (纯文本,更易读)# 查找 React 库 ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=react&query=hooks" | jq '.results[0].id'
# 返回:"/websites/react_dev_reference"
# 获取 useState 文档
curl -s "https://context7.com/api/v2/context?libraryId=/websites/react_dev_reference&query=useState&type=txt"
# 查找 Next.js 库 ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=routing" | jq '.results[0].id'
# 获取 app router 文档
curl -s "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=app+router&type=txt"
# 查找 FastAPI 库 ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=fastapi&query=dependencies" | jq '.results[0].id'
# 获取依赖注入文档
curl -s "https://context7.com/api/v2/context?libraryId=/fastapi/fastapi&query=dependency+injection&type=txt"
type=txt 以获得更易读的输出jq 来过滤和格式化 JSON 响应query 参数中尽量具体,以提高相关性排名+ 或 %20)每周安装量
3.8K
代码仓库
GitHub 星标数
228
首次出现
2026年1月20日
安全审计
安装于
opencode3.1K
codex2.9K
gemini-cli2.8K
claude-code2.6K
github-copilot2.5K
cursor2.3K
This skill enables retrieval of current documentation for software libraries and components by querying the Context7 API via curl. Use it instead of relying on potentially outdated training data.
To find the Context7 library ID, query the search endpoint:
curl -s "https://context7.com/api/v2/libs/search?libraryName=LIBRARY_NAME&query=TOPIC" | jq '.results[0]'
Parameters:
libraryName (required): The library name to search for (e.g., "react", "nextjs", "fastapi", "axios")query (required): A description of the topic for relevance rankingResponse fields:
id: Library identifier for the context endpoint (e.g., /websites/react_dev_reference)title: Human-readable library namedescription: Brief description of the librarytotalSnippets: Number of documentation snippets availableTo retrieve documentation, use the library ID from step 1:
curl -s "https://context7.com/api/v2/context?libraryId=LIBRARY_ID&query=TOPIC&type=txt"
Parameters:
libraryId (required): The library ID from search resultsquery (required): The specific topic to retrieve documentation fortype (optional): Response format - json (default) or txt (plain text, more readable)# Find React library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=react&query=hooks" | jq '.results[0].id'
# Returns: "/websites/react_dev_reference"
# Fetch useState documentation
curl -s "https://context7.com/api/v2/context?libraryId=/websites/react_dev_reference&query=useState&type=txt"
# Find Next.js library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=routing" | jq '.results[0].id'
# Fetch app router documentation
curl -s "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=app+router&type=txt"
# Find FastAPI library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=fastapi&query=dependencies" | jq '.results[0].id'
# Fetch dependency injection documentation
curl -s "https://context7.com/api/v2/context?libraryId=/fastapi/fastapi&query=dependency+injection&type=txt"
type=txt for more readable outputjq to filter and format JSON responsesquery parameter to improve relevance ranking+ or %20)Weekly Installs
3.8K
Repository
GitHub Stars
228
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode3.1K
codex2.9K
gemini-cli2.8K
claude-code2.6K
github-copilot2.5K
cursor2.3K
97,600 周安装