agentleFS
patonkikhpatonkikh/APES/skills/rag/chunking-strategy-advisor/skill.md

chunking-strategy-advisor

Skill3 starsChanged 4 months agoMITView on GitHub

Recommend document chunking strategy: chunk size, overlap, boundaries, and metadata preservation for optimal retrieval quality. Use when working on RAG pipelines, chunking, embeddings, retrieval, or hybrid search.

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:

    Input: Document types, sample content (optional), query patterns, RAG architecture

    line 16
  2. Distinctive:

    Do not split mid-sentence

    line 53
  3. Distinctive:

    Start 256–512 tokens for prose.

    line 104
  4. Distinctive:

    Use header-aware splitting for documentation.

    line 106

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 Strategy Advisor

Purpose

Recommend document chunking strategy: chunk size, overlap, boundaries, and metadata preservation for optimal retrieval quality.

Input: Document types, sample content (optional), query patterns, RAG architecture
Output: Chunking specification with parameters, boundary rules, and eval recommendations Examples: See examples.md for worked input/output.


Workflow

Step 1: Analyze document characteristics

Doc typeStructureAvg lengthUpdate frequency

Types: prose, technical docs, code, tables, FAQs, legal, chat logs.

Step 2: Select chunking method

MethodBest for
Fixed-sizeUniform prose
SemanticVariable structure, paragraphs
RecursiveHierarchical docs (headers)
Document-specificCode (functions), tables (rows)
AgenticComplex mixed content

Step 3: Define parameters

ParameterValueRationale
Chunk size (tokens)
Overlap (tokens)
Min chunk size
Max chunk size

Step 4: Define boundary rules

  • Respect section headers / code blocks / table rows
  • Do not split mid-sentence
  • Preserve metadata: source, page, section title

Step 5: Recommend eval approach

  • Sample 20 chunks for manual review
  • Retrieval recall@k on golden queries
  • A/B chunk sizes if uncertain

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
Mixed document typesUse per-type chunking strategies
Code documentsChunk by function/class, not token count
TablesChunk by row groups or whole table with summary
Very short docs (< chunk size)Keep whole document as one chunk
No sample contentUse conservative defaults; mark for eval tuning

Validation

  • Document types analyzed
  • Chunking method selected per type with rationale
  • Size and overlap parameters specified
  • Boundary rules documented
  • Metadata preservation defined
  • Eval approach recommended
  • Parameters tied to embedding model context if known

Anti-patterns

  • One size fits all — same chunk size for code and prose.
  • Zero overlap — losing context at boundaries.
  • Mid-sentence splits — hurting semantic coherence.
  • No metadata — chunks without source attribution.
  • Tiny chunks — fragments without context.

Best Practices

  • Start 256–512 tokens for prose; tune with eval.
  • 10–20% overlap for continuity.
  • Use header-aware splitting for documentation.
  • Store parent document ID and section path in metadata.
  • Re-chunk when switching embedding models.

Output Structure

# Chunking Strategy: [Corpus Name]

## Document Analysis
| Type | Count | Method |
|------|-------|--------|

## Parameters
| Parameter | Value | Rationale |
|-----------|-------|-----------|

## Boundary Rules
1. [Rule]

## Metadata Schema
| Field | Source |
|-------|--------|

## Eval Plan
[Approach]

## Tuning Notes
[When to revisit]

Next Skills

OutcomeRecommended Skill
Select embeddingsrag/embedding-strategy-advisor
Optimize retrievalrag/retriever-optimizer
RAG architecturerag/rag-architecture-designer
Hybrid searchrag/hybrid-search-advisor

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.