Repository navigation
Description
Background
Claude Code applies two truncation limits to SKILL.md frontmatter when building the skill listing shown to the model:
- Per-skill limit:
description + when_to_useis truncated at 1,536 characters.
“the combined description and when_to_use text is truncated at 1,536 characters in the skill listing to reduce context usage.” — docs
- Aggregate limit: the total skill listing budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters.
“The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters.” — docs
When these limits are exceeded, descriptions are silently truncated.
This is risky because the trigger keywords and routing cues the model relies on can disappear without warning, causing skills to mis-route or fail to activate entirely.
Current state of this repository
Measured against the 17 SKILL.md files currently under .claude/skills/:
| Skill | desc + when_to_use |
|---|---|
pr-management-code-review |
1,704 (168 chars over limit) |
setup-steward |
1,400 |
setup-isolated-setup-install |
1,292 |
security-issue-fix |
1,249 |
security-cve-allocate |
1,197 |
| … 12 more | all under 1,200 |
| Aggregate (post per-skill cap) | 18,586 |
Effective aggregate budgets:
- Sonnet (200k context): 8,000-char fallback budget → currently ~2.3× over
- Opus 4.7 (1M context): ~10,000-char dynamic budget (1%) → currently ~1.9× over
Adopters using additional plugin skills increase this even further.
Impact
- The end of
pr-management-code-reviewfrontmatter — including the triage vs. code-review routing distinction — is already being truncated. - Aggregate truncation order is not user-controllable, so as the catalog grows, any skill’s trigger keywords may silently disappear.
This can gradually degrade routing reliability in ways that are difficult to diagnose.
Proposal
-
Audit all
SKILL.mdfiles and move expository content out of frontmatter into the document body.Keep only:
- concise trigger phrases
- routing cues
- high-signal task descriptions
Move:
- rationale
- implementation notes
- long examples
- “distinct from X” explanations
- criteria source paths
- sub-step descriptions
-
Target budgets:
- keep each
description + when_to_useunder ~400 chars - keep repository aggregate under 5,000 chars
This provides headroom even for Sonnet adopters and downstream plugin ecosystems.
- keep each
-
Add a CI check (or pre-commit hook) that fails when:
- any skill exceeds the 1,536-char per-skill limit
- aggregate post-truncation catalog exceeds 8,000 chars
-
Document these limits in
AGENTS.mdso future skill authors are aware of the constraints.
Activity
choo121600 commentedon May 7, 2026
Our current aggregate frontmatter footprint is also significantly larger than many existing Claude Code plugin ecosystems (for example: oh-my-claude-code, astronomer-agents).
As adopters combine multiple skill ecosystems, the probability of silent truncation increases further.
andreahlert commentedon May 7, 2026
Awesome work! Noticed this too. been thinking more about the architecture side actually, even considered going hook-based or putting a router subagent in front of the catalog before landing on anything.
No strong opinion yet on how to fix long term. trim solves the bleeding right now so I'm fine starting there
One thing tho, I ran the numbers per skill and not all of them should be trimmed the same way. some lose disambiguation cues the model actually leans on to pick between siblings (triage vs code-review kinda thing). a few are fine, a couple need careful cuts, a couple probably need their distinct-from notes pushed into AGENTS.md instead of dropped.
Full breakdown with token math here: https://gist.github.com/andreahlert/a219b526fd6298f0a81c612c64da5ee0
potiuk commentedon May 7, 2026
Fantastic diagnosis... I wonder if we can make some automation to a) detect those cases b) decrease the size c) suggest to split things maybe?
Maybe there are some repos/ideas out there that cold help :) ?
choo121600 commentedon May 8, 2026
Wow, Cool 🙌
choo121600 commentedon May 8, 2026
My impression is that the best path is probably to align more closely with Anthropic’s official
SKILL.mdguidance.https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md#write-the-skillmd
Additionally, I think applying #87 could also help quite a bit here.
For (a) and (b), I think we could build a prek validator hook around those conventions to automatically detect oversized / overly verbose sections and encourage more compact structures.
For (c), I think we already partially address this through the
write-skillskill we adopted from JuliusBrussee/awesome-claude-skillsIt already includes guidance around progressive disclosure and skill splitting:
https://github.com/apache/airflow-steward/blob/88d3d2ec22b18737445c8df96a975942ab1b5c5d/.claude/skills/write-skill/SKILL.md?plain=1#L132-L147
So I think the main issue is that many of the problematic skills were created before we introduced those conventions.
My guess is that improving / migrating the existing skills would already eliminate a large portion of the current truncation risk.
potiuk commentedon May 8, 2026
Hmm. Before we dive deeper. ... I wanted to get your thinking on "birds eye" view :)
I am all for optimising things and using less tokens where we can etc.
However I am not sure if optimising for current context limitation is what we really want. Historically (Well last few months - but this is the history of "really good" AI) - the context sizes grew dramatically. Fast and what was given as limitation 2 months ago is not even afterthought today.
Recently Anthropic announce "infinite" context windows - for example https://www.geeky-gadgets.com/claude-s-new-infinite-context-window-model/ where the "compacting" of context is really somethign that happens automatically behind the sceens and there is the "dreaming" phase where your data in long running sessions get re-organized and cleaned and where essentially you will have to stop worrying about "context size" and your session getting worse over time because of that.
I think it's inevitable it will happen and will work like that - fast.... Is it worth to optimize for that today - if in a month from now we will stop worrying about it ?
It's more of a philosophical question - I love optimisations and analysis like that and I love to know why and what I see as limitation today..
But ... will it be a limitation tomorrow ?
choo121600 commentedon May 8, 2026
Great philosophical question :) and I generally agree that over-optimizing for temporary limits is usually wasted effort.
That said, I think this issue is less about “today’s context window” and more about always-resident routing metadata.
A few reasons why I see it differently:
I’m less convinced that we should spend time chasing arbitrary goals like “under 5,000 chars” purely for optimization’s sake. That does risk overfitting to today’s constraints.
So I think a more balanced scope would be:
But avoid turning this into a broad “character shaving” effort unless aggregate size becomes a demonstrated operational problem.
andreahlert commentedon May 8, 2026
I fully agree with @potiuk on the future: larger context windows are coming, and fast. Saw anthropic CPO speaking openly about "context windows that feel infinite" when combined with high-quality memory. The direction is clear.
But, and this is an important but more context in the future does not nullify the truncation bugs that already exist today. Anthropic itself published an [April postmortem] about three separate bugs that degraded Claude Code quality, including one where automatic cleanup of idle-session thinking caused the model to become "forgetful and repetitive".
And in the official Claude Code repo there is an [open issue (#12054)]where a single
getDiagnostics()call returned ~580k tokens and consumed nearly the entire remaining session context, triggering a "context low" error .... showing that the tool still does not manage large context volumes well.@choo121600's point feels right to me: this is not optimization for optimization's sake. It is a correctness bug,maybe not a bug, since there is no release yet hahah, the
pr-management-code-reviewskill is already being truncated silently today, and the section being cut is exactly the critical disambiguation ("triage vs code-review"). The model may simply pick the wrong tool with nobody noticing.I am +1 for the balanced scope he proposed:
Without turning this into an obsessive character-shaving effort.
@choo121600, if consensus lands here, do you have bandwidth to lead the implementation? I can help and review the more sensitive cuts.
potiuk commentedon May 8, 2026
💯 . Thanks - that was very deliberate and thoughtful :).
Let's go then
choo121600 commentedon May 9, 2026
Cool 🙌
It’s already evening here, so starting tomorrow I’ll proceed roughly in this order:
potiuk commentedon May 9, 2026
Cool :)
choo121600 commentedon May 11, 2026
We can close this issue and track the remaining work in #118