Convex Agents RAG
について
このスキルは、カスタム知識ベースでClaudeエージェントを強化するため、検索拡張生成(RAG)を実装しています。これにより、エージェントは文書を検索し、関連するコンテキストを取得できるようになります。ポリシー、製品ドキュメント、FAQなどの特定のデータに基づいてエージェントの応答を接地し、虚構生成を減らす必要がある場合にご利用ください。これは、意味検索機能と生成機能を組み合わせ、正確でコンテキストを認識するシステムを構築するためのものです。
クイックインストール
Claude Code
推奨/plugin add https://github.com/Sstobo/convex-skillsgit clone https://github.com/Sstobo/convex-skills.git ~/.claude/skills/Convex Agents RAGこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Purpose
Enables agents to search through custom content and knowledge bases to provide accurate, context-grounded responses. RAG combines LLM capabilities with semantic search.
When to Use This Skill
- Agents need to reference a knowledge base or document collection
- Grounding answers in specific data (policies, product docs, etc.)
- Semantic search across custom content
- Building a search + generation system (FAQ, documentation, support)
- Reducing hallucinations by constraining responses to known information
- Managing user-specific or team-specific knowledge namespaces
Setup
Install and configure RAG in your convex.config.ts:
import { defineApp } from "convex/server";
import agent from "@convex-dev/agent/convex.config";
import rag from "@convex-dev/rag/convex.config";
const app = defineApp();
app.use(agent);
app.use(rag);
export default app;
Add Content
Ingest documents into a namespace:
import { rag } from "@convex-dev/rag";
export const addContent = action({
args: { userId: v.string(), key: v.string(), text: v.string() },
handler: async (ctx, { userId, key, text }) => {
const namespace = `user:${userId}`;
await rag.addContent(ctx, components.rag, {
namespace,
key,
text,
filters: { filterNames: [filename] },
});
},
});
Search and Generate
Use RAG with agents:
export const answerWithContext = action({
args: { threadId: v.string(), userId: v.string(), question: v.string() },
handler: async (ctx, { threadId, userId, question }) => {
const { thread } = await myAgent.continueThread(ctx, { threadId });
const context = await rag.search(ctx, components.rag, {
namespace: `user:${userId}`,
query: question,
limit: 10,
});
const augmentedPrompt = `# Context:\n\n${context.text}\n\n# Question:\n\n${question}`;
const result = await thread.generateText({ prompt: augmentedPrompt });
return result.text;
},
});
Key Principles
- Namespaces isolate data: Use
user:userIdorteam:teamIdfor multi-tenant safety - Hybrid search: Combine text and vector search for better results
- Filtering: Use
filterNamesto target specific documents
Next Steps
- See fundamentals for basic agent setup
- See context for advanced context customization
GitHub リポジトリ
関連スキル
content-collections
メタThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
polymarket
メタThis skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.
cloudflare-turnstile
メタThis skill provides comprehensive guidance for implementing Cloudflare Turnstile as a CAPTCHA-alternative bot protection system. It covers integration for forms, login pages, API endpoints, and frameworks like React/Next.js/Hono, while handling invisible challenges that maintain user experience. Use it when migrating from reCAPTCHA, debugging error codes, or implementing token validation and E2E tests.
hybrid-cloud-networking
メタThis skill configures secure hybrid cloud networking between on-premises infrastructure and cloud platforms like AWS, Azure, and GCP. Use it when connecting data centers to the cloud, building hybrid architectures, or implementing secure cross-premises connectivity. It supports key capabilities such as VPNs and dedicated connections like AWS Direct Connect for high-performance, reliable setups.
