tree-sitter-language-pack-chunking-for-llms

tree-sitter-language-pack-chunking-for-llms is a skill for Claude Code from xberg-io/tree-sitter-language-pack. It costs 52 tokens per session (737 once invoked), scanned A, original, MIT.

A source-code splitter that divides files into chunks at syntax boundaries, keeping functions, classes, and blocks together. The chunks are sized for an LLM, a language model that processes text within a limited context window.

In plain words
What is it for?
Use it to prepare coherent pieces of source code for language-model requests while including optional structure metadata.
Why use it?
It avoids fixed-size splits that cut code constructs in half and remove useful local context.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the tree-sitter-language-pack plugin — 7 skills, 1 MCP server shipped together

Good fit Use it to prepare coherent pieces of source code for language-model requests while including optional structure metadata.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xberg-io/tree-sitter-language-pack --skill tree-sitter-language-pack-chunking-for-llms
Clone the repo
git clone --depth 1 https://github.com/xberg-io/tree-sitter-language-pack

Made for: Claude Code.

Or install tree-sitter-language-pack, the plugin that ships this one along with the rest of its 7 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tree-sitter-language-pack-chunking-for-llms

README.md
[![agentmods](https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms/github.svg)](https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms)
Your own site
<a href="https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms"><img src="https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tree-sitter-language-pack-chunking-for-llms

Your own site · 80×15
<a href="https://agentmods.dev/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms"><img src="https://agentmods.dev/badge/skills/xberg-io/tree-sitter-language-pack/tree-sitter-language-pack-chunking-for-llms.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 737 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.00737
Opus 5.5 $0.00021 $0.00295
Sonnet 5.5 $0.00010 $0.00147
Haiku 4.5 $0.00005 $0.00074

Measured yesterday against content hash 5317efecee26, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tree-sitter-language-pack-chunking-for-llms scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/.ai-rulez/skills/tree-sitter-language-pack-chunking-for-llms/SKILL.md · 83 lines

How it starts

The opening of the file, as written. The whole thing — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Syntax-aware chunking for LLMs

Splitting code on a fixed byte or line count cuts functions in half and strips context. ts-pack process <file> --chunk-size <bytes> splits on syntactic boundaries (whole functions, classes, blocks) so each chunk is a coherent unit, and emits them in the JSON chunks array.

Quick recipe

# ~2 KB chunks aligned to syntax boundaries
ts-pack process src/app.ts --chunk-size 2000

--chunk-size is a maximum size in bytes. The splitter packs whole syntactic units up to that bound; an oversized single construct becomes its own chunk rather than being cut. Chunks are added to the normal process JSON output under chunks.

Picking a size

  • Match the downstream model's token budget. A rough rule: bytes ÷ 4 ≈ tokens for code, so --chunk-size 4000 is on the order of ~1k tokens.
  • Larger chunks preserve more local context but fit fewer per request.
  • Leave headroom for the prompt, the surrounding messages, and the response — do not size chunks to the full context window.

Combining with extraction

Chunking composes with the other process features, so you can attach structure metadata to each request:

ts-pack process src/service.py --structure --chunk-size 3000 \
  | jq '{chunks: (.chunks | length), functions: (.structure | length)}'

Chunk output

chunks is a list of code-chunk objects in the process JSON. Each chunk carries its source text plus span information (line/byte offsets), so you can cite or re-locate a chunk back in the original file. Iterate the array to feed an LLM one coherent unit at a time:

ts-pack process big_module.py --chunk-size 2500 \
  | jq -c '.chunks[]'

SDK equivalent

The SDK exposes chunking through the process config: set the chunk_max_size field (in bytes) on ProcessConfig — the same value the CLI's --chunk-size flag sets. ProcessConfig is a frozen dataclass, so pass it to the constructor:

from tree_sitter_language_pack import process, ProcessConfig

config = ProcessConfig("python", chunk_max_size=2500)
result = process(source_code, config)
for chunk in result.chunks:          # ProcessResult is an object, not a dict
    send_to_llm(chunk.content)

Read the full file on GitHub · 83 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 83 lines · 52 tokens per session scan A 5317efecee26

Subscribe to this mod's changes

tree-sitter-language-pack-chunking-for-llms is a skill published in the GitHub repository xberg-io/tree-sitter-language-pack (476 stars, last pushed yesterday), licensed MIT. It adds 52 tokens to every session and 737 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-15.

Related

Other skills, from other repositories