feat: update tools with better skill/agent format prompt

This commit is contained in:
Fahreddin Özcan
2026-01-14 19:03:43 +03:00
parent 24cec23cf1
commit 32f2cdbe0c
4 changed files with 142 additions and 137 deletions

View File

@@ -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.