context7-auto-research by benedictking/context7-auto-research
npx skills add https://github.com/benedictking/context7-auto-research --skill context7-auto-research此技能在检测到与库/框架相关的查询时,会自动从 Context7 API 获取最新文档,确保响应使用最新信息,而非可能过时的训练数据。
当用户消息包含以下内容时,此技能应主动激活:
触发后,遵循以下工作流程:
从用户查询中识别库/框架:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用 Task 工具调用 context7-fetcher 子技能:
Task parameters:
- subagent_type: Bash
- description: "Search Context7 for library"
- prompt: node .claude/skills/context7-auto-research/context7-api.cjs search "<library-name>" "<user-query>"
示例:
Task: Search for Next.js
Prompt: node .claude/skills/context7-auto-research/context7-api.cjs search "next.js" "How to configure middleware in Next.js 15"
响应格式:
{
"libraries": [
{
"id": "/vercel/next.js",
"name": "Next.js",
"description": "The React Framework",
"trustScore": 95,
"versions": ["v15.1.8", "v14.2.0", "v13.5.0"]
}
]
}
为何使用 Task 工具?
context: fork从搜索结果中,根据以下条件选择库:
使用 Task 工具调用 context7-fetcher 子技能:
Task parameters:
- subagent_type: Bash
- description: "Fetch documentation from Context7"
- prompt: node .claude/skills/context7-auto-research/context7-api.cjs context "<library-id>" "<specific-query>"
示例:
Task: Fetch Next.js middleware docs
Prompt: node .claude/skills/context7-auto-research/context7-api.cjs context "/vercel/next.js" "middleware configuration"
响应格式:
{
"results": [
{
"title": "Middleware",
"content": "Middleware allows you to run code before a request is completed...",
"source": "docs/app/building-your-application/routing/middleware.md",
"relevance": 0.95
}
]
}
为何使用 Task 工具?
使用获取的文档来:
context7-api.cjs 脚本提供两个命令:
node context7-api.cjs search <libraryName> <query>
node context7-api.cjs context <libraryId> <query>
脚本支持两种配置 API 密钥的方式:
在技能目录中创建 .env 文件:
# In .claude/skills/context7-auto-research/.env
CONTEXT7_API_KEY=your_api_key_here
您可以从示例中复制:
cp .env.example .env
# Then edit .env with your actual API key
export CONTEXT7_API_KEY="your-api-key"
优先级: 环境变量 > .env 文件
获取 API 密钥: 访问 context7.com/dashboard 注册并获取您的 API 密钥。
如果未设置,API 将使用公共速率限制(配额较低)。
/vercel/next.js/v15.1.8 而不是 /vercel/next.js用户: "How do I use useEffect to fetch data in React 19?"
技能操作:
node context7-api.cjs search "react" "useEffect fetch data"/facebook/react/v19.0.0(版本匹配)node context7-api.cjs context "/facebook/react/v19.0.0" "useEffect data fetching"use() hook)用户: "配置 Next.js 15 的中间件"
技能操作:
node context7-api.cjs search "next.js" "middleware configuration"/vercel/next.js/v15.1.8node context7-api.cjs context "/vercel/next.js/v15.1.8" "middleware"用户: "Show me how to define one-to-many relations in Prisma"
技能操作:
node context7-api.cjs search "prisma" "one-to-many relations"/prisma/prisma(最高信任分数)node context7-api.cjs context "/prisma/prisma" "one-to-many relations"此技能采用两阶段架构:
主技能 (context7-auto-research) - 需要对话上下文:
子技能 (context7-fetcher) - 独立上下文 (context: fork):
| 方面 | 主技能 | 子技能 |
|---|---|---|
| 上下文 | 完整对话 | Fork(独立) |
| 目的 | 意图分析 | API 执行 |
| Token 使用 | 较高 | 较低 |
| 执行 | 顺序 | 可并行 |
User Query → Main Skill (detect + analyze)
↓
Task Tool → Sub-Skill (API search)
↓
Main Skill (select best match)
↓
Task Tool → Sub-Skill (API fetch docs)
↓
Main Skill (integrate + respond)
此技能补充了现有的 documentation-lookup 技能:
/context7:docs 调用两者可以共存 - 使用 auto-research 实现无缝用户体验,使用 documentation-lookup 处理显式查询。
每周安装量
310
仓库
GitHub 星标数
8
首次出现
Jan 20, 2026
安全审计
安装于
opencode253
claude-code240
codex238
gemini-cli237
github-copilot156
cursor155
This skill automatically fetches current documentation from Context7 API when detecting library/framework-related queries, ensuring responses use up-to-date information instead of potentially outdated training data.
This skill should activate proactively when the user's message contains:
When triggered, follow this workflow:
Identify the library/framework from the user's query:
Use Task tool to call context7-fetcher sub-skill:
Task parameters:
- subagent_type: Bash
- description: "Search Context7 for library"
- prompt: node .claude/skills/context7-auto-research/context7-api.cjs search "<library-name>" "<user-query>"
Example:
Task: Search for Next.js
Prompt: node .claude/skills/context7-auto-research/context7-api.cjs search "next.js" "How to configure middleware in Next.js 15"
Response format:
{
"libraries": [
{
"id": "/vercel/next.js",
"name": "Next.js",
"description": "The React Framework",
"trustScore": 95,
"versions": ["v15.1.8", "v14.2.0", "v13.5.0"]
}
]
}
Why use Task tool?
context: fork from context7-fetcher sub-skillFrom search results, choose the library based on:
Use Task tool to call context7-fetcher sub-skill:
Task parameters:
- subagent_type: Bash
- description: "Fetch documentation from Context7"
- prompt: node .claude/skills/context7-auto-research/context7-api.cjs context "<library-id>" "<specific-query>"
Example:
Task: Fetch Next.js middleware docs
Prompt: node .claude/skills/context7-auto-research/context7-api.cjs context "/vercel/next.js" "middleware configuration"
Response format:
{
"results": [
{
"title": "Middleware",
"content": "Middleware allows you to run code before a request is completed...",
"source": "docs/app/building-your-application/routing/middleware.md",
"relevance": 0.95
}
]
}
Why use Task tool?
Use the fetched documentation to:
The context7-api.cjs script provides two commands:
node context7-api.cjs search <libraryName> <query>
node context7-api.cjs context <libraryId> <query>
The script supports two ways to configure the API key:
Create a .env file in the skill directory:
# In .claude/skills/context7-auto-research/.env
CONTEXT7_API_KEY=your_api_key_here
You can copy from the example:
cp .env.example .env
# Then edit .env with your actual API key
export CONTEXT7_API_KEY="your-api-key"
Priority: Environment variable > .env file
Get API Key: Visit context7.com/dashboard to register and obtain your API key.
If not set, the API will use public rate limits (lower quota).
/vercel/next.js/v15.1.8 instead of /vercel/next.jsUser: "How do I use useEffect to fetch data in React 19?"
Skill Actions:
node context7-api.cjs search "react" "useEffect fetch data"/facebook/react/v19.0.0 (version match)node context7-api.cjs context "/facebook/react/v19.0.0" "useEffect data fetching"use() hook if applicable)User: "配置 Next.js 15 的中间件"
Skill Actions:
node context7-api.cjs search "next.js" "middleware configuration"/vercel/next.js/v15.1.8node context7-api.cjs context "/vercel/next.js/v15.1.8" "middleware"User: "Show me how to define one-to-many relations in Prisma"
Skill Actions:
node context7-api.cjs search "prisma" "one-to-many relations"/prisma/prisma (highest trust score)node context7-api.cjs context "/prisma/prisma" "one-to-many relations"This skill adopts a two-phase architecture :
Main Skill (context7-auto-research) - Needs conversation context:
Sub-Skill (context7-fetcher) - Independent context (context: fork):
| Aspect | Main Skill | Sub-Skill |
|---|---|---|
| Context | Full conversation | Fork (independent) |
| Purpose | Intent analysis | API execution |
| Token usage | Higher | Lower |
| Execution | Sequential | Can be parallel |
User Query → Main Skill (detect + analyze)
↓
Task Tool → Sub-Skill (API search)
↓
Main Skill (select best match)
↓
Task Tool → Sub-Skill (API fetch docs)
↓
Main Skill (integrate + respond)
This skill complements the existing documentation-lookup skill:
/context7:docsBoth can coexist - use auto-research for seamless UX, documentation-lookup for explicit queries.
Weekly Installs
310
Repository
GitHub Stars
8
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
opencode253
claude-code240
codex238
gemini-cli237
github-copilot156
cursor155
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装