feat: add c7 agent

This commit is contained in:
Fahreddin Özcan
2025-12-24 08:57:31 +01:00
parent 6d3752c000
commit 72fa7b63ed
3 changed files with 110 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
---
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"]
---
# Context7 Documentation Agent
Lightweight agent for fetching library documentation without bloating the main conversation context.
## When to Use
- 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..."
## Available Tools
- `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")
- `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)
## 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?"

View File

@@ -0,0 +1,31 @@
---
description: Fetch up-to-date documentation and code examples for any library
argument-hint: <library> [topic]
---
# Context7 Documentation Lookup
Fetch current, version-specific documentation straight from source repositories.
## Arguments
`$ARGUMENTS` = `<library> [topic]`
Examples:
- `react hooks` → library="react", topic="hooks"
- `next.js routing` → library="next.js", topic="routing"
- `prisma` → library="prisma", topic=none
## 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

View File

@@ -0,0 +1,40 @@
---
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.
---
# 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
## When to Trigger
- 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.
## Available Tools
- `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)
4. Present code examples and explanations