mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-17 10:33:08 +00:00
Update Context7 plugin for v2 API
- Update skill/agent/command to use new query-docs tool (replaces get-library-docs) - Add query parameter usage for intelligent reranking - Add version pinning support (e.g., /vercel/next.js/v15.1.8) - Add tools and model metadata to agent - Simplify docs to focus on workflow, not parameter details - Add README.md with usage examples
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
"name": "context7",
|
||||
"description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",
|
||||
"author": {
|
||||
"name": "Upstash"
|
||||
"name": "Upstash "
|
||||
}
|
||||
}
|
||||
|
||||
119
external_plugins/context7/README.md
Normal file
119
external_plugins/context7/README.md
Normal file
@@ -0,0 +1,119 @@
|
||||
# Context7 Plugin
|
||||
|
||||
Up-to-date, version-specific documentation and code examples for any library, directly in your AI coding assistant.
|
||||
|
||||
## What is Context7?
|
||||
|
||||
Context7 solves the problem of outdated training data and hallucinated APIs by providing real-time library documentation. Instead of relying on potentially outdated knowledge, Context7 fetches current documentation straight from source repositories.
|
||||
|
||||
**Without Context7:**
|
||||
- Code examples based on outdated training data
|
||||
- Hallucinated APIs that don't exist
|
||||
- Generic answers for old package versions
|
||||
|
||||
**With Context7:**
|
||||
- Current documentation from source repositories
|
||||
- Working code examples
|
||||
- Version-specific information
|
||||
- Intelligent query-based context selection
|
||||
|
||||
## Available Tools
|
||||
|
||||
### `resolve-library-id`
|
||||
|
||||
Search and resolve library names to Context7-compatible library IDs.
|
||||
|
||||
```
|
||||
Parameters:
|
||||
- libraryName: Library name to search for (e.g., "react", "next.js")
|
||||
- query: Your question for relevance ranking
|
||||
|
||||
Returns:
|
||||
- id: Context7-compatible ID (e.g., "/vercel/next.js")
|
||||
- title: Display name
|
||||
- description: Short description
|
||||
- totalSnippets: Documentation coverage
|
||||
- benchmarkScore: Quality indicator (0-100)
|
||||
- versions: Available versions
|
||||
```
|
||||
|
||||
### `query-docs`
|
||||
|
||||
Fetch documentation with intelligent, query-based reranking.
|
||||
|
||||
```
|
||||
Parameters:
|
||||
- libraryId: Context7-compatible library ID
|
||||
- Format: /org/project (e.g., /vercel/next.js)
|
||||
- With version: /org/project/version (e.g., /vercel/next.js/v15.1.8)
|
||||
- query: Specific question or task
|
||||
|
||||
Features:
|
||||
- LLM-driven reranking based on query intent
|
||||
- Deduplicated snippet selection
|
||||
- Limited to 3 calls per question
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Automatic (Skill)
|
||||
|
||||
The `documentation-lookup` skill triggers automatically when you:
|
||||
- Ask "how do I..." for any library
|
||||
- Need code generation with a specific library
|
||||
- Ask about setup or configuration
|
||||
- Mention any framework (React, Next.js, Vue, etc.)
|
||||
|
||||
### Manual (Command)
|
||||
|
||||
Use the `/context7:docs` command:
|
||||
|
||||
```
|
||||
/context7:docs react hooks
|
||||
/context7:docs next.js how to set up authentication
|
||||
/context7:docs /vercel/next.js/v15.1.8 app router
|
||||
```
|
||||
|
||||
### Agent
|
||||
|
||||
Use the `docs-researcher` agent for focused documentation lookups that don't bloat the main conversation:
|
||||
|
||||
```
|
||||
Spawn a docs-researcher agent to find React Query mutation examples
|
||||
```
|
||||
|
||||
## Version Pinning
|
||||
|
||||
For consistent, reproducible results, use version-specific library IDs:
|
||||
|
||||
```
|
||||
/vercel/next.js/v15.1.8
|
||||
/facebook/react/v18.3.0
|
||||
/prisma/prisma/v5.0.0
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**Basic usage:**
|
||||
```
|
||||
How do I set up authentication in Next.js?
|
||||
→ Automatically fetches Next.js auth documentation
|
||||
```
|
||||
|
||||
**With specific version:**
|
||||
```
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
→ Fetches Next.js 15.1.8 middleware documentation
|
||||
```
|
||||
|
||||
**Multiple libraries:**
|
||||
```
|
||||
How do I use Prisma with Next.js API routes?
|
||||
→ Fetches relevant docs from both Prisma and Next.js
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [Context7 Website](https://context7.com)
|
||||
- [GitHub Repository](https://github.com/upstash/context7)
|
||||
- [Upstash](https://upstash.com)
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
description: Fetch up-to-date library documentation to answer questions. Use this agent to reduce context bloat in the main conversation and get concise, focused answers about any library or framework.
|
||||
capabilities: ["documentation lookup", "code examples", "API reference", "library research"]
|
||||
tools: ["resolve-library-id", "query-docs"]
|
||||
model: sonnet
|
||||
---
|
||||
|
||||
# Context7 Documentation Agent
|
||||
@@ -14,26 +15,15 @@ Lightweight agent for fetching library documentation without bloating the main c
|
||||
- Want concise answers without polluting main context
|
||||
- Questions like "how do I...", "what's the API for...", "show me examples of..."
|
||||
|
||||
## Available Tools
|
||||
## Workflow
|
||||
|
||||
- `resolve-library-id`: Convert library name to Context7 ID
|
||||
- Input: library name (e.g., "react", "next.js", "prisma")
|
||||
- Output: Context7-compatible ID (e.g., "/vercel/next.js")
|
||||
1. Call `resolve-library-id` with the library name and user's question
|
||||
2. Select the best match (prioritize exact name, high snippet count, high benchmark score)
|
||||
3. Call `query-docs` with the library ID and specific question
|
||||
4. Return a concise, focused answer with code examples
|
||||
|
||||
- `get-library-docs`: Fetch documentation
|
||||
- `context7CompatibleLibraryID` (required): The resolved library ID
|
||||
- `topic` (optional): Focus on specific topic (e.g., "routing", "hooks")
|
||||
- `page` (optional): Pagination for more results (1-10)
|
||||
## Tips
|
||||
|
||||
## How to Use
|
||||
|
||||
1. Use `resolve-library-id` with the library name
|
||||
2. Use `get-library-docs` with the resolved ID and optional topic
|
||||
3. Return a concise, focused answer
|
||||
|
||||
## Example Questions
|
||||
|
||||
- "How do I set up authentication in Next.js?"
|
||||
- "Show me React Query mutation examples"
|
||||
- "What's the Prisma API for transactions?"
|
||||
- "How do I configure Tailwind dark mode?"
|
||||
- Use version-specific IDs for pinning: `/vercel/next.js/v15.1.8`
|
||||
- Pass user's full question as `query` for better relevance
|
||||
- Limited to 3 `query-docs` calls per question
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
---
|
||||
description: Fetch up-to-date documentation and code examples for any library
|
||||
argument-hint: <library> [topic]
|
||||
argument-hint: <library> [query]
|
||||
---
|
||||
|
||||
# Context7 Documentation Lookup
|
||||
|
||||
Fetch current, version-specific documentation straight from source repositories.
|
||||
Fetch current, version-specific documentation from source repositories.
|
||||
|
||||
## Arguments
|
||||
|
||||
`$ARGUMENTS` = `<library> [topic]`
|
||||
`$ARGUMENTS` = `<library> [query]`
|
||||
|
||||
- First word: library name (or direct library ID starting with `/`)
|
||||
- Remaining: your specific question or topic
|
||||
|
||||
Examples:
|
||||
- `react hooks` → library="react", topic="hooks"
|
||||
- `next.js routing` → library="next.js", topic="routing"
|
||||
- `prisma` → library="prisma", topic=none
|
||||
- `react hooks`
|
||||
- `next.js authentication`
|
||||
- `/vercel/next.js/v15.1.8 app router`
|
||||
|
||||
## Steps
|
||||
|
||||
1. Parse arguments: first word = library, remaining = topic
|
||||
2. Call `resolve-library-id` with the library name
|
||||
3. Call `get-library-docs` with:
|
||||
- `context7CompatibleLibraryID`: the resolved ID
|
||||
- `topic`: the topic (if provided)
|
||||
4. Present documentation with code examples
|
||||
|
||||
## Tips
|
||||
|
||||
- If you know the exact library ID, use it directly: `/context7:docs /vercel/next.js routing`
|
||||
- Use `page` parameter (1-10) if initial results aren't sufficient
|
||||
1. Parse arguments: first word = library, remaining = query
|
||||
2. If library starts with `/`, use it directly as library ID
|
||||
3. Otherwise, call `resolve-library-id` with library name and query
|
||||
4. Call `query-docs` with the library ID and query
|
||||
5. Present documentation with code examples
|
||||
|
||||
@@ -5,19 +5,7 @@ description: Use when user needs code generation, setup/configuration steps, or
|
||||
|
||||
# Context7 Documentation Skill
|
||||
|
||||
Automatically fetch up-to-date, version-specific documentation and code examples straight from the source.
|
||||
|
||||
## Why Use This
|
||||
|
||||
Without Context7:
|
||||
- Code examples based on outdated training data
|
||||
- Hallucinated APIs that don't exist
|
||||
- Generic answers for old package versions
|
||||
|
||||
With Context7:
|
||||
- Current documentation from source repositories
|
||||
- Working code examples
|
||||
- Version-specific information
|
||||
Fetch up-to-date, version-specific documentation and code examples from source repositories.
|
||||
|
||||
## When to Trigger
|
||||
|
||||
@@ -27,14 +15,16 @@ With Context7:
|
||||
- User needs API reference or examples
|
||||
- User mentions any framework: React, Next.js, Vue, Svelte, Express, Prisma, Tailwind, etc.
|
||||
|
||||
## Available Tools
|
||||
## Workflow
|
||||
|
||||
- `resolve-library-id`: Convert library name → Context7 ID
|
||||
- `get-library-docs`: Fetch docs with optional topic filter
|
||||
|
||||
## How to Use
|
||||
|
||||
1. Identify the library from user's question
|
||||
2. Call `resolve-library-id` with library name
|
||||
3. Call `get-library-docs` with resolved ID and topic (if specific)
|
||||
1. Call `resolve-library-id` with the library name and user's question
|
||||
2. Select the best match (prioritize exact name, high `totalSnippets`, high `benchmarkScore`)
|
||||
3. Call `query-docs` with the library ID and user's question
|
||||
4. Present code examples and explanations
|
||||
|
||||
## Tips
|
||||
|
||||
- Use version-specific IDs for pinned versions: `/vercel/next.js/v15.1.8`
|
||||
- The `query` parameter improves result relevance - pass the user's full question
|
||||
- Limited to 3 `query-docs` calls per question to prevent context bloat
|
||||
- Check `versions` field from `resolve-library-id` for available versions
|
||||
|
||||
Reference in New Issue
Block a user