RAG System Prompt Pattern

prompt_eng · Claude · pro

Write the system prompt for a retrieval augmented generation bot over [CORPUS TYPE — docs, tickets, contracts]. Chunk shape at runtime: CHUNK TEXT , top K = [K] User question shape: [FREE TEXT / STRUCTURED] Freshness policy: [WHAT TO DO WITH STALE DOCS] The prompt must enforce: 1. Answer ONLY from blocks — no world knowledge fallback unless explicitly allowed 2. Every claim carries a citation like [doc id] inline 3. When retrieval is thin or contradictory, say so and quote what's missing 4. Refuse politely if the question is out of corpus (give a 1 line reason) 5. Output format: answer, citations[], confidence (low/med/high), unanswerable reason if applicable Include one few shot showing a correct "I don't know from these docs" answer. That failure mode is the whole point.

#rag #grounding #citations