Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Token-efficient library API documentation fetcher using Context7 MCP with 77% token savings. Fetches code examples, API references, and usage patterns for published libraries (React, Next.js, Prisma, etc). Use when users ask "how do I use X library", need code examples, want API syntax, or are learning a framework's official API. Triggers: "Show me React hooks", "Prisma query syntax", "Next.js routing API". NOT for exploring repo internals/source code (use researching-with-deepwiki) or local fil
.claude/skills/aiskillstore-fetching-library-docs/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-23 | ✗→✓ | ▲ Improved | 31% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 258% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 50% | 0% |
Fetch library documentation with automatic 77% token reduction via shell pipeline.
Always use the token-efficient shell pipeline:
bash# Automatic library resolution + filtering bash scripts/fetch-docs.sh --library <library-name> --topic <topic> # Examples: bash scripts/fetch-docs.sh --library react --topic useState bash scripts/fetch-docs.sh --library nextjs --topic routing bash scripts/fetch-docs.sh --library prisma --topic queries
Result: Returns ~205 tokens instead of ~934 tokens (77% savings).
For any documentation request, follow this workflow:
Extract from user query:
bashbash scripts/fetch-docs.sh --library <library> --topic <topic> --verbose
The --verbose flag shows token savings statistics.
The script automatically:
bashbash scripts/fetch-docs.sh [OPTIONS]
Required (pick one):
--library <name> - Library name (e.g., "react", "nextjs")--library-id <id> - Direct Context7 ID (faster, skips resolution)Optional:
--topic <topic> - Specific feature to focus on--mode <code|info> - code for examples (default), info for concepts--page <1-10> - Pagination for more results--verbose - Show token savings statisticsCode Mode (default): Returns code examples + API signatures
bash--mode code
Info Mode: Returns conceptual explanations + fewer examples
bash--mode info
Use --library-id for faster lookup (skips resolution):
bashReact: /reactjs/react.dev Next.js: /vercel/next.js Express: /expressjs/express Prisma: /prisma/docs MongoDB: /mongodb/docs Fastify: /fastify/fastify NestJS: /nestjs/docs Vue.js: /vuejs/docs Svelte: /sveltejs/site
User asks: "Show me React useState examples"
bashbash scripts/fetch-docs.sh --library react --topic useState --verbose
Returns: 5 code examples + API signatures + notes (~205 tokens)
User asks: "How do I get started with Prisma?"
bash# Step 1: Get overview bash scripts/fetch-docs.sh --library prisma --topic "getting started" --mode info # Step 2: Get code examples bash scripts/fetch-docs.sh --library prisma --topic queries --mode code
User asks: "How does Next.js routing work?"
bashbash scripts/fetch-docs.sh --library-id /vercel/next.js --topic routing
Using --library-id is faster when you know the exact ID.
User needs comprehensive information:
bash# Page 1: Basic examples bash scripts/fetch-docs.sh --library react --topic hooks --page 1 # Page 2: Advanced patterns bash scripts/fetch-docs.sh --library react --topic hooks --page 2
How it works:
fetch-docs.sh calls fetch-raw.sh (which uses mcp-client.py)Savings:
Do NOT use mcp-client.py directly - it bypasses filtering and wastes tokens.
If library name fails, try variations:
bash# Try different formats --library "next.js" # with dot --library "nextjs" # without dot --library "next" # short form # Or search manually bash scripts/fetch-docs.sh --library "your-library" --verbose # Check output for suggested library IDs
Run: python3 scripts/verify.py
Expected: ✓ fetch-docs.sh ready
ls -la scripts/fetch-docs.shchmod +x scripts/fetch-docs.sh| Issue | Solution | |-------|----------| | Library not found | Try name variations or use broader search term | | No results | Use --mode info or broader topic | | Need more examples | Increase page: --page 2 | | Want full context | Use --mode info for explanations | | Permission denied | Run: chmod +x scripts/*.sh |
For detailed Context7 MCP tool documentation, see:
Components (for reference only, use fetch-docs.sh):
mcp-client.py - Universal MCP client (foundation)fetch-raw.sh - MCP wrapperextract-code-blocks.sh - Code example filter (awk)extract-signatures.sh - API signature filter (awk)extract-notes.sh - Important notes filter (grep)fetch-docs.sh - Main orchestrator (ALWAYS USE THIS)Architecture: Shell pipeline processes documentation in subprocess, keeping full response out of Claude's context. Only filtered essentials enter the LLM context, achieving 77% token savings with 100% functionality preserved.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-23 | fail→pass | 10,528 | 6,811 | -35% | 1 | 1 | 0% | 1,769 | 2,310 | +31% | 0 | 0 | — |
case-07 | fail→fail | 38,460 | 18,010 | -53% | 1 | 1 | 0% | 823 | 1,786 | +117% | 0 | 0 | — |
case-01 | fail→fail | 92,740 | 276,291 | +198% | 1 | 1 | 0% | 2,533 | 1,790 | -29% | 0 | 0 | — |
case-02 | fail→fail | 20,327 | 37,867 | +86% | 1 | 1 | 0% | 3,184 | 1,876 | -41% | 0 | 0 | — |
case-03 | fail→fail | 24,380 | 26,751 | +10% | 1 | 1 | 0% | 3,575 | 1,830 | -49% | 0 | 0 | — |
case-04 | pass→pass | 21,992 | 35,021 | +59% | 1 | 1 | 0% | 2,288 | 5,162 | +126% | 0 | 0 | — |
case-05 | pass→pass | 7,189 | 7,529 | +5% | 1 | 1 | 0% | 1,252 | 2,616 | +109% | 0 | 0 | — |
case-06 | pass→pass | 12,784 | 12,053 | -6% | 1 | 1 | 0% | 1,456 | 2,969 | +104% | 0 | 0 | — |
case-08 | fail→fail | 21,308 | 15,941 | -25% | 1 | 1 | 0% | 2,716 | 1,763 | -35% | 0 | 0 | — |
case-09 | fail→fail | 31,353 | 19,023 | -39% | 1 | 1 | 0% | 2,157 | 1,873 | -13% | 0 | 0 | — |
case-10 | fail→fail | 19,142 | 49,359 | +158% | 1 | 1 | 0% | 2,257 | 1,938 | -14% | 0 | 0 | — |
case-11 | fail→fail | 33,763 | 19,606 | -42% | 1 | 1 | 0% | 3,375 | 1,890 | -44% | 0 | 0 | — |
case-12 | fail→fail | 13,445 | 16,482 | +23% | 1 | 1 | 0% | 2,227 | 1,963 | -12% | 0 | 0 | — |
case-13 | fail→pass | 22,253 | 17,641 | -21% | 1 | 1 | 0% | 506 | 1,811 | +258% | 0 | 0 | — |
case-14 | fail→pass | 14,742 | 3,507 | -76% | 1 | 1 | 0% | 1,921 | 2,024 | +5% | 0 | 0 | — |
case-15 | pass→pass | 10,134 | 8,416 | -17% | 1 | 1 | 0% | 1,160 | 2,123 | +83% | 0 | 0 | — |
case-16 | fail→pass | 16,880 | 11,761 | -30% | 1 | 1 | 0% | 1,729 | 1,950 | +13% | 0 | 0 | — |
case-17 | fail→pass | 9,103 | 5,093 | -44% | 1 | 1 | 0% | 1,424 | 2,138 | +50% | 0 | 0 | — |
case-18 | fail→pass | 10,791 | 4,605 | -57% | 1 | 1 | 0% | 1,313 | 1,879 | +43% | 0 | 0 | — |
case-19 | fail→pass | 14,331 | 9,276 | -35% | 1 | 1 | 0% | 936 | 1,995 | +113% | 0 | 0 | — |
case-20 | pass→pass | 14,782 | 8,526 | -42% | 1 | 1 | 0% | 1,331 | 1,938 | +46% | 0 | 0 | — |
case-21 | pass→pass | 6,850 | 15,626 | +128% | 1 | 1 | 0% | 1,220 | 2,296 | +88% | 0 | 0 | — |
case-22 | pass→pass | 9,634 | 19,404 | +101% | 1 | 1 | 0% | 1,289 | 2,466 | +91% | 0 | 0 | — |
case-24 | fail→pass | 12,615 | 15,186 | +20% | 1 | 1 | 0% | 2,083 | 2,296 | +10% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 15 counted toward the lift figure. The other 9 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +33 percentage points is the difference between those two pass rates over the 15 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.