chunking-strategies

Define chunking strategies for RAG document processing by document type.

14|1|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/jpoutrin/product-forge --skill chunking-strategies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: chunking-strategies
Source: https://github.com/jpoutrin/product-forge/tree/main/plugins/rag-cag/skills/chunking-strategies
Command: npx skills add https://github.com/jpoutrin/product-forge --skill chunking-strategies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Effectively splitting large documents into optimal chunks is crucial for the performance and relevance of Retrieval-Augmented Generation (RAG) systems. Suboptimal chunking can lead to poor retrieval quality and irrelevant LLM responses. This Skill provides various chunking strategies.

Core Features & Use Cases

  • Chunking Methods: Implementations for Fixed-Size Chunking (with overlap), Semantic Chunking (by paragraphs), and Recursive Chunking (hierarchical splitting).
  • Chunking by Document Type: Recommendations for optimal chunking strategies and sizes based on document types like technical docs, legal documents, code, and conversations.
  • Chunk Enrichment: Patterns for adding metadata, LLM-generated summaries, keywords, and parent IDs to chunks for improved retrieval.
  • Best Practices: Guidelines for adding overlap, preserving semantic boundaries, including metadata, and testing retrieval quality.
  • Use Case: Deciding the best chunking strategy for a new document type in your RAG pipeline, implementing a recursive chunking function for long technical manuals, or enriching chunks with LLM-generated summaries for better context.

Quick Start

Use the chunking-strategies skill to generate a Python function for fixed-size document chunking with a specified overlap.

Frequently Asked Questions about chunking-strategies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split documents into chunks for RAG systems?

Document chunking divides large texts into optimal-sized pieces for retrieval-augmented generation. Chunk size, overlap, and method (fixed-size, semantic, or recursive) depend on document type and retrieval requirements to preserve semantic boundaries and improve LLM response quality.

What's the best chunking strategy for technical documentation?

Technical documentation benefits from recursive chunking that respects code blocks and section hierarchies. This approach maintains semantic boundaries, enables hierarchical reconstruction, and improves retrieval precision for structured content.

How do I add metadata and summaries to document chunks?

Chunk enrichment involves adding metadata fields, LLM-generated summaries, keywords, and parent IDs to each chunk. This context improves retrieval quality and helps the LLM understand relationships between chunks and their source documents.

Does fixed-size chunking work for legal documents?

Fixed-size chunking with overlap can work for legal documents, but semantic or recursive methods better preserve legal language boundaries and clause structures. Document-type-specific strategies yield higher retrieval quality than uniform approaches.

Can I use different chunk sizes for different document types?

Yes. Chunking strategies vary by document type—code and technical docs use recursive methods with smaller chunks, conversations use semantic boundaries by turn, and legal documents require larger overlaps. Tailor size and method to content structure and retrieval patterns.

How do I test if my chunking strategy improves retrieval quality?

Evaluate chunking by measuring retrieval precision and relevance of LLM responses against your document corpus. Adjust chunk size, overlap, and method based on retrieval performance; best practices include semantic boundary preservation and metadata inclusion.