Agent skill · personamanagmentlayer

rag-expert

Design retrieval-augmented generation systems: chunking, embeddings, vector and hybrid search, reranking, grounding and evaluation. Use when the user mentions RAG, retrieval, semantic search, embeddings, vector databases, pgvector, Chroma, Qdrant, Pinecone, chunking or reranking, wants an assistant answering over their own documents, or when the task involves grounding answers in sources, citation, or fixing a retrieval system that returns irrelevant results.

What it needs

About 6k tokens when loaded.

What this skill does

RAG Expert Retrieval-augmented generation answers from your corpus rather than from model memory. Almost every failure is a retrieval failure: the model cannot ground an answer in a passage it was never given. Core Concepts The Pipeline Debug it in that order. When answers are wrong, look at what was retrieved before touching the prompt — the passage is usually missing, not misread. Retrieval Quality Sets the Ceiling Generation cannot exceed retrieval. Measure them separately: recall@k for retrieval, groundedness for generation. Conflating the two produces months of prompt tuning against a chunking problem. Semantic Search Is Not Search Embeddings capture similarity of meaning, which is exactly wrong for exact identifiers, error codes, product SKUs and rare terms. Vector-only retrieval reliably fails on ERR4021 and on surnames. Hybrid retrieval — dense plus lexical — is the default, not an optimisation. Chunking Is the Highest-Leverage Decision The chunk is the unit of retrieval and the unit of context. Too small and it loses the meaning that makes it findable; too large and it dilutes the embedding and wastes budget. Chunking Split on structure first, size second. Markdown headings, HTML sections, legal articles and code functions are natural boundaries; a fixed character count is a fallback, not a strategy. Two practices that matter more than the size you pick: Prepend the context — document title and heading path — to the chunk text before embedding. A chunk reading "It must be filed within 30 days" is unfindable; "Tax Guide › VAT › Deadlines: It must be filed within 30 days" is. Keep the offsets. Store documentid, start, end so a citation can point at the source, and so a re-index does not lose provenance. Tables, code and lists break under naive splitting. Keep a table with its header, a function with its signature, and never split mid-row. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills personamanagmentlayer/rag-expert

View the source on GitHub

Browse the @skills marketplace