context7-documentation-fetcher
npx skills add https://github.com/choiruladamm/claude-context7-skill --skill context7-documentation-fetcher
Agent 安装分布
Skill 文档
Context7 Documentation Fetcher
Overview
This skill automatically fetches up-to-date, version-specific documentation from Context7 whenever you need:
- Code generation for specific libraries
- Setup or configuration steps
- Library/API documentation
- Framework-specific implementations
Claude will automatically invoke this skill when it detects you’re asking about libraries, frameworks, or need accurate API documentation.
When This Skill Is Used
Claude automatically uses this skill when:
- You ask for code examples using specific libraries (e.g., “Create a form with React Hook Form”)
- You request setup instructions (e.g., “How to setup Next.js 15 app router?”)
- You need API documentation (e.g., “Show me Supabase auth methods”)
- You mention library names in your questions
- You ask “how to” questions about frameworks or libraries
How It Works
- Detect Library: Claude identifies which library/framework you need docs for
- Search Context7: Queries Context7 API to find the exact library ID
- Fetch Docs: Retrieves up-to-date documentation with relevant code examples
- Generate Code: Uses fresh docs to provide accurate, non-hallucinated code
Supported Libraries
This skill can fetch documentation for any library available in Context7, including:
- Frontend: React, Next.js, Vue, Nuxt, Svelte, Astro
- State Management: Zustand, Redux, TanStack Query, Jotai
- Forms: React Hook Form, Formik, Zod
- Backend: Express, Fastify, Hono, tRPC
- Database: Supabase, Prisma, Drizzle, MongoDB
- UI Libraries: Tailwind CSS, shadcn/ui, Radix UI, Mantine
- And many more…
Examples
Example 1: Form Validation
User: “Create a login form with React Hook Form and Zod validation”
What happens:
- Skill searches Context7 for “react hook form” and “zod”
- Fetches docs with topic=”validation” and topic=”integration”
- Claude generates accurate code using current API methods
Example 2: Next.js Setup
User: “Setup Next.js 15 with app router and server actions”
What happens:
- Skill searches for “next.js”
- Fetches docs with topic=”app router” and topic=”server actions”
- Claude provides step-by-step setup with correct configuration
Example 3: Database Integration
User: “How do I setup Supabase authentication?”
What happens:
- Skill searches for “supabase”
- Fetches docs with topic=”authentication”
- Claude shows current auth methods and code examples
Technical Details
API Integration
The skill uses Context7’s REST API:
- Search Endpoint:
GET /api/v1/search?query={library_name} - Docs Endpoint:
GET /api/v1/{library_id}?topic={topic}&tokens={limit}
Configuration
- API Key: Pre-configured (secure)
- Default Token Limit: 5000 tokens per request
- Response Format: Plain text suitable for direct display
- Rate Limits: Follows Context7 free tier limits
Error Handling
If a library is not found or docs are unavailable:
- Claude will inform you the library isn’t available in Context7
- Claude will fall back to its training knowledge with appropriate caveats
- Claude may suggest alternative libraries that are available
Best Practices
-
Be Specific: Mention the exact library name for best results
- Good: “Create form with React Hook Form”
- Less good: “Create a form” (skill won’t know which library to fetch)
-
Include Version: If you need a specific version, mention it
- “Using Next.js 15…” (skill will attempt to fetch that version)
-
Mention Topics: Include relevant topics for focused docs
- “Next.js server actions” â fetches server actions docs specifically
- “Supabase realtime” â fetches realtime-specific documentation
Limitations
- Only fetches from libraries available in Context7’s database
- Limited to Context7’s free tier rate limits (generous for daily use)
- Cannot access private/proprietary documentation
- Requires internet connection to fetch docs
Resources
For more information about Context7:
- Website: https://context7.com
- GitHub: https://github.com/upstash/context7
- Add Libraries: https://context7.com/add-library