Automatically fetches up-to-date documentation from Context7 when users ask about libraries, frameworks, APIs, or need code examples. Triggers proactively without explicit user request.
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.js search "<library-name>" "<user-query>"Example:
Task: Search for Next.js
Prompt: node .claude/skills/context7-auto-research/context7-api.js 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.js context "<library-id>" "<specific-query>"Example:
Task: Fetch Next.js middleware docs
Prompt: node .claude/skills/context7-auto-research/context7-api.js 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.js script provides two commands:
node context7-api.js search <libraryName> <query>node context7-api.js 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_hereYou can copy from the example:
cp .env.example .env
# Then edit .env with your actual API keyexport 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.js search "react" "useEffect fetch data"/facebook/react/v19.0.0 (version match)node context7-api.js context "/facebook/react/v19.0.0" "useEffect data fetching"use() hook if applicable)User: "配置 Next.js 15 的中间件"
Skill Actions:
node context7-api.js search "next.js" "middleware configuration"/vercel/next.js/v15.1.8node context7-api.js 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.js search "prisma" "one-to-many relations"/prisma/prisma (highest trust score)node context7-api.js 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.
355d067
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.