mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-20 11:33:08 +00:00
feat: update tools with better skill/agent format prompt
This commit is contained in:
@@ -1,119 +1,73 @@
|
|||||||
# Context7 Plugin
|
# Context7 Plugin for Claude Code
|
||||||
|
|
||||||
Up-to-date, version-specific documentation and code examples for any library, directly in your AI coding assistant.
|
Context7 solves a common problem with AI coding assistants: outdated training data and hallucinated APIs. Instead of relying on stale knowledge, Context7 fetches current documentation directly from source repositories.
|
||||||
|
|
||||||
## What is Context7?
|
## What's Included
|
||||||
|
|
||||||
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.
|
This plugin provides:
|
||||||
|
|
||||||
**Without Context7:**
|
- **MCP Server** - Connects Claude Code to Context7's documentation service
|
||||||
- Code examples based on outdated training data
|
- **Skills** - Auto-triggers documentation lookups when you ask about libraries
|
||||||
- Hallucinated APIs that don't exist
|
- **Agents** - A dedicated `docs-researcher` agent for focused lookups
|
||||||
- Generic answers for old package versions
|
- **Commands** - `/context7:docs` for manual documentation queries
|
||||||
|
|
||||||
**With Context7:**
|
## Installation
|
||||||
- Current documentation from source repositories
|
|
||||||
- Working code examples
|
Add the marketplace and install the plugin:
|
||||||
- Version-specific information
|
|
||||||
- Intelligent query-based context selection
|
```bash
|
||||||
|
claude plugin marketplace add upstash/context7
|
||||||
|
claude plugin install context7-plugin@context7-marketplace
|
||||||
|
```
|
||||||
|
|
||||||
## Available Tools
|
## Available Tools
|
||||||
|
|
||||||
### `resolve-library-id`
|
### resolve-library-id
|
||||||
|
|
||||||
Search and resolve library names to Context7-compatible library IDs.
|
Searches for libraries and returns Context7-compatible identifiers.
|
||||||
|
|
||||||
```
|
```
|
||||||
Parameters:
|
Input: "next.js"
|
||||||
- libraryName: Library name to search for (e.g., "react", "next.js")
|
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||||
- 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`
|
### query-docs
|
||||||
|
|
||||||
Fetch documentation with intelligent, query-based reranking.
|
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||||
|
|
||||||
```
|
```
|
||||||
Parameters:
|
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||||
- libraryId: Context7-compatible library ID
|
Output: Relevant documentation snippets with code examples
|
||||||
- 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
|
## Usage Examples
|
||||||
|
|
||||||
### Automatic (Skill)
|
The plugin works automatically when you ask about libraries:
|
||||||
|
|
||||||
The `documentation-lookup` skill triggers automatically when you:
|
- "How do I set up authentication in Next.js 15?"
|
||||||
- Ask "how do I..." for any library
|
- "Show me React Server Components examples"
|
||||||
- Need code generation with a specific library
|
- "What's the Prisma syntax for relations?"
|
||||||
- Ask about setup or configuration
|
|
||||||
- Mention any framework (React, Next.js, Vue, etc.)
|
|
||||||
|
|
||||||
### Manual (Command)
|
For manual lookups, use the command:
|
||||||
|
|
||||||
Use the `/context7:docs` command:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
/context7:docs react hooks
|
/context7:docs next.js app router
|
||||||
/context7:docs next.js how to set up authentication
|
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||||
/context7:docs /vercel/next.js/v15.1.8 app router
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Agent
|
Or spawn the docs-researcher agent when you want to keep your main context clean:
|
||||||
|
|
||||||
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
|
spawn docs-researcher to look up Supabase auth methods
|
||||||
```
|
```
|
||||||
|
|
||||||
## Version Pinning
|
## Version Pinning
|
||||||
|
|
||||||
For consistent, reproducible results, use version-specific library IDs:
|
To get documentation for a specific version, include the version in the library ID:
|
||||||
|
|
||||||
```
|
```
|
||||||
/vercel/next.js/v15.1.8
|
/vercel/next.js/v15.1.8
|
||||||
/facebook/react/v18.3.0
|
/supabase/supabase/v2.45.0
|
||||||
/prisma/prisma/v5.0.0
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||||
|
|
||||||
**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,29 +1,40 @@
|
|||||||
---
|
---
|
||||||
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.
|
name: docs-researcher
|
||||||
tools: ["resolve-library-id", "query-docs"]
|
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||||
model: sonnet
|
model: sonnet
|
||||||
---
|
---
|
||||||
|
|
||||||
# Context7 Documentation Agent
|
You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.
|
||||||
|
|
||||||
Lightweight agent for fetching library documentation without bloating the main conversation context.
|
## Your Task
|
||||||
|
|
||||||
## When to Use
|
When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.
|
||||||
|
|
||||||
- Any question about a library, framework, or package
|
## Process
|
||||||
- Need code examples or API reference
|
|
||||||
- Want concise answers without polluting main context
|
|
||||||
- Questions like "how do I...", "what's the API for...", "show me examples of..."
|
|
||||||
|
|
||||||
## Workflow
|
1. **Identify the library**: Extract the library/framework name from the user's question.
|
||||||
|
|
||||||
1. Call `resolve-library-id` with the library name and user's question
|
2. **Resolve the library ID**: Call `resolve-library-id` with:
|
||||||
2. Select the best match (prioritize exact name, high snippet count, high benchmark score)
|
- `libraryName`: The library name (e.g., "react", "next.js", "prisma")
|
||||||
3. Call `query-docs` with the library ID and specific question
|
- `query`: The user's full question for relevance ranking
|
||||||
4. Return a concise, focused answer with code examples
|
|
||||||
|
|
||||||
## Tips
|
3. **Select the best match**: From the results, pick the library with:
|
||||||
|
- Exact or closest name match
|
||||||
|
- Highest benchmark score
|
||||||
|
- Appropriate version if the user specified one (e.g., "React 19" → look for v19.x)
|
||||||
|
|
||||||
- Use version-specific IDs for pinning: `/vercel/next.js/v15.1.8`
|
4. **Fetch documentation**: Call `query-docs` with:
|
||||||
- Pass user's full question as `query` for better relevance
|
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||||
- Limited to 3 `query-docs` calls per question
|
- `query`: The user's specific question for targeted results
|
||||||
|
|
||||||
|
5. **Return a focused answer**: Summarize the relevant documentation with:
|
||||||
|
- Direct answer to the question
|
||||||
|
- Code examples from the docs
|
||||||
|
- Links or references if available
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
- Pass the user's full question as the query parameter for better relevance
|
||||||
|
- When the user mentions a version (e.g., "Next.js 15"), use version-specific library IDs if available
|
||||||
|
- If `resolve-library-id` returns multiple matches, prefer official/primary packages over community forks
|
||||||
|
- Keep responses concise - the goal is to answer the question, not dump entire documentation
|
||||||
|
|||||||
@@ -1,28 +1,45 @@
|
|||||||
---
|
---
|
||||||
description: Fetch up-to-date documentation and code examples for any library
|
description: Look up documentation for any library
|
||||||
argument-hint: <library> [query]
|
argument-hint: <library> [query]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Context7 Documentation Lookup
|
# /context7:docs
|
||||||
|
|
||||||
Fetch current, version-specific documentation from source repositories.
|
Fetches up-to-date documentation and code examples for a library.
|
||||||
|
|
||||||
## Arguments
|
## Usage
|
||||||
|
|
||||||
`$ARGUMENTS` = `<library> [query]`
|
```
|
||||||
|
/context7:docs <library> [query]
|
||||||
|
```
|
||||||
|
|
||||||
- First word: library name (or direct library ID starting with `/`)
|
- **library**: The library name, or a Context7 ID starting with `/`
|
||||||
- Remaining: your specific question or topic
|
- **query**: What you're looking for (optional but recommended)
|
||||||
|
|
||||||
Examples:
|
## Examples
|
||||||
- `react hooks`
|
|
||||||
- `next.js authentication`
|
|
||||||
- `/vercel/next.js/v15.1.8 app router`
|
|
||||||
|
|
||||||
## Steps
|
```
|
||||||
|
/context7:docs react hooks
|
||||||
|
/context7:docs next.js authentication
|
||||||
|
/context7:docs prisma relations
|
||||||
|
/context7:docs /vercel/next.js/v15.1.8 app router
|
||||||
|
/context7:docs /supabase/supabase row level security
|
||||||
|
```
|
||||||
|
|
||||||
1. Parse arguments: first word = library, remaining = query
|
## How It Works
|
||||||
2. If library starts with `/`, use it directly as library ID
|
|
||||||
3. Otherwise, call `resolve-library-id` with library name and query
|
1. If the library starts with `/`, it's used directly as the Context7 ID
|
||||||
4. Call `query-docs` with the library ID and query
|
2. Otherwise, `resolve-library-id` finds the best matching library
|
||||||
5. Present documentation with code examples
|
3. `query-docs` fetches documentation relevant to your query
|
||||||
|
4. Results include code examples and explanations
|
||||||
|
|
||||||
|
## Version-Specific Lookups
|
||||||
|
|
||||||
|
Include the version in the library ID for pinned documentation:
|
||||||
|
|
||||||
|
```
|
||||||
|
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||||
|
/context7:docs /facebook/react/v19.0.0 use hook
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful when you're working with a specific version and want docs that match exactly.
|
||||||
|
|||||||
@@ -1,30 +1,53 @@
|
|||||||
---
|
---
|
||||||
name: documentation-lookup
|
name: documentation-lookup
|
||||||
description: Use when user needs code generation, setup/configuration steps, or library/API documentation. Automatically fetch up-to-date docs for any library or framework without requiring "use context7" in the prompt.
|
description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Context7 Documentation Skill
|
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||||
|
|
||||||
Fetch up-to-date, version-specific documentation and code examples from source repositories.
|
## When to Use This Skill
|
||||||
|
|
||||||
## When to Trigger
|
Activate this skill when the user:
|
||||||
|
|
||||||
- User asks "how do I..." for any library
|
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||||
- User needs code generation with a specific library
|
- Requests code involving libraries ("Write a Prisma query for...")
|
||||||
- User asks about setup or configuration
|
- Needs API references ("What are the Supabase auth methods?")
|
||||||
- User needs API reference or examples
|
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||||
- User mentions any framework: React, Next.js, Vue, Svelte, Express, Prisma, Tailwind, etc.
|
|
||||||
|
|
||||||
## Workflow
|
## How to Fetch Documentation
|
||||||
|
|
||||||
1. Call `resolve-library-id` with the library name and user's question
|
### Step 1: Resolve the Library ID
|
||||||
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
|
Call `resolve-library-id` with:
|
||||||
|
|
||||||
- Use version-specific IDs for pinned versions: `/vercel/next.js/v15.1.8`
|
- `libraryName`: The library name extracted from the user's question
|
||||||
- The `query` parameter improves result relevance - pass the user's full question
|
- `query`: The user's full question (improves relevance ranking)
|
||||||
- Limited to 3 `query-docs` calls per question to prevent context bloat
|
|
||||||
- Check `versions` field from `resolve-library-id` for available versions
|
### Step 2: Select the Best Match
|
||||||
|
|
||||||
|
From the resolution results, choose based on:
|
||||||
|
|
||||||
|
- Exact or closest name match to what the user asked for
|
||||||
|
- Higher benchmark scores indicate better documentation quality
|
||||||
|
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
|
||||||
|
|
||||||
|
### Step 3: Fetch the Documentation
|
||||||
|
|
||||||
|
Call `query-docs` with:
|
||||||
|
|
||||||
|
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||||
|
- `query`: The user's specific question
|
||||||
|
|
||||||
|
### Step 4: Use the Documentation
|
||||||
|
|
||||||
|
Incorporate the fetched documentation into your response:
|
||||||
|
|
||||||
|
- Answer the user's question using current, accurate information
|
||||||
|
- Include relevant code examples from the docs
|
||||||
|
- Cite the library version when relevant
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
- **Be specific**: Pass the user's full question as the query for better results
|
||||||
|
- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
|
||||||
|
- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks
|
||||||
|
|||||||
Reference in New Issue
Block a user