Make every skill family leaner without changing what its skills do, using the recipe first applied to the setup family (#1343, PR #1353).
Why
Every skill costs tokens twice:
- Always-on —
description + when_to_use are loaded in every session for every installed skill, whether it runs or not. Budget: 200 tokens per skill.
- Body —
SKILL.md is loaded on every invocation. Budget: 5,000 tokens, pre-flight block excluded; PRINCIPLES.md P14's 500-line cap is the structural limit.
Both budgets come from optimize-skill, which is also the tool for doing this work.
Recipe (from the setup family)
Run /magpie-optimize-skill per skill and apply the passes in this order:
- Measure first.
uv run --project tools/skill-token-count skill-token-count --write, plus a chars ÷ 4 estimate of the frontmatter. Record before/after for both budgets.
- Trim the always-on frontmatter of any skill over 200 tokens. Drop lists that
argument-hint or the body already carries; keep the routing phrases a model needs to pick the skill. Highest value per token, because it is paid in every session.
- Split (only for bodies over budget, or rules that serve one sub-action). Move such rules into the sibling file that uses them, byte-for-byte, leaving a one-line pointer. Keep a rule in
SKILL.md if many places cite it. Repoint every #anchor reference to what moved.
- Wording pass. One sentence per line (SemBr); cut sentences that restate a nearby table or section; plain verbs; no hedges. Keep bold only on real prohibitions.
- Fix stale pointers found on the way (links to renamed files, "above" that is below, wrong counts). List anything eval-coupled that you did not fix in the PR description.
Invariants — a PR that breaks one is not an optimization
- Headings (
#–####) and **Golden rule N — …** headlines stay byte-identical. They feed surface_hash (changing one tells every adopter their configuration is stale) and eval step_heading matching.
- Frontmatter other than
description / when_to_use, the generated pre-flight block, and every fenced code block stay byte-identical.
- Every link target, command, flag, path, placeholder and condition survives. Check it mechanically: compare headings, fences, links and inline code spans between
HEAD and the working tree, with whitespace normalised.
- Eval-extracted sections (
step_heading in tools/skill-evals/evals/<skill>/*/step-config.json): tighten only; every string that fixtures or expected.json rely on stays byte-identical.
- The validator,
prek run --all-files and lychee are green, and docs/mode-economics.md plus any family token figure in docs/setup/marketplace.md are regenerated.
- Run the eval suites before and after. The harness launches the
claude CLI, which fails inside the sandbox, so run it outside, or every case errors and nothing is graded.
What to expect
On setup, the family with no skill over either budget, the result was −2,709 body tokens across 7 skills (−8.5%) and the one frontmatter over budget cut from ~228 to ~167 tokens. The big win was setup/SKILL.md (−16%), where rules were moved as well as reworded; pure wording passes gave 4–9%. Families with skills far over budget (security, release-management, pr-management, issue) should gain much more from the split pass than setup did.
Sub-issues
One per family; each lists its skills with both budgets and marks the ones exceeded. Suggested priority: always-on first (it is paid by every session), then the largest bodies.
Make every skill family leaner without changing what its skills do, using the recipe first applied to the
setupfamily (#1343, PR #1353).Why
Every skill costs tokens twice:
description+when_to_useare loaded in every session for every installed skill, whether it runs or not. Budget: 200 tokens per skill.SKILL.mdis loaded on every invocation. Budget: 5,000 tokens, pre-flight block excluded;PRINCIPLES.mdP14's 500-line cap is the structural limit.Both budgets come from
optimize-skill, which is also the tool for doing this work.Recipe (from the setup family)
Run
/magpie-optimize-skillper skill and apply the passes in this order:uv run --project tools/skill-token-count skill-token-count --write, plus a chars ÷ 4 estimate of the frontmatter. Record before/after for both budgets.argument-hintor the body already carries; keep the routing phrases a model needs to pick the skill. Highest value per token, because it is paid in every session.SKILL.mdif many places cite it. Repoint every#anchorreference to what moved.Invariants — a PR that breaks one is not an optimization
#–####) and**Golden rule N — …**headlines stay byte-identical. They feedsurface_hash(changing one tells every adopter their configuration is stale) and evalstep_headingmatching.description/when_to_use, the generated pre-flight block, and every fenced code block stay byte-identical.HEADand the working tree, with whitespace normalised.step_headingintools/skill-evals/evals/<skill>/*/step-config.json): tighten only; every string that fixtures orexpected.jsonrely on stays byte-identical.prek run --all-filesandlycheeare green, anddocs/mode-economics.mdplus any family token figure indocs/setup/marketplace.mdare regenerated.claudeCLI, which fails inside the sandbox, so run it outside, or every case errors and nothing is graded.What to expect
On setup, the family with no skill over either budget, the result was −2,709 body tokens across 7 skills (−8.5%) and the one frontmatter over budget cut from ~228 to ~167 tokens. The big win was
setup/SKILL.md(−16%), where rules were moved as well as reworded; pure wording passes gave 4–9%. Families with skills far over budget (security, release-management, pr-management, issue) should gain much more from the split pass than setup did.Sub-issues
One per family; each lists its skills with both budgets and marks the ones exceeded. Suggested priority: always-on first (it is paid by every session), then the largest bodies.