[BUG] /claude-api bundled skill saturates context unconditionally — ~77% spike from neutral question
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
▎
▎ Version: 2.1.156
▎ Observed: Context window jumped from ~17% to ~94% when invoking /claude-api with a neutral question.
▎
▎ Root cause: The bundled skill at %LOCALAPPDATA%\Temp\claude\bundled-skills\<version>\<hash>\claude-api\ contains ~40 files totaling ~514 KB across 6 language SDKs (Python, TypeScript, Go, Java, C#, Ruby, PHP, curl) plus 12 managed-agents files and shared concept docs. There is no SKILL.md at the root with routing logic — all files are loaded unconditionally on every invocation, regardless of the user's language or topic.
▎
▎ Notable offenders loaded even for e.g. "how do I stream responses?":
▎ - shared/model-migration.md — 84 KB, irrelevant unless explicitly upgrading models
▎ - shared/managed-agents-*.md — ~150 KB total, irrelevant unless explicitly building agents
▎
▎ Expected: Detect language from file imports, detect topic from the question, load 1–3 relevant files. Most queries need ~15–30 KB, not 514 KB.
▎
▎ Suggested fix: Add a SKILL.md at the skill root that routes to the appropriate language folder and shared file based on detected context. The skill already has the right file structure — it just needs a router.
▎
▎ Workaround: A user command at ~/.claude/commands/claude-api.md overrides the bundled skill and implements on-demand loading. Effective but fragile — requires manual upkeep per version.
What Should Happen?
If the request from the user is NOT specific in terms of a language (se the attached conversation in a file), the skill should either suggest a differnt skill OR interview the user OR do a text-search (grep perhaps" in the files of the folder to LIMIT the context bloating !!!!!!
Error Messages/Logs
✻ Baked for 7m 36s · 1 shell still running
❯ i looked into it myself. while you analyzedd, and i agree: the skill loaded the ENTIRE folder and all subfolders into the context instead of searching with grep or somilar for keywords.
this MUST change in the future, I was asking a perfectly neutral question !!!! - what can we do ?
Let me look one more time — the user's "entire folder and subfolders" comment means there must be a file structure somewhere I missed.
Searched for 2 patterns, ran 1 shell command
Interrupted · What should Claude do instead?
❯ FYI : this is the folder in question: C:\Users\LARSGR~1\AppData\Local\Temp\claude\bundled-skills\2.1.156\d30268a0c2e076f2b8fde8396e2223c4\claude-api
Now we can see it. Let me inspect the actual structure and sizes.
Searched for 1 pattern, ran 1 shell command
Now the picture is complete and damning:
514 KB across 40 files. All loaded unconditionally. Including full docs for 6 languages (Python, TypeScript, Go, Java, C#, Ruby, PHP, curl) + 12 managed-agents files + shared concepts — regardless of what you asked.
The single biggest offender: shared/model-migration.md at 84 KB alone.
---
Two things we can do:
1. Local override now — Create ~/.claude/commands/claude-api.md as a single routing file. User commands take precedence over bundled skills. The file would instruct Claude to detect language + topic first, then read only the relevant files from the bundled path using Glob/Read. Instead of 514KB dumped upfront, it fetches 1–3 files on demand. Context impact: ~5% instead of 77%.
2. Report to Anthropic — This is a product-level design bug. The bundled skill has no routing logic at all — it just saturates the context. Worth filing at github.com/anthropics/claude-code/issues.
---
Want me to build the local override now? It would look like:
~/.claude/commands/claude-api.md
→ detect language from imports in current file
→ detect topic from user question (streaming? tool-use? migration? agents?)
→ Read only the 1-3 relevant files from the bundled path
→ proceed with ~30KB instead of 514KB
✻ Worked for 1m 2s · 1 shell still running
❯ ja lav den override nu, formuler så en kort (men beskrivende) tekst jeg kan rapportere til Anthropic
● Skill(/superpowers:writing-skills)
Successfully loaded skill
Let me check one existing command file for formatting conventions before writing.
Read 2 files
Let me check how _claude-global syncs to ~/.claude before deciding where to author.
Searched for 1 pattern, read 2 files, ran 1 shell command
Now I have everything I need. Writing both files in parallel.
● Write(_claude-global\commands\claude-api.md)
Wrote 64 lines to _claude-global\commands\claude-api.md
# /claude-api — Claude API / Anthropic SDK reference
Load documentation on demand. Never load all files upfront.
The bundled skill spans 6 languages + managed agents = ~514 KB. Load only what the question requires.
---
## Step 1 — Find the bundled docs path
Run this PowerShell command to locate the current installation (path changes per version):
… +54 lines
Now deploy it and sync:
Listed 1 directory, ran 2 shell commands
Good — 2.5 KB override deployed vs 514 KB bundle.
Steps to Reproduce
simply do this from a fresh session:
✳ Compare pricing between Opus 4.8 and 4.6.txt
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.156
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
this belong in your future QA loop for ALL skills !
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗