Skip to main content

Claude Prompt to Design a Production RAG Pipeline Architecture

Design a production RAG pipeline: ingestion, chunking, vector storage, hybrid retrieval, and cited answer generation across 10 architectural decisions.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt drives an AI assistant to produce a complete, opinionated RAG architecture — not a generic overview, but a system spec tailored to your actual use case, corpus size, and accuracy target. The ten-section structure mirrors what you would actually spec in a design doc: from raw document parsing through embedding model selection, vector store configuration, retrieval strategy, prompt design, and finally a working code skeleton. Nothing is skipped because every section feeds the next.

The reason it works is the combination of specificity and tradeoffs. By requiring justification for embedding model choice (cost vs quality), chunk strategy (semantic vs fixed vs recursive), and retrieval method (hybrid + MMR), the template forces the model to reason rather than list. The [accuracy_target] and [optimization_priority] variables are the levers — setting accuracy to 95%+ with latency priority produces a different architecture than 80% with cost priority, as it should.

The citation format requirement in section 6 and source attribution in section 7 are load-bearing — they prevent the response from quietly dropping provenance, which is the single biggest production failure mode in RAG systems.

When to use it

  • You are building an internal knowledge base assistant over engineering runbooks, Confluence pages, or Notion docs and need to decide between Pinecone, pgvector, and Qdrant before writing a line of code.
  • You are designing a legal or compliance Q&A system where hallucinated citations are a liability, and you need faithfulness guardrails baked into the prompt layer.
  • You are evaluating chunking strategies for a corpus of PDF technical manuals where tables and code blocks break naive fixed-size splitting.
  • You are scoping a customer support bot and need a realistic cost estimate before pitching it internally.
  • You are migrating an existing keyword-search system to hybrid search and need the re-ranking step specified correctly.

Example output

Chunking Strategy (for 50k engineering docs, mixed PDF + Markdown):
- Method: Recursive character splitting with semantic boundary detection
- Chunk size: 512 tokens, overlap: 64 tokens
- Rationale: Fixed-size at 256 tokens produced measurably lower recall on
  multi-paragraph answers in testing; semantic splitting added ~340ms/doc
  ingestion latency with only marginal recall gain — not worth it at this
  corpus size.

Embedding Model: text-embedding-3-small (OpenAI)
- Cost: ~$0.02 per 1M tokens vs $0.13 for text-embedding-3-large
- Quality delta on retrieval benchmarks: small vs large gap is real but
  typically under 5% on domain-specific corpora — start small and measure
  before paying 6x more.
- Recommendation: upgrade only if faithfulness drops below 0.85 in evaluation

Vector Store: pgvector on existing Postgres
- Index: HNSW (m=16, ef_construction=64)
- Metadata filters: doc_type, department, last_updated
- Rationale: eliminates a managed vector DB dependency at < 5M vectors

Pro tips

  • Set [accuracy_target] as a number, not a word. "High accuracy" generates vague architecture. "Faithfulness > 0.90 on RAGAS" forces the model to include an evaluation pipeline that actually measures it.
  • Be explicit about [doc_formats]. If your corpus has PDFs with scanned pages, name that — the ingestion section will include OCR routing, which is a real pipeline branch many architects skip until it breaks in production.
  • Use [optimization_priority] as a constraint, not a wish. "Minimize per-query cost under 50ms p95 latency" produces a concrete trade-off analysis. "Fast and cheap" produces nothing useful.
  • Pair with a separate evaluation prompt. The section 8 metrics spec is a starting point — run it again with a dedicated prompt asking for a RAGAS test harness in your language to get runnable evaluation code.
  • Re-run with a different [vector_db] after the first output. Getting the architecture for both pgvector and Qdrant takes two minutes and often reveals the managed DB is not justified at your corpus size — a decision worth making explicitly.

Frequently Asked Questions

Can I use this prompt if I have not chosen a vector database yet?
Yes — leave [vector_db] as 'undecided' or list two candidates (e.g. 'pgvector or Qdrant'). The model will compare them in section 4 based on your corpus size and query volume, which is actually more useful than a single-option spec.
Does this prompt generate runnable code or just architecture diagrams?
Section 10 explicitly asks for a working implementation in your [language]. Set that variable to Python, TypeScript, or PHP and you will get a functional core pipeline — document loading, embedding, upsert, and query — not pseudocode. The quality depends on how specific your other variables are.
How do I tune this for a use case that requires strict source attribution, like legal or medical?
Set [accuracy_target] to a high faithfulness number (e.g. 'faithfulness > 0.95, no unsourced claims') and name the citation format explicitly. The prompt already requires a citation format in section 6 — your accuracy target signals how aggressive the hallucination guardrails should be.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AI & Machine Learning Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support