agentleFS
Goodnight77Goodnight77/rag-skills/skills/chunking/SKILL.md

chunking

Skill8 starsChanged 7 months agoMITView on GitHub

Route RAG chunking decisions across semantic, hierarchical, sliding-window, contextual-header, and framework-selection strategies.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this parent skill when the main RAG problem is how to split source material into retrievable units.

    line 16
  2. Distinctive:

    Overlap: Add controlled neighboring context across chunk boundaries.

    line 24
  3. Distinctive:

    Use semantic chunking for prose, hierarchical chunking for structured documents, and code-specific guidance for APIs or source repositories.

    line 30
  4. Distinctive:

    Use sliding windows when answers cross boundaries, contextual headers when chunks lack source context, and semantic chunking when fixed …

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Chunking

Overview

Use this parent skill when the main RAG problem is how to split source material into retrievable units. Route to the child skill that best matches the document shape, retrieval failure, and production constraints.

Problem Statement

Poor chunking causes retrieval misses, fragmented answers, duplicated context, and weak citations. RAG systems need chunking strategies that preserve meaning while staying efficient for indexing and retrieval.

Key Concepts

  • Semantic boundaries: Split where ideas naturally change.
  • Hierarchy: Preserve document, section, and subsection relationships.
  • Overlap: Add controlled neighboring context across chunk boundaries.
  • Context headers: Attach inherited titles and metadata to chunks.

Implementation Guide

Step 1: Identify the Corpus Shape

Use semantic chunking for prose, hierarchical chunking for structured documents, and code-specific guidance for APIs or source repositories.

Step 2: Match the Retrieval Failure

Use sliding windows when answers cross boundaries, contextual headers when chunks lack source context, and semantic chunking when fixed windows split ideas.

Step 3: Validate Chunk Quality

Measure retrieval recall, answer groundedness, duplicate context rate, and citation usefulness before changing embeddings or vector databases.

When to Use This Skill

  • Choosing a chunking strategy for a new RAG pipeline
  • Debugging poor recall caused by fragmented source content
  • Improving citations and source traceability

When NOT to Use This Skill

  • The bottleneck is ranking after retrieval
  • The issue is vector database operations or deployment
  • Source documents are already chunked and validated

Related Skills

  • Semantic Chunking
  • Hierarchical Chunking
  • Sliding Window Chunking
  • Contextual Chunk Headers
  • Choosing a Chunking Framework

Metrics & Success Criteria

  • Higher recall on chunk-boundary questions
  • Lower duplicate or irrelevant context in prompts
  • Better source citations and more coherent retrieved passages

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.