[BUG] Plugin Marketplace - Structured Plugin Skills result in inflation of skills into system prompt
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?
Summary
Claude Code's skill loading mechanism reads marketplace.json files from multiple cache directories, causing skills to be counted and loaded multiple times if the marketplace provides structured plugins with skills. This results in an inflated skill count and severe truncation of visible skills in the system prompt.
Environment
- Claude Code Version: 2.0.71
- OS: macOS Darwin 25.2.0
- Marketplace: Custom marketplace with 18 plugin groups containing 169 individual skills
Actual Behavior
Issue 1: Skill Count Inflation (19x)
System prompt reports "Showing 60 of 3218 skills" when only 169 skills exist.
Root Cause: Claude Code reads marketplace.json from:
- 1 source marketplace (~/.claude/plugins/marketplaces/[name]/.claude-plugin/marketplace.json)
- 18 cached plugin directories (~/.claude/plugins/cache/[name]/[plugin-group]/[hash]/.claude-plugin/marketplace.json)
Each cache directory contains a full copy of the marketplace.json with all 169 skills, causing:
18 cache directories × 169 skills = 3,042
- 1 source directory × 169 skills = 169
- 7 plugin-dev internal skills = 7
= 3,218 total (vs 169 actual)
Issue 2: Description Loading Multiplication (~2.2x)
Only 60 of 169 skills appear in the system prompt, despite total description length (18,848 chars) being within the documented ~15,000 char budget.
Evidence:
- If skills loaded once: 134 skills should fit (18,848 / 134 = 141 chars avg)
- Actually visible: 60 skills
- Effective chars per skill: 15,000 / 60 = 250 chars
- Multiplication factor: 250 / 112 = 2.2x
Skills are being loaded from multiple cache locations, consuming the token budget ~2.2x faster than expected.
Evidence
Cache Structure (Verified)
$ ls ~/.claude/plugins/cache/claude-skills/
ai-skills/81990477905c/
api-skills/81990477905c/
cloudflare-skills/81990477905c/
... (18 directories total)
Each Cache Contains Full Marketplace
$ jq '[.plugins[].skills | length] | add' \
~/.claude/plugins/cache/claude-skills/ai-skills/81990477905c/.claude-plugin/marketplace.json
169 # Full copy, not just ai-skills subset!
$ jq '[.plugins[].skills | length] | add' \
~/.claude/plugins/cache/claude-skills/cloudflare-skills/81990477905c/.claude-plugin/marketplace.json
169 # Same - every cache has the complete marketplace
Mathematical Proof
Skill count: 18 × 169 + 169 + 7 = 3,218 ✓ (matches system prompt)
Description loading: 60 × 112 × 2.2 ≈ 14,784 chars ≈ 15,000 limit ✓ (explains truncation)
Impact
- Severity: Medium-High
- User Impact: Skills not visible in system prompt will never be triggered, silently breaking functionality
- Workaround Exists: SLASH_COMMAND_TOOL_CHAR_BUDGET=30000 claude (but undocumented)
Suggested Fix
For Skill Counting
# Pseudocode - current behavior
total_skills = 0
for marketplace_json in find_all_marketplace_files():
total_skills += count_skills(marketplace_json) # Counts duplicates
# Fix: Deduplicate by marketplace ID
seen_marketplaces = set()
total_skills = 0
for marketplace_json in find_all_marketplace_files():
marketplace_id = get_marketplace_id(marketplace_json)
if marketplace_id not in seen_marketplaces:
seen_marketplaces.add(marketplace_id)
total_skills += count_skills(marketplace_json)
For Description Loading
Only load skill descriptions from source marketplace, not from cached plugin directories. Alternatively, deduplicate skill descriptions by skill name before adding to system prompt.
For Cache Structure
Consider caching only the plugin-specific subset of marketplace.json in each plugin's cache directory, rather than the complete marketplace.
What Should Happen?
- Skill count should match actual unique skills (169)
- All 169 skills should be visible in system prompt (within token budget, currently 15.000 characters and around 4000 tokens)
- Skills should be loaded once, not from multiple cache locations
Error Messages/Logs
Steps to Reproduce
- Create a marketplace with multiple plugin groups, each using explicit "skills": ["./skills/..."] arrays
- Install the marketplace via /plugin marketplace add
- Start a new Claude Code session
- Observe the system prompt shows "Showing X of Y skills" with inflated Y value
- Count actual skills visible in <available_skills> section
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.9.71
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗