A tiny audit tool for Agent Skills. It measures the always-loaded token weight of a SKILL.md and flags what to defer to references/ or scripts/.
A skill's SKILL.md is injected into context in every session where the skill is available. Detail that only matters after the skill fires still taxes every session. The fix is progressive disclosure: keep SKILL.md a thin trigger + pointers, and push heavy content into linked references/*.md and executable scripts/.
skill-slim just measures that weight so you can see which skills are heavy and where the movable bytes are. It doesn't rewrite anything — it points; you slim.
Drop it into your skills directory, or clone and run the script directly. No dependencies beyond Python 3.
git clone https://github.com/llmer/skill-slim
python3 skill-slim/scripts/analyze.py path/to/SKILL.md [more.md ...]
python3 scripts/analyze.py path/to/SKILL.md [more.md ...]
Reports per file: estimated always-loaded tokens, budget overage, movable inline-code / long-prose weight, existing progressive-disclosure links, and a conservative post-slim estimate. Sorted worst-first. JSON on stdout, a summary table at the end.
Run the analyzer on a real Anthropic skill before and after slimming, plus this tool's own SKILL.md:
$ python3 scripts/analyze.py examples/frontend-design-before/SKILL.md examples/frontend-design-after/SKILL.md SKILL.md
=== summary (worst first) ===
[SLIM] frontend-design-before/SKILL.md ~ 2062 tok → ~1501 after (27% off)
[ok ] frontend-design-after/SKILL.md ~ 395 tok → ~ 395 after (0% off)
[ok ] skill-slim/SKILL.md ~ 323 tok → ~ 323 after (0% off)
frontend-designbefore: ~2,062 always-loaded tokens, flagged over budget.frontend-designafter a hand-slim that moved the design + writing guidance intoreferences/(seeexamples/frontend-design-after/): 395 tokens — an actual 81% cut, well under budget.- skill-slim dogfoods: its own
SKILL.mdis 323 tokens, under budget.
Note the estimator's → after column is deliberately conservative (it only counts obviously-movable code/prose, so it predicted 27% for frontend-design). A real slim that also restructures the prose beat that estimate by a wide margin. Treat the estimate as a floor, not a ceiling.
The examples/ directory contains the exact before/after files, so the numbers above reproduce on a clean checkout.
| Metric | Meaning |
|---|---|
total_tokens_est |
chars/4 of the whole file (approximate, tokenizer-free) |
inline_code_tokens |
fenced code blocks — examples the model can run from scripts/ instead of reading inline |
long_prose_tokens |
paragraphs > 600 chars — often re-derivable guidance or reference material for references/ |
existing_ref_links |
links to *.md; zero + over budget = everything loads eagerly |
Method, heuristics, and the budget rationale: references/method.md.
Token counts are a chars/4 approximation, not a real tokenizer — use them for relative ranking and rough targets, not exact billing. The ~500-token budget is a guideline for a "thin" skill, not a hard failure line.
MIT