context7-efficient
Fetch library docs efficiently for development support.
Install
mkdir -p .claude/skills/context7-efficient && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11537" && unzip -o skill.zip -d .claude/skills/context7-efficient && rm skill.zipInstalls to .claude/skills/context7-efficient
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Fetch library documentation efficiently
- →Filter documentation to save tokens (77% reduction)
- →Retrieve code examples and API signatures
- →Access conceptual explanations for libraries
- →Support JavaScript, Python, Go, Rust, and other libraries
- →Troubleshoot with library-specific information
How it works
The skill fetches full library documentation and then uses shell pipelines to filter out only essential content like code examples and API signatures, reducing token usage before sending to the LLM.
Inputs & outputs
When to use context7-efficient
- →Fetch react hooks documentation
- →Get api usage patterns
- →Get code examples for libraries
About this skill
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 queries
bash scripts/fetch-docs.sh --library better-auth --topic queries
Result: 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> --verbose
The --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 code
Info Mode: Returns conceptual explanations + fewer examples
--mode info
Common 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/site
Workflow Patterns
Pattern 1: Quick Code Examples
User asks: "Show me React useState examples"
bash scripts/fetch-docs.sh --library react --topic useState --verbose
Returns: 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 code
Pattern 3: Specific Feature Lookup
User asks: "How does Next.js routing work?"
bash scripts/fetch-docs.sh --library-id /vercel/next.js --topic routing
Using --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 2
Token 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 IDs
Troubleshooting
| 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.
When not to use it
- →When the task requires bypassing filtering and using `mcp-client.py` directly
- →When the task involves using an incorrect library name without trying variations
- →When the task requires full, unfiltered documentation for every query
Limitations
- →The skill does not use `mcp-client.py` directly to bypass filtering.
- →The skill focuses on token efficiency through filtering.
- →The skill returns filtered output, not the full raw documentation to Claude.
How it compares
This skill uses an intelligent shell pipeline to filter documentation and achieve significant token savings, providing a more cost-effective and efficient way to retrieve specific information compared to fetching full documentation.
Compared to similar skills
context7-efficient side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| context7-efficient (this skill) | 0 | 5mo | Review | Beginner |
| openrouter-hello-world | 7 | 25d | Caution | Beginner |
| telegram-dev | 2 | 7mo | Review | Intermediate |
| langfuse-install-auth | 0 | 25d | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by diegosouzapw
View all by diegosouzapw →You might also like
openrouter-hello-world
jeremylongshore
Create your first OpenRouter API request with a simple example. Use when learning OpenRouter or testing your setup. Trigger with phrases like 'openrouter hello world', 'openrouter first request', 'openrouter quickstart', 'test openrouter'.
telegram-dev
2025Emma
Telegram 生态开发全栈指南 - 涵盖 Bot API、Mini Apps (Web Apps)、MTProto 客户端开发。包括消息处理、支付、内联模式、Webhook、认证、存储、传感器 API 等完整开发资源。
langfuse-install-auth
jeremylongshore
Install and configure Langfuse SDK authentication for LLM observability. Use when setting up a new Langfuse integration, configuring API keys, or initializing Langfuse tracing in your project. Trigger with phrases like "install langfuse", "setup langfuse", "langfuse auth", "configure langfuse API key", "langfuse tracing setup".
perplexity-known-pitfalls
jeremylongshore
Identify and avoid Perplexity anti-patterns and common integration mistakes. Use when reviewing Perplexity code for issues, onboarding new developers, or auditing existing Perplexity integrations for best practices violations. Trigger with phrases like "perplexity mistakes", "perplexity anti-patterns", "perplexity pitfalls", "perplexity what not to do", "perplexity code review".
perplexity-upgrade-migration
jeremylongshore
Analyze, plan, and execute Perplexity SDK upgrades with breaking change detection. Use when upgrading Perplexity SDK versions, detecting deprecations, or migrating to new API versions. Trigger with phrases like "upgrade perplexity", "perplexity migration", "perplexity breaking changes", "update perplexity SDK", "analyze perplexity version".
ast-grep-find
parcadei
AST-based code search and refactoring via ast-grep MCP