claude-code - 💡(How to fix) Fix Feature request: lazy skill loading for plugins with many skills [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49532Fetched 2026-04-17 08:38:28
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

This came out of a token optimization effort on a Claude Code plugin. We trimmed instruction files from 8,734 to 7,754 lines and descriptions from 2,900 to 822 words. The remaining ambient burn from the skill menu is now the dominant token cost and is outside plugin-author control.

Root Cause

This came out of a token optimization effort on a Claude Code plugin. We trimmed instruction files from 8,734 to 7,754 lines and descriptions from 2,900 to 822 words. The remaining ambient burn from the skill menu is now the dominant token cost and is outside plugin-author control.

RAW_BUFFERClick to expand / collapse

Problem

Claude Code loads all skill description: fields from every installed plugin into the system prompt on every turn. For plugins with many skills (e.g., 79 skills), this adds ~800-1,200 words of ambient token burn regardless of which skill is being used.

We've already compressed our descriptions from ~2,900 to 822 words (72% reduction), but the fundamental issue is that all descriptions load on every turn even when most are irrelevant.

Proposed Solutions

1. Lazy Skill Loading (preferred)

Load skill descriptions on demand rather than all-at-once:

  • Subagent-scoped: When a subagent is spawned with subagent_type: "plugin:agent-name", only load descriptions for skills listed in that agent's file — not all plugin skills.
  • Recency-scoped: In the main thread, load descriptions only for skills invoked in the last N turns. On first turn, load only skills with argument-hint: in frontmatter (user-invocable entry points).

2. Description Truncation (fallback)

If lazy loading isn't feasible, truncate skill descriptions to the first sentence in the system prompt. The full description loads when the skill is actually invoked via the Skill tool. Preserves routing signals while cutting ambient burn by ~60%.

3. Spec Deduplication Across Subagents

When multiple subagents in the same session read the same file, subsequent reads could serve from a session-level cache with a marker instead of re-reading. Prompt caching helps at the API level, but each subagent still processes the full content in its context window.

Impact

For a plugin with 79 skills, lazy loading would eliminate ~800-1,200 words of ambient context per turn — the single highest-impact optimization available beyond what plugin authors can do themselves.

Context

This came out of a token optimization effort on a Claude Code plugin. We trimmed instruction files from 8,734 to 7,754 lines and descriptions from 2,900 to 822 words. The remaining ambient burn from the skill menu is now the dominant token cost and is outside plugin-author control.

extent analysis

TL;DR

Implement lazy skill loading to reduce ambient token burn by loading skill descriptions only when needed.

Guidance

  • Consider implementing Subagent-scoped lazy loading, where skill descriptions are loaded only for skills listed in the agent's file when a subagent is spawned.
  • Evaluate Recency-scoped lazy loading as an alternative, loading descriptions only for skills invoked in the last N turns or with argument-hint: in frontmatter.
  • If lazy loading is not feasible, Description Truncation can be used as a fallback, truncating skill descriptions to the first sentence in the system prompt.
  • Investigate Spec Deduplication Across Subagents to reduce redundant reads of the same file by multiple subagents in the same session.

Example

No code snippet is provided as the issue does not contain specific code references.

Notes

The proposed solutions aim to address the issue of ambient token burn caused by loading all skill descriptions on every turn. The effectiveness of each solution may vary depending on the specific use case and plugin implementation.

Recommendation

Apply Lazy Skill Loading as the preferred solution, as it directly addresses the root cause of the issue and has the potential to eliminate a significant amount of ambient token burn.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature request: lazy skill loading for plugins with many skills [1 participants]