From benedictking-skills
Fetches current documentation, setup steps, API references, and code examples from Context7 when users ask about libraries, frameworks, or SDKs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/benedictking-skills:context7-auto-researchThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
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 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 scripts/context7-api.cjs search "<library-name>" "<user-query>"
Example:
Task: Search for Next.js
Prompt: node scripts/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 scripts/context7-api.cjs context "<library-id>" "<specific-query>"
Example:
Task: Fetch Next.js middleware docs
Prompt: node scripts/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 scripts/context7-api.cjs script provides two commands:
node scripts/context7-api.cjs search <libraryName> <query>
node scripts/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 .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 scripts/context7-api.cjs search "react" "useEffect fetch data"/facebook/react/v19.0.0 (version match)node scripts/context7-api.cjs context "/facebook/react/v19.0.0" "useEffect data fetching"use() hook if applicable)User: "配置 Next.js 15 的中间件"
Skill Actions:
node scripts/context7-api.cjs search "next.js" "middleware configuration"/vercel/next.js/v15.1.8node scripts/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 scripts/context7-api.cjs search "prisma" "one-to-many relations"/prisma/prisma (highest trust score)node scripts/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.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub benedictking/benedictking-skills