Agent skill
context7-search
Retrieve real-time technical documentation and code snippets from third-party libraries using the Context7 V2 API.
Install this agent skill to your Project
npx add-skill https://github.com/barrychen38/agent-context7-skill/tree/main/skills/context7
SKILL.md
Skill: Context7 Documentation Expert
This skill gives you access to the Context7 API to fetch up-to-date documentation, API references, and code examples. Use this to avoid hallucinations about library versions or API signatures.
When to Use
- Unknown Libraries: When you need to use a library you are not familiar with.
- Version Verification: To check if a specific API exists in the latest version of a library (e.g., Next.js App Router vs Pages Router).
- Debugging: To find official solutions for error messages related to external dependencies.
Workflow (Strict Two-Step Process)
Step 1: Search for Library ID
You MUST search first to resolve the correct libraryId required by the API. Do not guess the ID.
-
Command:
./scripts/context7_tool.sh search "<library_name>" -
Action:
- Parse the JSON response.
- Locate the
idfield (e.g.,/vercel/next.js,/shadcn-ui/ui). - Select the most relevant ID.
Step 2: Retrieve Context
Use the libraryId found in Step 1 to fetch specific documentation.
-
Command:
./scripts/context7_tool.sh context "<library_id>" "<specific_technical_question>" -
Example:
./scripts/context7_tool.sh context "/vercel/next.js" "how to use server actions with form validation"
Output Guidelines
- Synthesize, Don't Dump: The tool returns raw JSON containing
code_snippetsandcontent. Do not output the raw JSON to the user. - Code First: Prioritize extracting and adapting the code snippets to solve the user's problem.
- Citation: Explicitly mention that the solution is based on "Context7 documentation".
Troubleshooting & Requirements
- Dependencies: Requires
curlandjqinstalled on the system. - Proxy/SSL: The script is pre-configured to handle local proxy SSL issues (
-k --proxy-insecure). - Errors:
- If the search returns an empty list, ask the user to verify the library name.
- If you receive a "validation error", ensure you are using the correct
libraryIdfrom Step 1, not just the name.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
git-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
migrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
scaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?