indexion-segment — Claude Code skill: chunk text for RAG
Splits documents into contextual chunks for RAG and embedding pipelines. Useful when you want topic boundaries instead of a fixed character count.
npx skills add trkbt10/indexion-skills --skill indexion-segment -a claude-codeWhat indexion-segment does
The skill drives the indexion segment command: it takes an input file, cuts it into segments and writes them to an output directory. Three strategies are available — window with sliding-window divergence detection, tfidf for topic shifts, and punctuation for sentence boundaries. The default is window with adaptive thresholding.
Chunk sizes are set explicitly through --min-size, --max-size and --target-size. A hybrid mode (--hybrid) blends NCD and TF-IDF, weighted by --ncd-weight and --tfidf-weight. That is a reasonable starting point for mixed-content documents, though the weights need tuning against your own corpus.
The command takes an input file and an output folder, and --prefix controls the output file names. If segments come out too large or too choppy, adjust --threshold and --target-size.
What it helps with
- chunk a long document for embeddings
- split text on topic changes rather than character count
- prepare a corpus for similarity search
- extract meaningful sections from mixed-content documents
- enforce a fixed chunk size in a pipeline
Example prompts for the agent
- Split document.txt into segments in the output/ folder
- Segment this text with the tfidf strategy, target size 800
- Run hybrid mode with NCD weight 0.6 on this file
How to install indexion-segment
1Skills CLI (Vercel)
npx skills add trkbt10/indexion-skills --skill indexion-segment -a claude-code2Manually: put the files in place
~/.claude/skills/indexion-segment/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/indexion-segment/
1Skills CLI (Vercel)
npx skills add trkbt10/indexion-skills --skill indexion-segment -a codex2Manually: put the files in place
.agents/skills/indexion-segment/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trkbt10/indexion-skills --skill indexion-segment -a cursor2Manually: put the files in place
.cursor/skills/indexion-segment/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trkbt10/indexion-skills indexion-segment2Manually: put the files in place
.github/skills/indexion-segment/SKILL.md1Skills CLI (Vercel)
npx skills add trkbt10/indexion-skills --skill indexion-segment -a gemini-cli2Platform CLI
gemini skills install https://github.com/trkbt10/indexion-skills --path skills/indexion-segmentManually: put the files in place
.devin/skills/indexion-segment/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trkbt10/indexion-skills --skill indexion-segment -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about indexion-segment
How do I install indexion-segment in Claude?
Run npx skills add trkbt10/indexion-skills --skill indexion-segment -a claude-code. The skill file then lands at ~/.claude/skills/indexion-segment/SKILL.md.
What does indexion-segment do?
It splits text into contextual segments for RAG and embedding pipelines. You pick the strategy per task: window divergence, TF-IDF or punctuation.
How do the segmentation strategies differ?
window looks for divergence in a sliding window and is the default. tfidf detects topic changes, punctuation cuts at sentence boundaries. Mixed documents can use --hybrid.
Source text
SKILL.md · Apache-2.0
--- name: indexion-segment description: Split text into contextual chunks for RAG/embedding pipelines. Document segmentation and section extraction using window, tfidf, punctuation, or hybrid strategies chosen by intent. --- # indexion segment Split text into contextual segments using divergence-based, TF-IDF, or punctuation strategies. ## When to Use - User needs to chunk text for RAG or embedding pipelines - User wants to split a document into meaningful sections - User asks to segment text for processing - Preparing text for similarity analysis at sub-document level ## Usage ```bash # Default window divergence strategy indexion segment <input-file> <output-dir> # TF-IDF based segmentation indexion segment --strategy=tfidf <input-file> <output-dir> # Punctuation-based segmentation indexion segment --strategy=punctuation <input-file> <output-dir> # Custom segment sizes indexion segment --min-size=200 --max-size=3000 --target-size=800 document.txt output/ # Custom divergence threshold indexion segment --threshold=0.5 document.txt output/ # Adaptive threshold mode (default) indexion segment --adaptive document.txt output/ # Hybrid NCD+TF-IDF mode indexion segment --hybrid --ncd-weight=0.6 --tfidf-weight=0.4 document.txt output/ # Custom window size indexion segment --window-size=5 document.txt output/ # Custom output prefix indexion segment --prefix=chunk document.txt output/ ``` ## Options | Option | Default | Description | |--------|---------|-------------| | `--strategy=NAME` | window | Strategy: window, tfidf, punctuation | | `--min-size=INT` | 100 | Minimum segment characters | | `--max-size=INT` | 2000 | Maximum segment characters | | `--target-size=INT` | 500 | Target segment characters | | `--threshold=FLOAT` | 0.42 | Divergence threshold | | `--window-size=INT` | 3 | Window size | | `--adaptive` | true | Adaptive threshold mode | | `--hybrid` | false | NCD+TF-IDF hybrid mode | | `--ncd-weight=FLOAT` | 0.5 | NCD weight in hybrid mode | | `--tfidf-weight=FLOAT` | 0.5 | TF-IDF weight in hybrid mode | | `--prefix=NAME` | segment | Output file prefix | ## Strategies | Strategy | Description | |----------|-------------| | `window` (default) | Sliding window divergence detection | | `tfidf` | TF-IDF based topic change detection | | `punctuation` | Punctuation/sentence boundary based | ## Workflow 1. Run `indexion segment <input-file> <output-dir>` to split text with defaults 2. Adjust `--threshold` and `--target-size` to tune segmentation granularity 3. Use `--hybrid` mode for better accuracy on mixed-content documents
© trkbt10 · Apache-2.0 · trkbt10/indexion-skills