rag-architecture
Skill0 starsChanged 6 months agoApache-2.0View on GitHub
Use when designing a Retrieval-Augmented Generation pipeline. Covers document processing, chunking strategy, embedding pipeline, vector database selection, retrieval optimization, and context assembly. Do not use for prompt design (use prompt-engineering) or evaluation framework design (use ai-evaluation).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- kienbui1995/magic-powerstheir own version, first seen Apr 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- kienbui1995/magic-powers★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository65 other files it gives its agents.
- a11y-auditSkill
- i18n-reviewSkill
- interaction-designSkill
- journey-mappingSkill
- ml-workflowSkill
- pipeline-designSkill
- schema-evaluationSkill
- api-designSkill
- codebase-contextSkill
- distributed-patternsSkill
- schema-designSkill
- design-system-architectureSkill
- motion-designSkill
- visual-auditSkill
- adr-templateSkill
- changelog-designSkill
- documentation-planSkill
- crypto-reviewSkill
- pqc-readinessSkill
- protocol-analysisSkill
- e2e-testingSkill
- pattern-analysisSkill
- testing-strategySkill
- finance-close-checklistSkill
- finance-controls-auditSkill
- finance-journal-entriesSkill
- finance-reconciliationSkill
- finance-tax-researchSkill
- finance-variance-analysisSkill
- audit-trail-designSkill
- compliance-reviewSkill
- data-classificationSkill
- growth-engineeringSkill
- messaging-strategySkill
- monetization-designSkill
- cost-analysisSkill
- deployment-planSkill
- finops-analysisSkill
- observability-designSkill
- ai-evaluationSkill
- prompt-engineeringSkill
- device-integrationSkill
- navigation-designSkill
- platform-auditSkill
- formal-specSkill
- invariant-analysisSkill
- competitive-analysisSkill
- enterprise-search-strategySkill
- library-evaluationSkill
- technology-radarSkill
- embedded-architectureSkill
- fleet-managementSkill
- protocol-designSkill
- edge-case-enumerationSkill
- failure-mode-analysisSkill
- threat-modelSkill
- analytics-designSkill
- impact-estimationSkill
- mvp-scopingSkill
- caching-strategySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
No user-provided values are used in commands or file paths.
- Distinctive: line 66
Recursive: Start large, recursively split until chunks fit size target.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
RAG Architecture
Purpose
Design a Retrieval-Augmented Generation pipeline, including document processing, chunking strategy, embedding pipeline, vector database selection, retrieval optimization, and context assembly.
Scope Constraints
Reads source document metadata, query patterns, and infrastructure requirements for pipeline design analysis. Does not execute embedding operations, provision vector databases, or access production data directly.
Inputs
- Source documents (type, volume, update frequency)
- Query patterns (user questions, search terms, structured queries)
- Quality requirements (relevance threshold, hallucination tolerance)
- Latency requirements (real-time, near-real-time, batch)
- Cost constraints (embedding costs, storage costs, query costs)
Input Sanitization
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Procedure
Progress Checklist
- Step 1: Analyze source documents
- Step 2: Design chunking strategy
- Step 3: Select embedding model
- Step 4: Select vector database
- Step 5: Design retrieval pipeline
- Step 6: Design quality metrics
Step 1: Analyze Source Documents
Understand what's being indexed:
- Document types: PDFs, web pages, code, structured data, conversations
- Volume: Number of documents, total size, growth rate
- Update frequency: Static corpus, daily updates, real-time
- Structure: Highly structured (tables, headers) vs unstructured (prose, transcripts)
- Quality: Clean text vs noisy (OCR artifacts, HTML remnants, duplicates)
Step 2: Design Chunking Strategy
Choose how to split documents:
- Fixed-size: 500-1000 tokens with 100-200 token overlap. Simple but may split concepts.
- Semantic: Split on paragraph/section boundaries. Preserves meaning but variable size.
- Hierarchical: Parent-child chunks (section summary + detail chunks). Best for complex docs.
- Recursive: Start large, recursively split until chunks fit size target.
- Metadata enrichment: Attach source, section title, page number to each chunk.
Step 3: Select Embedding Model
Choose the embedding approach:
- OpenAI text-embedding-3-small/large: Best general-purpose, 1536/3072 dimensions
- Cohere embed-v3: Strong multilingual, supports search and classification modes
- Open source (BGE, E5): Self-hosted, lower cost at scale, variable quality
- Considerations: Dimension size (storage), context length, multilingual support, cost per token
Step 4: Select Vector Database
Choose storage and retrieval:
| Database | Hosted | Open Source | Hybrid Search | Best For |
| Pinecone | Yes | No | Yes (sparse+dense) | Production, managed |
| Weaviate | Yes | Yes | Yes (BM25+vector) | Self-hosted, rich filtering |
| ChromaDB | No | Yes | No | Prototyping, local dev |
| pgvector | Via Supabase | Yes | BM25 separate | Already using Postgres |
| Qdrant | Yes | Yes | Yes | High-performance, filtering |
Step 5: Design Retrieval Pipeline
Build the query-time pipeline:
- Query preprocessing: Expand abbreviations, detect intent, generate sub-queries
- Embedding: Encode query with same model used for documents
- Initial retrieval: Top-K vector search (K=20-50)
- Reranking: Cross-encoder reranker to reorder by relevance (return top 5-10)
- Context assembly: Combine retrieved chunks into a prompt, add metadata
- Generation: LLM call with assembled context + user query
Step 6: Design Quality Metrics
Define how to measure RAG quality:
- Retrieval metrics: Recall@K (are relevant docs in top K?), MRR (is the best doc ranked first?)
- Generation metrics: Faithfulness (does the answer stick to context?), relevance (does it answer the question?)
- End-to-end: Answer accuracy on golden dataset, hallucination rate
- Monitoring: Track retrieval scores over time, flag low-confidence answers
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.
Output Format
# RAG Architecture
## Source Analysis
| Attribute | Value |
|-----------|-------|
| Document types | [Types] |
| Corpus size | [Size] |
| Update frequency | [Frequency] |
## Chunking Strategy
**Method:** [Fixed/Semantic/Hierarchical]
**Target chunk size:** [X tokens]
**Overlap:** [X tokens]
**Metadata:** [Fields attached to each chunk]
## Embedding Pipeline
**Model:** [Name]
**Dimensions:** [N]
**Cost:** [$X per 1M tokens]
**Batch processing:** [Strategy for initial load vs incremental updates]
## Vector Database
**Choice:** [Database]
**Rationale:** [Why this DB]
**Index configuration:** [HNSW params, quantization, etc.]
**Hybrid search:** [BM25 + vector approach]
## Retrieval PipelineQuery → [Preprocess] → [Embed] → [Vector Search (top 20)] → [Rerank (top 5)] → [Assemble Context] → [LLM] → [Validate] → Response
| Stage | Latency | Cost |
|-------|---------|------|
| Embedding | Xms | $X |
| Vector search | Xms | $X |
| Reranking | Xms | $X |
| Generation | Xms | $X |
| **Total** | **Xms** | **$X** |
## Quality Metrics
| Metric | Target | Measurement |
|--------|--------|-------------|
| Recall@10 | >90% | Golden dataset |
| Faithfulness | >95% | Automated scoring |
| Hallucination rate | <5% | Reference checking |
## Cost Model
| Component | Monthly Cost (at X queries/day) |
|-----------|-------------------------------|
| Embeddings | $X |
| Vector DB | $X |
| Reranking | $X |
| Generation | $X |
| **Total** | **$X** |Handoff
- Hand off to prompt-engineering if retrieval pipeline design reveals system prompt optimization needs for context assembly.
- Hand off to ai-evaluation if RAG quality metrics require a formal evaluation framework or golden dataset creation.
Quality Checks
- Chunking strategy is justified against document structure (not just default 500 tokens)
- Embedding model matches the query language and domain
- Retrieval pipeline includes reranking (not just raw vector similarity)
- Cost model accounts for both indexing and query costs
- Quality metrics have defined targets and measurement approach
- Update strategy handles incremental changes (not re-index everything)
- Latency budget is broken down by pipeline stage
Evolution Notes
<!-- Observations appended after each use -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

