RAG Chunking Strategy Advisor — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited RAG Chunking Strategy Advisor (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill analyzes your document types, content structure, and retrieval goals to recommend the right chunking strategy for your RAG pipeline. Poor chunking is the #1 cause of RAG failures — chunks too large lose precision, chunks too small lose context. This skill picks the right strategy and explains exactly how to implement it.
Copy this file to .agents/skills/rag-chunking-advisor/SKILL.md in your project root.
Then ask:
Provide:
Paste the instructions below along with your document type and retrieval use case.
When asked to advise on RAG chunking, follow these steps:
Ask or infer:
| Document Type | Recommended Strategy | Chunk Size |
|---|---|---|
| Prose (articles, books) | Sentence-window or recursive character | 512–1024 tokens |
| Structured docs (markdown, HTML) | Header-based (split on H2/H3) | Full section |
| PDFs with mixed content | Semantic chunking + page boundary | 512 tokens |
| Source code | Function/class boundary splitting | Full function |
| Tables / spreadsheets | Row-level or table-level | 1 row or full table |
| Emails / short messages | Document-level (no chunking) | Full doc |
| Legal / contracts | Clause-level splitting | 256–512 tokens |
Strategies explained:
chunk_size=512, overlap=50.\n\n, then \n, then ., then . Preserves paragraph structure. Best default for general text.Every chunk must carry metadata for filtering and re-ranking:
{
"chunk_id": "doc_001_chunk_004",
"source": "contracts/nda-2024.pdf",
"page": 3,
"section": "Confidentiality Obligations",
"doc_type": "legal",
"created_at": "2024-11-01"
}Always store: source, page_or_line, section_heading (if available), doc_type.
For long structured documents, use a two-level hierarchy:
Retrieve by child similarity, return parent for context. This avoids the precision vs. context tradeoff.
# LlamaIndex example
from llama_index.node_parser import HierarchicalNodeParser
parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])Before deploying, run this checklist:
Input:
"Use the RAG Chunking Advisor. I'm building a support chatbot. Documents are markdown product docs, 5–30 pages each, with H2 and H3 headers. Users ask specific how-to questions."
Output:
Recommended strategy: Header-based chunking
>
Split on H2 headers as primary boundaries, H3 as secondary. Each chunk = one section, with its full heading path prepended (Product > Installation > macOS Setup).>
Config: ``python from langchain.text_splitter import MarkdownHeaderTextSplitter splitter = MarkdownHeaderTextSplitter( headers_to_split_on=[("##", "section"), ("###", "subsection")] ) ``>
Add metadata: {"source": filename, "section": heading_path, "doc_type": "product_docs"}>
If sections exceed 800 tokens, apply a secondary recursive split with chunk_size=600, overlap=60.>
Validate: run your top 20 support questions against the index and confirm the relevant section appears in top-3.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.