$npx -y skills add affaan-m/ECC --skill documentation-lookupUse up-to-date library and framework docs via Context7 MCP instead of training data. Activates for setup questions, API references, code examples, or when the user names a framework (e.g. React, Next.js, Prisma).
| 1 | # Documentation Lookup (Context7) |
| 2 | |
| 3 | When the user asks about libraries, frameworks, or APIs, fetch current documentation via the Context7 MCP (tools `resolve-library-id` and `query-docs`) instead of relying on training data. |
| 4 | |
| 5 | ## Core Concepts |
| 6 | |
| 7 | - **Context7**: MCP server that exposes live documentation; use it instead of training data for libraries and APIs. |
| 8 | - **resolve-library-id**: Returns Context7-compatible library IDs (e.g. `/vercel/next.js`) from a library name and query. |
| 9 | - **query-docs**: Fetches documentation and code snippets for a given library ID and question. Always call resolve-library-id first to get a valid library ID. |
| 10 | |
| 11 | ## When to use |
| 12 | |
| 13 | Activate when the user: |
| 14 | |
| 15 | - Asks setup or configuration questions (e.g. "How do I configure Next.js middleware?") |
| 16 | - Requests code that depends on a library ("Write a Prisma query for...") |
| 17 | - Needs API or reference information ("What are the Supabase auth methods?") |
| 18 | - Mentions specific frameworks or libraries (React, Vue, Svelte, Express, Tailwind, Prisma, Supabase, etc.) |
| 19 | |
| 20 | Use this skill whenever the request depends on accurate, up-to-date behavior of a library, framework, or API. Applies across harnesses that have the Context7 MCP configured (e.g. Claude Code, Cursor, Codex). |
| 21 | |
| 22 | ## How it works |
| 23 | |
| 24 | ### Step 1: Resolve the Library ID |
| 25 | |
| 26 | Call the **resolve-library-id** MCP tool with: |
| 27 | |
| 28 | - **libraryName**: The library or product name taken from the user's question (e.g. `Next.js`, `Prisma`, `Supabase`). |
| 29 | - **query**: The user's full question. This improves relevance ranking of results. |
| 30 | |
| 31 | You must obtain a Context7-compatible library ID (format `/org/project` or `/org/project/version`) before querying docs. Do not call query-docs without a valid library ID from this step. |
| 32 | |
| 33 | ### Step 2: Select the Best Match |
| 34 | |
| 35 | From the resolution results, choose one result using: |
| 36 | |
| 37 | - **Name match**: Prefer exact or closest match to what the user asked for. |
| 38 | - **Benchmark score**: Higher scores indicate better documentation quality (100 is highest). |
| 39 | - **Source reputation**: Prefer High or Medium reputation when available. |
| 40 | - **Version**: If the user specified a version (e.g. "React 19", "Next.js 15"), prefer a version-specific library ID if listed (e.g. `/org/project/v1.2.0`). |
| 41 | |
| 42 | ### Step 3: Fetch the Documentation |
| 43 | |
| 44 | Call the **query-docs** MCP tool with: |
| 45 | |
| 46 | - **libraryId**: The selected Context7 library ID from Step 2 (e.g. `/vercel/next.js`). |
| 47 | - **query**: The user's specific question or task. Be specific to get relevant snippets. |
| 48 | |
| 49 | Limit: do not call query-docs (or resolve-library-id) more than 3 times per question. If the answer is unclear after 3 calls, state the uncertainty and use the best information you have rather than guessing. |
| 50 | |
| 51 | ### Step 4: Use the Documentation |
| 52 | |
| 53 | - Answer the user's question using the fetched, current information. |
| 54 | - Include relevant code examples from the docs when helpful. |
| 55 | - Cite the library or version when it matters (e.g. "In Next.js 15..."). |
| 56 | |
| 57 | ## Examples |
| 58 | |
| 59 | ### Example: Next.js middleware |
| 60 | |
| 61 | 1. Call **resolve-library-id** with `libraryName: "Next.js"`, `query: "How do I set up Next.js middleware?"`. |
| 62 | 2. From results, pick the best match (e.g. `/vercel/next.js`) by name and benchmark score. |
| 63 | 3. Call **query-docs** with `libraryId: "/vercel/next.js"`, `query: "How do I set up Next.js middleware?"`. |
| 64 | 4. Use the returned snippets and text to answer; include a minimal `middleware.ts` example from the docs if relevant. |
| 65 | |
| 66 | ### Example: Prisma query |
| 67 | |
| 68 | 1. Call **resolve-library-id** with `libraryName: "Prisma"`, `query: "How do I query with relations?"`. |
| 69 | 2. Select the official Prisma library ID (e.g. `/prisma/prisma`). |
| 70 | 3. Call **query-docs** with that `libraryId` and the query. |
| 71 | 4. Return the Prisma Client pattern (e.g. `include` or `select`) with a short code snippet from the docs. |
| 72 | |
| 73 | ### Example: Supabase auth methods |
| 74 | |
| 75 | 1. Call **resolve-library-id** with `libraryName: "Supabase"`, `query: "What are the auth methods?"`. |
| 76 | 2. Pick the Supabase docs library ID. |
| 77 | 3. Call **query-docs**; summarize the auth methods and show minimal examples from the fetched docs. |
| 78 | |
| 79 | ## Best Practices |
| 80 | |
| 81 | - **Be specific**: Use the user's full question as the query where possible for better relevance. |
| 82 | - **Version awareness**: When users mention versions, use version-specific library IDs from the resolve step when available. |
| 83 | - **Prefer official sources**: When multiple matches exist, prefer official or primary packages over community forks. |
| 84 | - **No sensitive data**: Redact API keys, passwords, tokens, and other secrets from any query sent to Context7. Treat the user's question as potentially containing secrets before passing it to resolve-library-id or query-docs. |