$npx -y skills add netresearch/context7-skill --skill context7Use when looking up library documentation, API references, framework patterns, or code examples for ANY library (React, Next.js, Vue, Django, Laravel, etc.) and the Context7 MCP server is unavailable or not configured. Fetches the same current docs directly via the Context7 REST
| 1 | # Context7 Documentation Lookup Skill |
| 2 | |
| 3 | Fetch current library documentation, API references, and code examples via the Context7 REST API. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | Use this skill when the user asks about library APIs, framework patterns, or version-specific behavior. Trigger on: |
| 8 | |
| 9 | - Library questions: "How do I use [library]?", "[library] API docs", "[library] patterns" |
| 10 | - Import statements: `import`, `require`, `from` followed by a library name |
| 11 | - Framework-specific topics: hooks, routing, middleware, ORM queries, schema definitions |
| 12 | |
| 13 | ## When NOT to Use |
| 14 | |
| 15 | Do NOT use this skill for: |
| 16 | |
| 17 | - General programming concepts (closures, recursion, design patterns) |
| 18 | - Code review or refactoring tasks |
| 19 | - Debugging business logic |
| 20 | - Writing scripts from scratch without library-specific questions |
| 21 | |
| 22 | ## Core Workflow |
| 23 | |
| 24 | 1. **Search** for the library ID: |
| 25 | ```bash |
| 26 | scripts/context7.sh search "library-name" |
| 27 | ``` |
| 28 | |
| 29 | 2. **Pick the best result**: Choose the ID with the highest score and most relevant description. Prefer official sources (e.g., `/vercel/next.js` over community forks). |
| 30 | |
| 31 | 3. **Fetch documentation** with a focused topic: |
| 32 | ```bash |
| 33 | scripts/context7.sh docs "<library-id>" "<topic>" "<mode>" |
| 34 | ``` |
| 35 | |
| 36 | Always extract a specific topic from the user's question. For "How does React Suspense work with server components?", use topic `suspense server components`. |
| 37 | |
| 38 | ## Parameters |
| 39 | |
| 40 | | Parameter | Required | Description | |
| 41 | |-----------|----------|-------------| |
| 42 | | `library-id` | Yes | From search results, format `/vendor/library` | |
| 43 | | `topic` | No | Focus area extracted from user query (e.g., `hooks`, `routing`, `validation`) | |
| 44 | | `mode` | No | `code` (default) for API references; `info` for conceptual guides | |
| 45 | |
| 46 | ## Examples |
| 47 | |
| 48 | ```bash |
| 49 | # React hooks API |
| 50 | scripts/context7.sh search "react" |
| 51 | scripts/context7.sh docs "/facebook/react" "hooks" "code" |
| 52 | |
| 53 | # Next.js App Router conceptual guide |
| 54 | scripts/context7.sh search "nextjs" |
| 55 | scripts/context7.sh docs "/vercel/next.js" "app router" "info" |
| 56 | |
| 57 | # Django ORM queries |
| 58 | scripts/context7.sh search "django" |
| 59 | scripts/context7.sh docs "/django/django" "queryset filter" "code" |
| 60 | |
| 61 | # Laravel Eloquent relationships |
| 62 | scripts/context7.sh search "laravel" |
| 63 | scripts/context7.sh docs "/laravel/framework" "eloquent relationships" "code" |
| 64 | ``` |
| 65 | |
| 66 | ## Environment Configuration |
| 67 | |
| 68 | Set `CONTEXT7_API_KEY` for higher rate limits (optional): |
| 69 | |
| 70 | ```bash |
| 71 | export CONTEXT7_API_KEY="your-api-key" |
| 72 | ``` |
| 73 | |
| 74 | --- |
| 75 | |
| 76 | > **Contributing:** https://github.com/netresearch/context7-skill |