mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-16 22:23:07 +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:**
|
||||
- Code examples based on outdated training data
|
||||
- Hallucinated APIs that don't exist
|
||||
- Generic answers for old package versions
|
||||
- **MCP Server** - Connects Claude Code to Context7's documentation service
|
||||
- **Skills** - Auto-triggers documentation lookups when you ask about libraries
|
||||
- **Agents** - A dedicated `docs-researcher` agent for focused lookups
|
||||
- **Commands** - `/context7:docs` for manual documentation queries
|
||||
|
||||
**With Context7:**
|
||||
- Current documentation from source repositories
|
||||
- Working code examples
|
||||
- Version-specific information
|
||||
- Intelligent query-based context selection
|
||||
## Installation
|
||||
|
||||
Add the marketplace and install the plugin:
|
||||
|
||||
```bash
|
||||
claude plugin marketplace add upstash/context7
|
||||
claude plugin install context7-plugin@context7-marketplace
|
||||
```
|
||||
|
||||
## 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:
|
||||
- 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
|
||||
Input: "next.js"
|
||||
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||
```
|
||||
|
||||
### `query-docs`
|
||||
### query-docs
|
||||
|
||||
Fetch documentation with intelligent, query-based reranking.
|
||||
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||
|
||||
```
|
||||
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
|
||||
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||
Output: Relevant documentation snippets with code examples
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Usage Examples
|
||||
|
||||
### Automatic (Skill)
|
||||
The plugin works automatically when you ask about libraries:
|
||||
|
||||
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.)
|
||||
- "How do I set up authentication in Next.js 15?"
|
||||
- "Show me React Server Components examples"
|
||||
- "What's the Prisma syntax for relations?"
|
||||
|
||||
### Manual (Command)
|
||||
|
||||
Use the `/context7:docs` command:
|
||||
For manual lookups, use the command:
|
||||
|
||||
```
|
||||
/context7:docs react hooks
|
||||
/context7:docs next.js how to set up authentication
|
||||
/context7:docs /vercel/next.js/v15.1.8 app router
|
||||
/context7:docs next.js app router
|
||||
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||
```
|
||||
|
||||
### Agent
|
||||
|
||||
Use the `docs-researcher` agent for focused documentation lookups that don't bloat the main conversation:
|
||||
Or spawn the docs-researcher agent when you want to keep your main context clean:
|
||||
|
||||
```
|
||||
Spawn a docs-researcher agent to find React Query mutation examples
|
||||
spawn docs-researcher to look up Supabase auth methods
|
||||
```
|
||||
|
||||
## 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
|
||||
/facebook/react/v18.3.0
|
||||
/prisma/prisma/v5.0.0
|
||||
/supabase/supabase/v2.45.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)
|
||||
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||
|
||||
@@ -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.
|
||||
tools: ["resolve-library-id", "query-docs"]
|
||||
name: docs-researcher
|
||||
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||
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
|
||||
- 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..."
|
||||
## Process
|
||||
|
||||
## 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. 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
|
||||
2. **Resolve the library ID**: Call `resolve-library-id` with:
|
||||
- `libraryName`: The library name (e.g., "react", "next.js", "prisma")
|
||||
- `query`: The user's full question for relevance ranking
|
||||
|
||||
## 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`
|
||||
- Pass user's full question as `query` for better relevance
|
||||
- Limited to 3 `query-docs` calls per question
|
||||
4. **Fetch documentation**: Call `query-docs` with:
|
||||
- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)
|
||||
- `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]
|
||||
---
|
||||
|
||||
# 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 `/`)
|
||||
- Remaining: your specific question or topic
|
||||
- **library**: The library name, or a Context7 ID starting with `/`
|
||||
- **query**: What you're looking for (optional but recommended)
|
||||
|
||||
Examples:
|
||||
- `react hooks`
|
||||
- `next.js authentication`
|
||||
- `/vercel/next.js/v15.1.8 app router`
|
||||
## Examples
|
||||
|
||||
## 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
|
||||
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
|
||||
## How It Works
|
||||
|
||||
1. If the library starts with `/`, it's used directly as the Context7 ID
|
||||
2. Otherwise, `resolve-library-id` finds the best matching library
|
||||
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
|
||||
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
|
||||
- User needs code generation with a specific library
|
||||
- User asks about setup or configuration
|
||||
- User needs API reference or examples
|
||||
- User mentions any framework: React, Next.js, Vue, Svelte, Express, Prisma, Tailwind, etc.
|
||||
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
|
||||
- Requests code involving libraries ("Write a Prisma query for...")
|
||||
- Needs API references ("What are the Supabase auth methods?")
|
||||
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
|
||||
|
||||
## Workflow
|
||||
## How to Fetch Documentation
|
||||
|
||||
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
|
||||
### Step 1: Resolve the Library ID
|
||||
|
||||
## Tips
|
||||
Call `resolve-library-id` with:
|
||||
|
||||
- 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
|
||||
- `libraryName`: The library name extracted from the user's question
|
||||
- `query`: The user's full question (improves relevance ranking)
|
||||
|
||||
### 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