/vibe:chunk-strategy-expertfrom vibe
Deep dive into chunking strategies for RAG pipelines: fixed, recursive, semantic, proposition-based, and document-aware splitting. Covers LangChain and LlamaIndex splitters.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in chunking — the most underrated, highest-leverage decision in any RAG pipeline. Bad chunking flattens your corpus into noise that no embedder, reranker, or LLM can recover. Good chunking gives every downstream component clean, self-contained units to work with.
Greg Kamradt's "5 Levels of Text Splitting" framing (now adopted across LangChain / Chroma / industry):
| Level | Strategy | Cost | Quality on prose |
|---|---|---|---|
| 1 | Fixed character / token | Free | Poor — splits mid-word, mid-sentence |
| 2 | Recursive (separator-aware) | Free | Decent — respects paragraphs/sentences |
| 3 | Document-specific (Markdown, HTML, code) | Free | Good — uses native structure |
| 4 | Semantic (embedding-similarity-based) | LLM/embed cost | Good — splits on topic shifts |
| 5 | Agentic / proposition-based | LLM cost | Best — extracts standalone facts |
def fixed(text, size=500, overlap=50):
return [text[i:i+size] for i in range(0, len(text), size-overlap)]
Only acceptable for: token-counted budgets where structure doesn't exist (raw logs without timestamps, base64).
from langchain_text_splitters import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=800,
chunk_overlap=120,
separators=["\n\n", "\n", ". ", " ", ""], # try in order
length_function=len, # or tiktoken-based
)
chunks = splitter.split_text(text)
Tries the strongest boundary first; falls back recursively. Strong default for arbitrary text.
from langchain_text_splitters import MarkdownHeaderTextSplitter
md = MarkdownHeaderTextSplitter(headers_to_split_on=[("#", "h1"), ("##", "h2"), ("###", "h3")])
sections = md.split_text(markdown_text)
# Then optionally recursive-split each section if too long
Each chunk inherits header metadata — perfect for filtered retrieval ("only ## Pricing sections").
from langchain_text_splitters import RecursiveCharacterTextSplitter, Language
py_splitter = RecursiveCharacterTextSplitter.from_language(
language=Language.PYTHON, chunk_size=1500, chunk_overlap=100
)
Uses language-specific separators (class/def boundaries for Python, top-level fns for JS, etc.). Use AST-based splitters (tree-sitter, ast-grep) for higher fidelity.
from langchain_text_splitters import HTMLHeaderTextSplitter
html_splitter = HTMLHeaderTextSplitter(headers_to_split_on=[("h1", "h1"), ("h2", "h2")])
For scraped pages — keeps article structure, drops chrome.
Embed each sentence; split where adjacent-sentence cosine drops below a threshold (a "topic shift"):
from langchain_experimental.text_splitter import SemanticChunker
from langchain_openai import OpenAIEmbeddings
splitter = SemanticChunker(
OpenAIEmbeddings(model="text-embedding-3-small"),
breakpoint_threshold_type="percentile", # or "standard_deviation", "interquartile"
breakpoint_threshold_amount=95, # split where drop is in top 5%
)
chunks = splitter.create_documents([text])
Pros: respects topic boundaries. Cons: per-sentence embedding cost; slower; sometimes over-splits short docs.
Use an LLM to extract standalone propositions from text — atomic statements that don't depend on context. Then index propositions as the unit. Dense X retrieval (chen et al.) reports +15-30% Recall@5 on multi-hop QA over passage retrieval.
PROP_PROMPT = """Decompose the passage into a list of standalone propositions, each
containing a single fact and being interpretable without context.
Passage: {p}
Output a JSON list of strings."""
import json
def propositions(text, llm):
return json.loads(llm.invoke(PROP_PROMPT.format(p=text)))
# Index propositions; on retrieval, often map back to source passage for generation context.
LangChain has a propositional-retrieval template implementing this end-to-end.
Stream text past an LLM that says "start new chunk here / continue current". Highest quality, highest cost. Useful for legal/medical docs where boundaries matter and budget allows.
| Corpus type | Pick |
|---|---|
| Markdown docs / wikis | MarkdownHeaderTextSplitter + recursive |
| Code | Language-aware / AST |
| Scraped HTML | HTML splitter (drop chrome first with Trafilatura/Readability) |
| Long PDFs | Page+section splitter, then recursive; or skip OCR and use ColPali (see multimodal-rag mode) |
| Mixed prose | RecursiveCharacterTextSplitter (default 500-1000 tokens, 10-20% overlap) |
| Legal / medical | Proposition-based or agentic |
| Conversational transcripts | Speaker-turn splitter, keep speaker as metadata |
| Tabular data | Don't chunk — render rows or use Text-to-SQL (see structured-rag mode) |
Pick the simplest strategy that hits your eval target, then incrementally upgrade:
Don't optimize chunking in isolation — measure end-to-end RAG metrics (faithfulness, answer correctness), not just retrieval.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job