{"name":"build-rag-search-over-docs","description":"Builds retrieval-augmented generation (RAG) so an AI answers from your documents - split docs into chunks, embed them into a vector store, retrieve the best matches, and answer with citations or say it does not know. Use when the user wants a chatbot that knows their docs, AI search over a knowledge base, or answers grounded in their content.","category":"backend","tags":["rag","chatbot","docs","llm"],"models":["any"],"proven":false,"passing_families":0,"model_testing":"Not yet model-tested; testing Jan 2027","url":"https://theskillvault.ai/skills/build-rag-search-over-docs","api_url":"https://theskillvault.ai/api/skills/build-rag-search-over-docs","raw_url":"https://theskillvault.ai/api/skills/build-rag-search-over-docs/raw","body":"# Build RAG search over your docs\n\nRAG means: find the most relevant passages first, then ask the model to answer only from them. It cuts made-up answers and lets you cite sources.\n\n## When to use\n- You want a help bot that answers from your docs, policies or notes.\n- Plain chat answers are wrong because the model never saw your content.\n- You need answers with links back to the source page.\n\n## When not to use\n- You only need a general chatbot. Use build-ai-chatbot-api-route.\n\n## Steps\n1. Collect the source docs and keep a URL or file path for each.\n2. Split them into chunks of about 300-800 words with a small overlap, keeping headings with each chunk.\n3. Create embeddings for every chunk with one embedding model, and store them with the text and source in a vector store (pgvector, a hosted vector database, or a local index).\n4. At question time, embed the question and fetch the top 5-10 chunks. Add keyword search too if exact names or codes matter.\n5. Optionally rerank the results and keep the best 3-5.\n6. Send the model the question plus those chunks, with the prompt below.\n7. Return the answer with its sources listed.\n8. Build a small test set of 20 real questions with known answers and check it after every change.\n9. Re-embed changed docs when content updates.\n\n```text\nAnswer the question using only the sources below. Cite sources as [1], [2].\nIf the sources do not contain the answer, say \"I don't know based on these docs.\"\nSources:\n{{numbered chunks with titles}}\nQuestion: {{question}}\n```\n\n## Gotchas\n- Do not index private or sensitive documents into a bot that the public can query.\n- Keep API keys for the model and the vector store on the server, never in browser code.\n- Chunks that are too small lose context; too large and retrieval gets vague. Test both.\n- Changing the embedding model means re-embedding everything.\n\n## Portability\nWorks with any model provider and vector store. If you use LangChain or LlamaIndex, they wrap these same steps; a plain Postgres table with pgvector is an equivalent option for small projects.\n\n## Example prompt\n\"Build a help chatbot that answers from the Markdown files in /docs, cites the page it used, and says when it does not know.\"\n\n## Done when\n- Answers cite the chunks they used.\n- Off-topic questions get \"I don't know\" rather than a guess.\n- A saved test set of real questions passes at an agreed rate.\n\n---\nAdapted from \"rag-implementation\" in wshobson/agents (MIT, Copyright (c) 2024 Seth Hobson). See LICENSE.txt.","files":["LICENSE.txt"],"license":"MIT","license_name":"MIT License","license_url":"https://opensource.org/license/mit","attribution":"Based on work by Seth Hobson (wshobson/agents, rag-implementation) (Copyright (c) 2024 Seth Hobson, MIT License), https://github.com/wshobson/agents/tree/7e2fb559cf4b824b27f1fec49fe88f7511066d26/plugins/llm-application-dev/skills/rag-implementation; adapted by TheSkillVault, https://theskillvault.ai","install":{"claude_code":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/raw' -o ~/'.claude/skills/build-rag-search-over-docs/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/files/LICENSE.txt' -o ~/'.claude/skills/build-rag-search-over-docs/LICENSE.txt'","cursor":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/raw' -o '.cursor/skills/build-rag-search-over-docs/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/files/LICENSE.txt' -o '.cursor/skills/build-rag-search-over-docs/LICENSE.txt'","agents":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/raw' -o '.agents/skills/build-rag-search-over-docs/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-rag-search-over-docs/files/LICENSE.txt' -o '.agents/skills/build-rag-search-over-docs/LICENSE.txt'","mcp_url":"https://theskillvault.ai/mcp","cursor_mcp_deeplink":"cursor://anysphere.cursor-deeplink/mcp/install?name=theskillvault&config=eyJ1cmwiOiJodHRwczovL3RoZXNraWxsdmF1bHQuYWkvbWNwIn0%3D","mcp_config":{"mcpServers":{"theskillvault":{"url":"https://theskillvault.ai/mcp"}}}},"bundles":[],"tested_on":[{"family":"chatgpt","name":"ChatGPT","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"claude","name":"Claude","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"gemini","name":"Gemini","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"grok","name":"Grok","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"llama","name":"Llama","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"deepseek","name":"DeepSeek","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"mistral","name":"Mistral","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"qwen","name":"Qwen","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"kimi","name":"Kimi K","outcome":null,"date":null,"source":null,"counts":false,"stale":false}],"proven_rule":{"threshold":5,"window_days":365,"computed_at":"2026-11-02T03:20:33.817Z"}}