Agent skill

Chunking Strategy Guide

by revfactory in revfactory/harness-100

Methodology for systematically designing document chunking strategies for RAG pipelines.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Chunking Strategy Guide

skills CLI
$ npx skills add revfactory/harness-100 --skill chunking-strategy-guide -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install revfactory/harness-100 chunking-strategy-guide --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/revfactory/harness-100.git skills-src && mkdir -p .claude/skills && cp -r skills-src/en/41-llm-app-builder/.claude/skills/chunking-strategy-guide .claude/skills/chunking-strategy-guide && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
chunking-strategy-guide
GitHub stars
1.3k
Token cost
~1.3k tokens
SKILL.md length
216 words
Files
1
Skills in repo
96
Repo updated
First seen
Licence
Apache-2.0

At a glance

Methodology for systematically designing document chunking strategies for RAG pipelines.

  • Chunking strategy
  • SKILL.md covers Target Agents, Chunking Strategy Comparison, Chunking Parameter Guide and Semantic Chunking Algorithm, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Document splitting

What it does

Chunking Strategy Guide is an agent skill from revfactory/harness-100. Methodology for systematically designing document chunking strategies for RAG pipelines. Use this skill for 'chunking strategy', 'document splitting', 'RAG chunking', 'embedding optimization', 'semantic chunking', 'text splitting', and other RAG data preprocessing tasks. Note: vector DB infrastructure construction and embedding model training are outside the scope of this skill.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Embeddings, Retrieval-augmented generation and Machine learning. The licence is Apache-2.0.

When your agent uses it

  • Chunking strategy
  • Document splitting
  • Embedding optimization
  • Semantic chunking

Example prompts

  • “chunking strategy”
  • “document splitting”
  • “RAG chunking”
  • “/chunking-strategy-guide”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 8e8d35c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Chunking Strategy Guide loads about 1.3k tokens when it runs. Until then it costs about 101 tokens; SKILL.md has 216 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~101
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from revfactory/harness-100 at commit 8e8d35c, republished under its Apache-2.0 licence (© revfactory). 216 words, ~1,268 tokens.

Download SKILL.mdSave it as .claude/skills/chunking-strategy-guide/SKILL.md (or your agent's skills folder).
name
chunking-strategy-guide
description
Methodology for systematically designing document chunking strategies for RAG pipelines. Use this skill for 'chunking strategy', 'document splitting', 'RAG chunking', 'embedding optimization', 'semantic chunking', 'text splitting', and other RAG data preprocessing tasks. Note: vector DB infrastructure construction and embedding model training are outside the scope of this skill.

Chunking Strategy Guide — RAG Document Chunking Strategy

A skill that enhances the data preprocessing capabilities of the rag-architect.

Target Agents

  • rag-architect — Effectively chunks documents to improve retrieval quality
  • eval-specialist — Evaluates the retrieval quality of chunking strategies

Chunking Strategy Comparison

StrategyPrincipleAdvantagesDisadvantagesBest For
Fixed-sizeCut at N-token intervalsSimple implementationSemantic breaksLogs, code
Sentence-basedSplit by sentencePreserves meaningUneven sizesNews, blogs
Paragraph-basedSplit at blank linesMaintains logical unitsParagraph size varianceDocuments, reports
SemanticBased on embedding similarityHighest qualitySlow, costlyComplex documents
RecursiveHierarchical separatorsBalancedComplex configurationGeneral-purpose
MarkdownBased on headingsPreserves structureMD-onlyTechnical docs

Chunking Parameter Guide

Optimal Chunk Sizes
| Document Type | Chunk Size | Overlap | Rationale |
|--------------|-----------|---------|-----------|
| FAQ | 100-200 tokens | 0 | Q&A pairs are short |
| Technical docs | 300-500 tokens | 50 | Code + explanation units |
| Legal documents | 500-800 tokens | 100 | Article units |
| Academic papers | 400-600 tokens | 80 | Paragraph units |
| Chat logs | 200-300 tokens | 30 | Conversation turn units |
| Fiction/essays | 300-500 tokens | 50 | Scene/paragraph units |
Overlap Ratio Formula
optimal_overlap = chunk_size * 0.1 to 0.2

Rules:
- Independent documents (FAQ): Overlap 0
- Sequential documents (manuals): 10-15%
- Dense documents (legal): 15-20%
- Maximum overlap: Never exceed 25% of chunk_size

Semantic Chunking Algorithm

python
def semantic_chunking(text, model, threshold=0.5):
    """
    1. Split into sentences
    2. Calculate cosine similarity of adjacent sentence embeddings
    3. Split at points where similarity falls below threshold
    4. Apply min/max chunk size constraints
    """
    sentences = split_sentences(text)
    embeddings = model.encode(sentences)

    breakpoints = []
    for i in range(len(embeddings) - 1):
        sim = cosine_similarity(embeddings[i], embeddings[i+1])
        if sim < threshold:
            breakpoints.append(i + 1)

    chunks = split_at(sentences, breakpoints)
    return enforce_size_limits(chunks, min=100, max=800)

Per-Document-Type Preprocessing Pipeline

PDF
PDF > Text extraction (pdfplumber/pymupdf)
> Remove headers/footers
> Remove page numbers
> Tables > Markdown conversion
> Images > alt text / OCR
> Metadata extraction (title, author, date)
> Chunking
HTML/Webpages
HTML > Body extraction (trafilatura/readability)
> Remove navigation/sidebar/ads
> Markdown conversion
> Preserve link text ([text](URL))
> Preserve tables
> Metadata extraction (title, description)
> Chunking
Code
Code > AST parsing
> Split by function/class
> Docstring + signature + body
> Add file path metadata
> Link related test code
> Chunking (function-level)

Metadata Enrichment Strategy

python
chunk_with_metadata = {
    "text": "Chunk text...",
    "metadata": {
        "source": "document.pdf",
        "page": 5,
        "section": "3.2 Architecture",
        "heading_hierarchy": ["3. Design", "3.2 Architecture"],
        "chunk_index": 12,
        "total_chunks": 45,
        "created_at": "2025-01-15",
        "document_type": "technical_spec",
        "language": "en"
    }
}

Chunking Quality Evaluation Metrics

MetricFormulaThreshold
Information completenessOriginal key info / total key info>= 95%
Semantic break rateMid-sentence cuts / total chunks<= 5%
Size uniformity1 - (std / mean)>= 0.7
Retrieval precisionRelevant chunks / returned chunks (top-5)>= 60%
Retrieval recallReturned relevant / total relevant (top-10)>= 80%

Embedding Model Selection Guide

ModelDimensionsMultilingualCostUse Case
text-embedding-3-small1536Good$0.02/1MGeneral-purpose, cost-efficient
text-embedding-3-large3072Good$0.13/1MHigh quality
multilingual-e5-large1024ExcellentFree (local)Multilingual specialization
bge-m31024ExcellentFree (local)Multilingual, long context
voyage-multilingual-21024Excellent$0.12/1MBest multilingual

© revfactory, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in en/41-llm-app-builder/.claude/skills/chunking-strategy-guide of revfactory/harness-100.

Open the folder on GitHubat commit 8e8d35c

Compare with similar skills

Chunking Strategy Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Chunking Strategy Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Chunking Strategy Guide this skillrevfactory/harness-1001.3k—~1.3kAutomated safety check: PassApache-2.0
Discover MLrand/cc-polymath1811 repos~574Automated safety check: PassMIT
Chroma Vector DatabaseOrchestra-Research/AI-Research-SKILLs13k8 repos~2.3kAutomated safety check: PassMIT
Ms Agent Framework RAGshuyu-labs/WebCode278—~1.1kAutomated safety check: PassCustom licence
Pgvector Semantic Searchtimescale/pg-aiguide1.9k1 repos~3.8kAutomated safety check: PassApache-2.0
Evaluate RAGai-evals-course/evals-skills1.5k—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Discover ML

    rand/cc-polymath

    Automatically discover machine learning and AI skills when working with machine learning, PyTorch, training, inference, RAG, embeddings, fine-tuning, LLM, DSPy, HuggingFace, or diffusion models.

    181 GitHub starsUsed in 1 repo~574 tokens
    AI & LLM EngineeringAuto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 8 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Ms Agent Framework RAG

    shuyu-labs/WebCode

    Comprehensive guide for building Agentic RAG systems using Microsoft Agent Framework in C.

    278 GitHub stars~1.1k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Pgvector Semantic Search

    timescale/pg-aiguide

    A skill your agent uses for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search.

    1.9k GitHub starsUsed in 1 repo~3.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Evaluate RAG

    ai-evals-course/evals-skills

    Guides evaluation of a RAG system by diagnosing failures in traces, building a retrieval test set and scoring retrieval and generation separately.

    1.5k GitHub stars~1.9k tokensUpdated 14 days ago
    AI & LLM EngineeringAuto-check passed
  • RAG Architect

    Jeffallan/claude-skills

    Designs retrieval-augmented generation systems: document chunking, embeddings, vector store setup, hybrid search, reranking and retrieval evaluation, with checks at each step.

    12k GitHub starsUsed in 1 repo~2k tokens
    AI & LLM EngineeringAuto-check passed

More from revfactory/harness-100

All 96 skills in this repo
  • Anti Bot Analyzer

    revfactory/harness-100

    A skill for analyzing website anti-bot defense mechanisms and developing legitimate evasion strategies.

    1.3k GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • API Error Design Patterns

    revfactory/harness-100

    Reference for designing how an API reports failures: structured error codes, response shapes, client-friendly messages, an error catalog and retry or fallback advice.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed
  • API Security Checklist

    revfactory/harness-100

    Walks a backend-dev agent through OWASP API Top 10 checks, authentication and authorization patterns, and defense code during API design.

    1.3k GitHub stars~1.7k tokensUpdated 6 mo ago
    Auto-check passed
  • Arg Parser Generator

    revfactory/harness-100

    Methodology for systematically designing and generating CLI tool argument parser structures.

    1.3k GitHub stars~1.2k tokensUpdated 6 mo ago
    Auto-check passed
  • Audience Segmentation

    revfactory/harness-100

    Audience segmentation skill used by the analyst and curator agents.

    1.3k GitHub stars~1.3k tokensUpdated 6 mo ago
    Auto-check passed
  • Audio Storytelling

    revfactory/harness-100

    Audio storytelling skill used by the podcast scriptwriter and show note editor.

    1.3k GitHub stars~1.6k tokensUpdated 6 mo ago
    Auto-check passed

Questions about Chunking Strategy Guide

What does Chunking Strategy Guide do?

Methodology for systematically designing document chunking strategies for RAG pipelines. Chunking Strategy Guide is an agent skill from revfactory/harness-100. Methodology for systematically designing document chunking strategies for RAG pipelines.

When should I use Chunking Strategy Guide?

Chunking Strategy Guide fits situations like: chunking strategy; document splitting; embedding optimization; semantic chunking.

How do I install Chunking Strategy Guide in Claude Code?

Run `npx skills add revfactory/harness-100 --skill chunking-strategy-guide -a claude-code`. Or copy the skill folder (en/41-llm-app-builder/.claude/skills/chunking-strategy-guide in revfactory/harness-100) into .claude/skills/chunking-strategy-guide in your project. Claude Code loads it when a task matches its description.

How do I install Chunking Strategy Guide in Codex?

Run `npx skills add revfactory/harness-100 --skill chunking-strategy-guide -a codex`. Or copy the skill folder (en/41-llm-app-builder/.claude/skills/chunking-strategy-guide in revfactory/harness-100) into .agents/skills/chunking-strategy-guide in your project. Codex loads it when a task matches its description.

Can I use Chunking Strategy Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add revfactory/harness-100 --skill chunking-strategy-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/chunking-strategy-guide, .gemini/skills/chunking-strategy-guide, .github/skills/chunking-strategy-guide and .opencode/skills/chunking-strategy-guide in your project.

What does Chunking Strategy Guide need to run?

SKILL.md names no scripts, command-line tools or credentials: Chunking Strategy Guide is instructions for the agent only. Our summary lists: Python 3.

Does Chunking Strategy Guide access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Chunking Strategy Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Chunking Strategy Guide use?

Chunking Strategy Guide is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Chunking Strategy Guide use?

About 1.3k tokens (SKILL.md is roughly 5.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Chunking Strategy Guide?

Skills that share tags, products or a category with Chunking Strategy Guide: Discover ML (rand/cc-polymath, 181 stars), Chroma Vector Database (Orchestra-Research/AI-Research-SKILLs, 13k stars), Ms Agent Framework RAG (shuyu-labs/WebCode, 278 stars) and Pgvector Semantic Search (timescale/pg-aiguide, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Chunking Strategy Guide?

revfactory (a GitHub user) maintains it in revfactory/harness-100, which has 1,293 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on March 22, 2026.

Source: revfactory/harness-100 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.