Design RAG Architecture
Design a Retrieval-Augmented Generation system for a given use case.
Arguments
$ARGUMENTS - The RAG use case to design for (e.g., "customer support chatbot", "documentation Q&A", "legal document search", "code assistant")
Workflow
Clarify requirements by understanding:
- What type of questions will be asked?
- What is the document corpus size and type?
- What is the required accuracy/faithfulness?
- What is the latency budget?
- Are there multi-turn conversation requirements?
Load relevant skills based on the use case:
- RAG patterns →
rag-architecture
- Vector store selection →
vector-databases
- LLM serving →
llm-serving-patterns
- Inference optimization →
ml-inference-optimization
Spawn the rag-architect agent for comprehensive design:
- Use Task tool with subagent_type="rag-architect"
- Provide full use case context and requirements
- Request end-to-end RAG architecture
Design the ingestion pipeline:
- Document extraction (PDF, HTML, code)
- Chunking strategy selection
- Embedding model selection
- Vector database configuration
- Metadata extraction and indexing
Design the retrieval pipeline:
- Query processing (expansion, HyDE)
- Retrieval strategy (dense, sparse, hybrid)
- Reranking approach
- Context assembly
- Prompt engineering
Address quality and scale:
- Retrieval accuracy (recall@k, MRR)
- Answer faithfulness (grounding)
- Latency budget allocation
- Cost optimization
- Scaling strategy
Example Usage
/sd:rag-design customer support chatbot with 10K FAQ documents
/sd:rag-design internal documentation Q&A for engineering team
/sd:rag-design legal document search for contract review
/sd:rag-design code assistant for enterprise codebase
/sd:rag-design research paper Q&A with 100K papers
/sd:rag-design product catalog search with structured data
/sd:rag-design multi-lingual knowledge base
Use Case Categories
| Category |
Key Considerations |
| Customer Support |
FAQ coverage, escalation, tone consistency |
| Documentation |
Technical accuracy, code examples, versioning |
| Legal/Compliance |
Citation accuracy, audit trails, access control |
| Code Assistance |
AST-aware chunking, context relevance, IDE integration |
| Research/Academic |
Multi-document reasoning, citation, long-form answers |
| E-commerce |
Product attributes, inventory awareness, personalization |
RAG Pattern Selection Guide
| Complexity |
Pattern |
When to Use |
| Low |
Basic RAG |
Simple Q&A, small corpus |
| Medium |
RAG + Reranking |
Higher accuracy needed |
| Medium |
Hybrid Search |
Mixed keyword + semantic queries |
| High |
Query-Transformed |
Vague or complex queries |
| High |
Agentic RAG |
Multi-hop reasoning, tool use |
Output
A comprehensive RAG system architecture including:
- Ingestion pipeline (documents → vectors)
- Retrieval pipeline (query → context)
- Technology stack (embedding model, vector DB, LLM)
- Quality targets (recall, faithfulness, latency)
- Trade-offs and alternatives
- Cost estimate (per-query and monthly)
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: rag-design3description: Design a RAG architecture for a use case Use when this capability is needed.4---56# Design RAG Architecture78Design a Retrieval-Augmented Generation system for a given use case.910## Arguments1112`$ARGUMENTS` - The RAG use case to design for (e.g., "customer support chatbot", "documentation Q&A", "legal document search", "code assistant")1314## Workflow15161. **Clarify requirements** by understanding:17 - What type of questions will be asked?18 - What is the document corpus size and type?19 - What is the required accuracy/faithfulness?20 - What is the latency budget?21 - Are there multi-turn conversation requirements?22232. **Load relevant skills** based on the use case:24 - RAG patterns → `rag-architecture`25 - Vector store selection → `vector-databases`26 - LLM serving → `llm-serving-patterns`27 - Inference optimization → `ml-inference-optimization`28293. **Spawn the rag-architect agent** for comprehensive design:30 - Use Task tool with subagent_type="rag-architect"31 - Provide full use case context and requirements32 - Request end-to-end RAG architecture33344. **Design the ingestion pipeline**:35 - Document extraction (PDF, HTML, code)36 - Chunking strategy selection37 - Embedding model selection38 - Vector database configuration39 - Metadata extraction and indexing40415. **Design the retrieval pipeline**:42 - Query processing (expansion, HyDE)43 - Retrieval strategy (dense, sparse, hybrid)44 - Reranking approach45 - Context assembly46 - Prompt engineering47486. **Address quality and scale**:49 - Retrieval accuracy (recall@k, MRR)50 - Answer faithfulness (grounding)51 - Latency budget allocation52 - Cost optimization53 - Scaling strategy5455## Example Usage5657```bash58/sd:rag-design customer support chatbot with 10K FAQ documents59/sd:rag-design internal documentation Q&A for engineering team60/sd:rag-design legal document search for contract review61/sd:rag-design code assistant for enterprise codebase62/sd:rag-design research paper Q&A with 100K papers63/sd:rag-design product catalog search with structured data64/sd:rag-design multi-lingual knowledge base65```6667## Use Case Categories6869| Category | Key Considerations |70| -------- | ------------------ |71| Customer Support | FAQ coverage, escalation, tone consistency |72| Documentation | Technical accuracy, code examples, versioning |73| Legal/Compliance | Citation accuracy, audit trails, access control |74| Code Assistance | AST-aware chunking, context relevance, IDE integration |75| Research/Academic | Multi-document reasoning, citation, long-form answers |76| E-commerce | Product attributes, inventory awareness, personalization |7778## RAG Pattern Selection Guide7980| Complexity | Pattern | When to Use |81| ---------- | ------- | ----------- |82| Low | Basic RAG | Simple Q&A, small corpus |83| Medium | RAG + Reranking | Higher accuracy needed |84| Medium | Hybrid Search | Mixed keyword + semantic queries |85| High | Query-Transformed | Vague or complex queries |86| High | Agentic RAG | Multi-hop reasoning, tool use |8788## Output8990A comprehensive RAG system architecture including:9192- Ingestion pipeline (documents → vectors)93- Retrieval pipeline (query → context)94- Technology stack (embedding model, vector DB, LLM)95- Quality targets (recall, faithfulness, latency)96- Trade-offs and alternatives97- Cost estimate (per-query and monthly)9899---100> Converted and distributed by [TomeVault](https://tomevault.io/claim/melodic-software) — claim your Tome and manage your conversions.101<!-- tomevault:4.0:skill_md:2026-04-11 -->