A Claude Code skill that compresses other skills to cut token cost, based on the SkillReducer methodology — empirically validated on 55,315 public skills.
中文简介:这是一个压缩 Claude Code skill 体积、降低 token 成本的 skill。输入任意
SKILL.md路径,输出<skill>/.reduced/目录(含压缩版SKILL.md、按类型拆分的background.md/examples.md/templates.md,以及REDUCTION_REPORT.md)。论文 600-skill 对照评估中,压缩后质量反升 2.8%,但token消耗大大减少——冗余内容会分散 agent 注意力。
Community skills have systemic bloat:
- 26.4% have missing or under-length descriptions — the router never matches them, tokens burn in the candidate pool for nothing
- Only 38.5% of body content is actionable core rule; 60%+ is background / example / template
- 14.8% carry reference files that inject tens of thousands of tokens per invocation (100 SkillHub skills totaled 1.67M tokens)
Controlled evaluation on 600 skills found compressed versions outperformed originals by 2.8%. Non-essential content distracts the agent into searching for answers in irrelevant examples and background.
Given a SKILL.md path, produces <skill>/.reduced/ containing:
- Compressed
SKILL.md(optimized description + core_rule-only body) - Type-split
background.md/examples.md/templates.md, each withwhen:andtopics:frontmatter for progressive disclosure REDUCTION_REPORT.mdwith token deltas, classification distribution, and Faithfulness gate results
The original file is never overwritten. Output lands in .reduced/; you diff and replace manually.
Two stages plus two gates:
- Stage 1 — Description compression. Use delta debugging (DDMIN) to reduce the description to 1-minimal: the shortest form that still uniquely routes.
- Stage 2 — Body classification. Label each paragraph / bullet / code block against the 5-class taxonomy below; split into appropriate files.
- Gate 1 — Faithfulness (mandatory). For every operational concept in the original body (verb, threshold, path, API name, env var), verify it still exists in the compressed core ∪ split files. Lost concepts trigger a type-level rollback; at most 2 rounds. Anything still missing stays in the original and is flagged "non-compressible" in the report.
- Gate 2 — Task evaluation (optional). If test cases exist, run compressed vs. original; otherwise report "runtime behavior unverified."
| Type | Definition | Destination |
|---|---|---|
core_rule |
Actionable directives (when / must / steps / prohibitions / numeric thresholds) | SKILL.md (always loaded) |
background |
Motivation, rationale, "why" explanations | background.md |
example |
I/O pairs, demonstrations, few-shot samples | examples.md |
template |
Paste-ready boilerplate, fixed formats, config snippets | templates.md |
redundant |
Duplicates or already covered in referenced files | Discarded |
From the paper's marketing-strategy-pmm walkthrough:
- Core-only invocation: 12,019 → 540 tokens (−96%)
- Full load with all references: 12,019 → 7,231 tokens (−40%)
- Gate 2 score:
score_C(compressed) = 1.0 vs.score_A(original) = 0.93
git clone https://github.com/David0Ming/skill-compressor.git ~/.claude/skills/skill-compressorOr symlink from a working directory you already clone into:
ln -s /path/to/skill-compressor ~/.claude/skills/skill-compressornpx skills add David0Ming/skill-compressorclawhub install skill-compressorOnce installed, in any Claude Code session:
/skill-compressor- or: "compress
~/.claude/skills/foo/SKILL.md" - or: "this skill is huge, token cost is exploding — slim it down"
Claude walks the 8-step procedure and writes results to <skill>/.reduced/.
- Never overwrite the original
SKILL.md - Never drop numbers, thresholds, paths, API names, env vars
- Never modify the frontmatter
name - Never introduce rules not present in the original skill
- Never merge across skills
- If a concept is still missing after 2 rollback rounds → preserve the original paragraph and mark "non-compressible" in the report
- Skill is < 300 tokens (return < overhead)
- Body is already ≥ 80%
core_rule(already optimized) - Pure-template skill (no classification structure to exploit)
Methodology from: Chen et al., SkillReducer: A Two-Stage Compression Method for Agent Skills, arXiv:2603.29919, 2026.
Apache-2.0 — see LICENSE.