From tree-sitter-language-pack
Splits source code into syntax-aware chunks for LLM context windows using ts-pack. Covers chunk-size selection, JSON output shape, and SDK usage.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tree-sitter-language-pack:chunking-for-llmsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Splitting code on a fixed byte or line count cuts functions in half and
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.
# ~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.
--chunk-size 4000 is on the order of ~1k tokens.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)}'
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[]'
The SDK exposes chunking through the process config. Use with_chunking
to set the maximum chunk size — the config field chunk_max_size is
read-only (the CLI flag is --chunk-size):
from tree_sitter_language_pack import process, ProcessConfig
config = ProcessConfig("python").with_chunking(2500)
result = process(source_code, config)
for chunk in result["chunks"]:
send_to_llm(chunk)
For a single small file that already fits the context window, skip chunking and pass the file whole. Reach for chunking when a file is large, when you are batching many files into a RAG index, or when you need stable, syntactically coherent units to cite.
npx claudepluginhub xberg-io/plugins --plugin tree-sitter-language-packProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.