context7-efficient
Skill12 starsChanged 36 days agoMITView on GitHub
Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 83
Use --library-id for faster lookup (skips resolution):
- Distinctive: line 161
If library name fails, try variations:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context7 Efficient Documentation Fetcher
Fetch library documentation with automatic 77% token reduction via shell pipeline.
Quick Start
Always use the token-efficient shell pipeline:
# 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 queriesResult: Returns ~205 tokens instead of ~934 tokens (77% savings).
Standard Workflow
For any documentation request, follow this workflow:
1. Identify Library and Topic
Extract from user query:
- Library: React, Next.js, Prisma, Express, etc.
- Topic: Specific feature (hooks, routing, queries, etc.)
2. Fetch with Shell Pipeline
bash scripts/fetch-docs.sh --library <library> --topic <topic> --verboseThe --verbose flag shows token savings statistics.
3. Use Filtered Output
The script automatically:
- Fetches full documentation (934 tokens, stays in subprocess)
- Filters to code examples + API signatures + key notes
- Returns only essential content (205 tokens to Claude)
Parameters
Basic Usage
bash 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 statistics
Mode Selection
Code Mode (default): Returns code examples + API signatures
--mode codeInfo Mode: Returns conceptual explanations + fewer examples
--mode infoCommon Library IDs
Use --library-id for faster lookup (skips resolution):
React: /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/siteWorkflow Patterns
Pattern 1: Quick Code Examples
User asks: "Show me React useState examples"
bash scripts/fetch-docs.sh --library react --topic useState --verboseReturns: 5 code examples + API signatures + notes (~205 tokens)
Pattern 2: Learning New Library
User asks: "How do I get started with Prisma?"
# 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 codePattern 3: Specific Feature Lookup
User asks: "How does Next.js routing work?"
bash scripts/fetch-docs.sh --library-id /vercel/next.js --topic routingUsing --library-id is faster when you know the exact ID.
Pattern 4: Deep Exploration
User needs comprehensive information:
# 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 2Token Efficiency
How it works:
fetch-docs.shcallsfetch-raw.sh(which usesmcp-client.py)- Full response (934 tokens) stays in subprocess memory
- Shell filters (awk/grep/sed) extract essentials (0 LLM tokens used)
- Returns filtered output (205 tokens) to Claude
Savings:
- Direct MCP: 934 tokens per query
- This approach: 205 tokens per query
- 77% reduction
Do NOT use mcp-client.py directly - it bypasses filtering and wastes tokens.
Advanced: Library Resolution
If library name fails, try variations:
# 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 IDsTroubleshooting
| 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 |
References
For detailed Context7 MCP tool documentation, see:
- references/context7-tools.md - Complete tool reference
Implementation Notes
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.
Other versions5 projects use a version of this.
Word for word · 4
- AbdullahMalik17/Hacathan_5★ 9100% same
- AbdullahMalik17/My_skills★ 9100% same
- mani5100/claude-skills★ 2100% same
- hfzarslan/hma-claide-skills★ 0100% same
Edited · 1
- Mohsin-Raza-developer/TODO-APP★ 0100% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository60 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- browser-useSkill
- browsing-with-playwrightSkill
- building-chatgpt-appsSkill
- building-chat-interfacesSkill
- building-chat-widgetsSkill
- building-mcp-serversSkill
- building-nextjs-appsSkill
- building-rag-systemsSkill
- configuring-better-authSkill
- configuring-dapr-pubsubSkill
- containerizing-applicationsSkill
- context-degradationSkill
- context-fundamentalsSkill
- context-optimizationSkill
- creating-skillsSkill
- deploying-cloud-k8sSkill
- deploying-kafka-k8sSkill
- deploying-postgres-k8sSkill
- designing-nextjs-uiSkill
- digital-fte-orchestratorSkill
- doc-coauthoringSkill
- docxSkill
- evaluationSkill
- fetching-library-docsSkill
- generating-ceo-briefingSkill
- installing-skill-trackerSkill
- internal-commsSkill
- managing-calendarSkill
- managing-odooSkill
- managing-servicesSkill
- memory-systemsSkill
- multi-agent-patternsSkill
- nextjs-devtoolsSkill
- nx-monorepoSkill
- operating-k8s-localSkill
- operating-production-servicesSkill
- pdfSkill
- posting-facebookSkill
- posting-instagramSkill
- posting-linkedinSkill
- posting-twitterSkill
- pptxSkill
- project-designerSkill
- researching-with-deepwikiSkill
- scaffolding-fastapi-daprSkill
- scaffolding-openai-agentsSkill
- sending-emailsSkill
- skill-creatorSkill
- streaming-llm-responsesSkill
- styling-with-shadcnSkill
- systematic-debuggingSkill
- theme-factorySkill
- tool-designSkill
- watching-filesystemSkill
- watching-gmailSkill
- watching-whatsappSkill
- working-with-documentsSkill
- working-with-spreadsheetsSkill
- xlsxSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

