rag-pipeline-builder
Skill8 starsChanged 9 months agoMITView on GitHub
Build production-ready RAG (Retrieval-Augmented Generation) pipelines from scratch with MongoDB Atlas Vector Search, Voyage AI embeddings, and proven chunking strategies
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Nikoxkx/Agent-Skillstheir own version, first seen Jun 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Nikoxkx/Agent-Skills★ 1same 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 repository9 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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 19
Use this skill when building a RAG system from scratch, creating document chatbots, implementing semantic search, or setting up knowledge …
- Distinctive: line 30
Every production RAG pipeline follows the same flow: ingest documents → chunk intelligently → embed with quality models → store in vector …
- Distinctive: line 71
Only process new/changed documents
- Distinctive: line 86
Not all results are equal.
- Distinctive: line 92
Don't block responses to log usage:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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-pipeline-builder
Trigger
Use this skill when building a RAG system from scratch, creating document chatbots, implementing semantic search, or setting up knowledge base retrieval for AI applications.
Trigger phrases:
- "Build a RAG pipeline"
- "Document chatbot"
- "Semantic search over my docs"
- "Ingest and search"
- "Knowledge base retrieval"
Overview
Every production RAG pipeline follows the same flow: ingest documents → chunk intelligently → embed with quality models → store in vector database → retrieve relevant context → generate responses. This skill generates the complete pipeline with battle-tested patterns from real deployments (AA Companion, VAI workflows, Developer Day demos).
This is not about adding AI to an existing app (that's mongodb-ai-features). This is about building a RAG system from the ground up.
How to Use
Quick Start
- Analyze your documents:
python scripts/chunking_strategy_analyzer.py docs/ - Estimate costs:
python scripts/rag_cost_estimator.py --docs 1000 --queries-per-month 5000 - Generate pipeline from templates in
assets/ - Validate:
python scripts/pipeline_validator.py config.json
Python Tools
scripts/chunking_strategy_analyzer.py— Analyze documents and recommend optimal chunking strategyscripts/rag_cost_estimator.py— Estimate embedding, storage, and query costsscripts/pipeline_validator.py— Validate pipeline config and test retrieval quality
Reference Docs
references/chunking-strategies.md— Deep dive on chunking approachesreferences/rag-patterns.md— Production patterns from real deployments
Templates & Assets
assets/ingest-pipeline.js— Complete ingestion with content hashingassets/vector-index-config.json— Atlas Vector Search index definitionassets/retrieval-api.js— Retrieval API with score boostingassets/chat-endpoint.js— Streaming chat endpointassets/sample-queries.json— Test queries for validation
Architecture Decisions
Why Voyage AI for Embeddings
- Quality: Voyage-3 outperforms OpenAI on retrieval benchmarks
- Cost: ~$0.02 per 1M tokens (10x cheaper than text-embedding-3-large)
- Speed: Fast batch processing (128 documents per batch)
- Integration: Seamless with MongoDB Atlas Vector Search
Content Hashing for Incremental Ingestion
Reprocessing entire corpus on every update is wasteful. Content hashing (SHA-256) enables incremental updates:
- Hash each document before embedding
- Store hash in metadata
- On re-ingestion, skip documents with matching hashes
- Only process new/changed documents
Result: 90%+ cost reduction after initial ingestion.
Chunking Strategy Selection
| Content Type | Strategy | Chunk Size | Overlap | Why |
| Prose/articles | Recursive | 1000 tokens | 200 | Preserves paragraph boundaries |
| Code | Function-boundary | Variable | None | Keeps functions intact |
| Structured docs | Paragraph | Variable | None | Respects document structure |
| API docs | Endpoint-based | Variable | None | Self-contained endpoints |
| Conversations | Turn-boundary | Variable | None | Keeps Q&A pairs together |
Category-Based Score Boosting
Not all results are equal. Boost by document category:
const boostedScore = baseScore * (doc.category === 'ui' ? 1.5 : 1.0);Fire-and-Forget Usage Logging
Don't block responses to log usage:
logUsage(query, results).catch(err => console.error('Log failed:', err));
return results; // Return immediatelyGenerated Pipeline Structure
my-rag-app/
├── ingest/
│ ├── ingest.js # Main ingestion pipeline
│ ├── chunkers/
│ │ ├── recursive.js # Recursive text splitting
│ │ ├── semantic.js # Paragraph-based
│ │ └── code.js # Function-boundary
│ └── utils/
│ ├── content-hash.js # SHA-256 hashing
│ └── batch-embed.js # Voyage AI batching
├── index/
│ ├── create-index.js # Atlas Vector Search setup
│ └── index-config.json # Index definition
├── api/
│ ├── search.js # Retrieval API
│ ├── chat.js # Chat endpoint
│ └── middleware/
│ └── usage-logger.js # Fire-and-forget logging
├── lib/
│ ├── voyage-client.js # Voyage AI wrapper
│ ├── atlas-client.js # MongoDB connection
│ └── score-booster.js # Category boosting
├── tests/
│ ├── retrieval-quality.test.js
│ └── fixtures/
│ └── sample-queries.json
├── .env.example
└── README.mdWhen to Use vs. mongodb-ai-features
Use rag-pipeline-builder | Use mongodb-ai-features |
| Building RAG from scratch | Adding AI to existing app |
| Document chatbot | Project summarization |
| Knowledge base search | Feedback analysis |
| Semantic docs search | AI-generated content |
| No existing schema | App has MongoDB models |
Environment Variables
# MongoDB Atlas
MONGODB_URI=mongodb+srv://user:pass@cluster.mongodb.net/rag-db
# Voyage AI
VOYAGE_API_KEY=pa-xxx...
# Optional: LLM for generation
OPENAI_API_KEY=sk-xxx...
# Configuration
VECTOR_INDEX_NAME=vector_index
COLLECTION_NAME=documents
EMBEDDING_DIMENSIONS=1024
CHUNK_SIZE=1000
CHUNK_OVERLAP=200Production Checklist
- Chunking strategy validated with analyzer
- Cost estimation completed
- Vector index created (correct dimensions)
- Retrieval quality tested (MRR > 0.7)
- Incremental ingestion implemented
- Score boosting configured
- Usage logging implemented
- Error handling on embed failures
- Rate limiting configured
- Monitoring for latency/errors
References
- Voyage AI: https://voyage.ai/pricing
- Atlas Vector Search: https://mongodb.com/docs/atlas/atlas-vector-search/
- Chunking strategies:
references/chunking-strategies.md - RAG patterns:
references/rag-patterns.md
Credits
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.

