mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-16 22:23:07 +00:00
Merge PR #77: Update Context7 plugin with Skills, Agents and v2
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"context7": {
|
"context7": {
|
||||||
"command": "npx",
|
"type": "http",
|
||||||
"args": ["-y", "@upstash/context7-mcp"]
|
"url": "https://mcp.context7.com/mcp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
72
external_plugins/context7/README.md
Normal file
72
external_plugins/context7/README.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# Context7 Plugin for Claude Code
|
||||||
|
|
||||||
|
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's Included
|
||||||
|
|
||||||
|
This plugin provides:
|
||||||
|
|
||||||
|
- **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
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install the plugin from the official marketplace:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude plugin install context7@claude-plugins-official
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Tools
|
||||||
|
|
||||||
|
### resolve-library-id
|
||||||
|
|
||||||
|
Searches for libraries and returns Context7-compatible identifiers.
|
||||||
|
|
||||||
|
```
|
||||||
|
Input: "next.js"
|
||||||
|
Output: { id: "/vercel/next.js", name: "Next.js", versions: ["v15.1.8", "v14.2.0", ...] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### query-docs
|
||||||
|
|
||||||
|
Fetches documentation for a specific library, ranked by relevance to your question.
|
||||||
|
|
||||||
|
```
|
||||||
|
Input: { libraryId: "/vercel/next.js", query: "app router middleware" }
|
||||||
|
Output: Relevant documentation snippets with code examples
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
The plugin works automatically when you ask about libraries:
|
||||||
|
|
||||||
|
- "How do I set up authentication in Next.js 15?"
|
||||||
|
- "Show me React Server Components examples"
|
||||||
|
- "What's the Prisma syntax for relations?"
|
||||||
|
|
||||||
|
For manual lookups, use the command:
|
||||||
|
|
||||||
|
```
|
||||||
|
/context7:docs next.js app router
|
||||||
|
/context7:docs /vercel/next.js/v15.1.8 middleware
|
||||||
|
```
|
||||||
|
|
||||||
|
Or spawn the docs-researcher agent when you want to keep your main context clean:
|
||||||
|
|
||||||
|
```
|
||||||
|
spawn docs-researcher to look up Supabase auth methods
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version Pinning
|
||||||
|
|
||||||
|
To get documentation for a specific version, include the version in the library ID:
|
||||||
|
|
||||||
|
```
|
||||||
|
/vercel/next.js/v15.1.8
|
||||||
|
/supabase/supabase/v2.45.0
|
||||||
|
```
|
||||||
|
|
||||||
|
The `resolve-library-id` tool returns available versions, so you can pick the one that matches your project.
|
||||||
40
external_plugins/context7/agents/docs-researcher.md
Normal file
40
external_plugins/context7/agents/docs-researcher.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: docs-researcher
|
||||||
|
description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
|
||||||
|
model: sonnet
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.
|
||||||
|
|
||||||
|
## Your Task
|
||||||
|
|
||||||
|
When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.
|
||||||
|
|
||||||
|
## Process
|
||||||
|
|
||||||
|
1. **Identify the library**: Extract the library/framework name from the user's question.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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
|
||||||
45
external_plugins/context7/commands/docs.md
Normal file
45
external_plugins/context7/commands/docs.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
description: Look up documentation for any library
|
||||||
|
argument-hint: <library> [query]
|
||||||
|
---
|
||||||
|
|
||||||
|
# /context7:docs
|
||||||
|
|
||||||
|
Fetches up-to-date documentation and code examples for a library.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/context7:docs <library> [query]
|
||||||
|
```
|
||||||
|
|
||||||
|
- **library**: The library name, or a Context7 ID starting with `/`
|
||||||
|
- **query**: What you're looking for (optional but recommended)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
/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
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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.
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
name: documentation-lookup
|
||||||
|
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.
|
||||||
|
---
|
||||||
|
|
||||||
|
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
|
||||||
|
|
||||||
|
## When to Use This Skill
|
||||||
|
|
||||||
|
Activate this skill when the user:
|
||||||
|
|
||||||
|
- 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.)
|
||||||
|
|
||||||
|
## How to Fetch Documentation
|
||||||
|
|
||||||
|
### Step 1: Resolve the Library ID
|
||||||
|
|
||||||
|
Call `resolve-library-id` with:
|
||||||
|
|
||||||
|
- `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