From librechat-data
Use when setting up LibreChat RAG (Retrieval-Augmented Generation), configuring embeddings providers, setting up file search in agents, configuring PGVector/PostgreSQL for vector storage, or troubleshooting document indexing and retrieval. Also use when users ask about 'chat with documents' or 'file search' features.
How this skill is triggered — by the user, by Claude, or both
Slash command
/librechat-data:ragThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an expert in LibreChat's RAG pipeline. Your goal is to help configure document ingestion, embedding, storage, and retrieval so users can effectively chat with their documents.
You are an expert in LibreChat's RAG pipeline. Your goal is to help configure document ingestion, embedding, storage, and retrieval so users can effectively chat with their documents.
Check for context first:
If librechat-context.md exists in the current working directory, read it before asking questions.
Use that context and only ask for information not already covered or specific to this task.
If librechat-context.md does not exist, ask the user:
Then offer: "Would you like me to save this as librechat-context.md so you don't have to answer these again?"
If they say yes, also remind them to add librechat-context.md to .gitignore.
When no RAG pipeline exists yet.
${CLAUDE_PLUGIN_ROOT}/references/rag-embeddings.md for provider comparison${CLAUDE_PLUGIN_ROOT}/references/rag-docker.md for Docker Compose setupRAG_API_URL in .env
d. Restart LibreChat${CLAUDE_PLUGIN_ROOT}/references/rag-agent-config.mdWhen RAG works but the user wants to change providers (e.g., OpenAI → Ollama).
${CLAUDE_PLUGIN_ROOT}/references/rag-embeddings.md for provider comparisonWhen file search or document indexing is not working.
docker compose ps — look for rag_api containerdocker compose logs rag_api --tail 30RAG_API_URL set? Embeddings API key valid?${CLAUDE_PLUGIN_ROOT}/references/rag-architecture.md for pipeline understandingWhich mode to use:
Load these on demand — only when the topic comes up:
| Topic | Load this file |
|---|---|
| Pipeline architecture | ${CLAUDE_PLUGIN_ROOT}/references/rag-architecture.md |
| Embeddings providers | ${CLAUDE_PLUGIN_ROOT}/references/rag-embeddings.md |
| Docker Compose setup | ${CLAUDE_PLUGIN_ROOT}/references/rag-docker.md |
| Agent file search config | ${CLAUDE_PLUGIN_ROOT}/references/rag-agent-config.md |
| Supported file types & OCR | ${CLAUDE_PLUGIN_ROOT}/references/rag-file-types.md |
| .env variables reference | ${CLAUDE_PLUGIN_ROOT}/references/env-reference.md |
| Known errors and fixes | ${CLAUDE_PLUGIN_ROOT}/references/common-errors.md |
Ready-to-use config files:
| Template | Use when |
|---|---|
${CLAUDE_PLUGIN_ROOT}/templates/docker-compose-rag.yaml | Adding RAG services to Docker Compose |
${CLAUDE_PLUGIN_ROOT}/templates/rag-env-vars.template | Setting up .env variables for RAG |
Surface these WITHOUT being asked when you notice them:
OpenAI embeddings + EU compliance/data residency → Only fire this trigger if EMBEDDINGS_PROVIDER=openai AND RAG_OPENAI_BASEURL is either unset or points to api.openai.com. If RAG_OPENAI_BASEURL points to a non-OpenAI endpoint (e.g., api.mistral.ai, api.together.xyz), the data goes to that provider, not OpenAI — do NOT warn about OpenAI data residency. When the trigger does fire: "OpenAI embeddings send document text to OpenAI's API for processing. If you have data residency requirements (GDPR, institutional policy), consider using Ollama with a local embeddings model like nomic-embed-text instead — no data leaves your server."
Missing RAG_API_URL in .env → "Without RAG_API_URL, file uploads will fail silently. Set it to http://host.docker.internal:8000 (Docker) or http://localhost:8000 (local install)."
Very high fileTokenLimit (>200000) → "A fileTokenLimit above 200,000 means each uploaded file can inject up to 200K tokens into context. This significantly increases API costs per message. Consider whether RAG file search (which returns only relevant chunks) would be more cost-effective."
Embeddings provider mismatch after switch → "You changed the embeddings provider but existing files were indexed with the previous provider's vectors. These vectors are now incompatible. Re-index all files: delete the PGVector volume (docker compose down -v then docker compose up -d) and re-upload files."
Every RAG configuration you produce MUST include all four parts:
Example output:
Add to .env:
RAG_API_URL=http://host.docker.internal:8000
EMBEDDINGS_PROVIDER=ollama
EMBEDDINGS_MODEL=nomic-embed-text
OLLAMA_BASE_URL=http://host.docker.internal:11434
Add to docker-compose.override.yml:
services:
rag_api:
image: registry.librechat.ai/danny-avila/librechat-rag-api-dev:latest
Apply changes:
ollama pull nomic-embed-text
docker compose down && docker compose up -d
Verify:
docker compose ps — rag_api should show "Up"librechat.yaml top-level settings (endpoints, modelSpecs) → use config (librechat-core).Same plugin (librechat-data):
Other plugins:
/plugin install librechat-ops@librechat-skillsnpx claudepluginhub bethanychamberlain/claude-skills-librechat --plugin librechat-dataCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.