English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Skill Context Explosion in Claude Code: Three Stacked Mechanisms and a Four-Phase Fix

Forum topic · 小凯 · 2026-04-27

Summary

This AI interview deep-dive explains why progressive disclosure alone does not prevent context explosion when an agent manages many skills. It identifies three compounding mechanisms: (1) a hard character budget for skill metadata in the system prompt, where 5-6 detailed skills at ~1,200 characters each can exhaust an ~8,000-character budget; (2) Transformer n-squared attention dilution, which makes skill descriptions in the middle of long contexts effectively invisible (the 'context rot' finding from Chroma research); and (3) disambiguation failures, where a few semantically similar skills are harder to distinguish than many dissimilar ones. The article cites Anthropic's practical recommendation of 20-50 concurrently enabled skills, real-world cases of 100+ skill collections, and security research showing 26.1% of public skills contain vulnerabilities. It then proposes a phased remediation playbook: raising the char budget as a stopgap, auditing and pruning skills, structural measures (paths scoping, disable-model-invocation, context: fork subagents, plugin namespacing), and architectural patterns like an index skill or multi-agent teams.

Key points

This post analyzes a common AI-engineering interview question: why does an agent's skill system break down as the number of skills grows, and how do you fix it? The core argument: progressive disclosure solves only the first layer — three stacked mechanisms require a layered response.

Why "progressive disclosure" is only half the answer

Progressive disclosure (skill metadata loaded at session start, full content on demand) is Anthropic's stated core design principle (Anthropic Engineering Blog). But metadata crowding alone triggers three compounding failure modes.

Mechanism 1: Character budget truncation

  • Each skill's metadata (description must be under 1024 chars per Anthropic's PDF guide) easily reaches 1,000–1,500 characters.
  • Community observation suggests only ~1% of total context (or a fixed fallback of ~8,000 chars) is allocated to tool/skill metadata; beyond that, new skills get truncated or ignored. *(Not officially documented by Anthropic.)*
  • Math: at ~1,200 chars per skill, 6–7 detailed skills saturate the budget. Better-written descriptions accelerate the crash.
  • Mechanism 2: n² attention dilution ("context rot")

  • Self-attention is quadratic: 100K tokens means ~10 billion pairwise relations; softmax normalization exponentially dilutes signal as context grows.
  • Chroma's 2025 "Context Rot" study (18 frontier models) found that position and context size determine whether a model can actually use relevant information (Chroma Research).
  • Result: with 20 skills crammed at the end of a system prompt, the model may completely miss or mis-select the correct skill (lost-in-the-middle effect).
  • Mechanism 3: Disambiguation failure

  • "3 similar skills are more lethal than 100 dissimilar ones." Chroma's distractor interference experiments show semantically similar but irrelevant content degrades performance beyond what context length explains, and topically-related distractors appear most often in hallucinations.
  • Example: /deploy-staging, /deploy-production, /deploy-rollback all share "deploy"/"CI-CD" keywords; community readings of BFCL v4 suggest a 1–8 percentage-point accuracy drop in near-duplicate distractor scenarios.
  • What the industry actually does

  • Anthropic's official docs warn against too many enabled skills and recommend evaluating beyond 20–50 simultaneously enabled — "100+" is architectural capacity, not a performance recommendation.
  • Anthropic engineer Thariq Shihipar's team practices folder-based organization, gotchas-first documentation, trigger-oriented descriptions, and sub-agents for context isolation.
  • A Japanese developer (takuyanagai0213) ran 100 skills in 4 months: PR output went from 2 to 175/month, $200/month plan consumed tokens equivalent to ~$4,900 — but skills were selectively activated, never all at once.
  • Reza Rezvani's claude-skills repo ships 235 skills across 12 domains — with an actual working set far smaller.
  • The four-phase remediation playbook

    Phase 0 — stop the bleeding (5 min): raise SLASH_COMMAND_TOOL_CHAR_BUDGET to 24000. Trade-off: amplifies attention dilution (~2/3 of the effect is negative cost).

    Phase 1 — audit (half day): delete skills with zero calls in 30 days, merge overlaps, compress descriptions to ≤200 chars of trigger keywords; move detailed docs to references/.

    Phase 2 — structural fixes (four tools): 1. Paths: glob patterns limit auto-activation to relevant directories. 2. disable-model-invocation: true: removes the skill from the model's auto-selection pool entirely — context cost drops to zero; manual /skill-name only. Known plugin bugs reported (2026-02). 3. context: fork: run the skill in an isolated subagent; the main context only receives a summary. Community tests claim ~70% token savings with 5 parallel subagents. 4. Plugin packaging: namespace skills per scenario (e.g., /my-plugin:review).

    Phase 3 — architectural refactor: an index-skill pattern (one auto-detected skill listing all others; the rest are disable-model-invocation, ~26 tokens vs ~2000+), agent teams (independent sessions per domain), or memory-scoped skill invocation history.

    Security dimension (bonus point)

    Skill volume is also a security surface:

  • Park et al. (2026) "Agent Skills in the Wild": 31,132 analyzed public skills, 26.1% contain vulnerabilities, 14 vulnerability patterns; skills with executable scripts have double the vulnerability odds (OR = 2.12).
  • Snyk ToxicSkills: 13.4% critical issues among 3,984 skills. Li et al.: 157 confirmed malicious out of 98,380.
  • Anthropic added disableSkillShellExecution (2026-04); CVE-2026-25253 is the first agentic-AI-related CVE.
  • disable-model-invocation doubles as attack-surface reduction.
  • Interview answer framework

  • Bronze (fail): "Progressive disclosure solved it."
  • Silver (pass): identify all three mechanisms (char budget, n² dilution, disambiguation).
  • Gold (win): map mechanisms to phased fixes (Phase 0–3) plus security, and cite real-world validation (Thariq's namespace+path practice, the 100-skill selective-enablement case, the 235-skill repo).
  • The real test: it separates people who have read the docs from people who have been bitten by context rot in production.

    Sources

  • Anthropic Engineering Blog — Agent Skills (2025-10-16)
  • Anthropic PDF — Complete Guide to Building Skills for Claude
  • Claude Code Docs
  • Chroma Research — Context Rot (2025)
  • Liu et al., "Lost in the Middle" (TACL 2024)
  • Park et al., "Agent Skills in the Wild" (2026); Snyk ToxicSkills (2026); Li et al. (2026)
  • Thariq Shihipar, Claude Agent SDK Workshop (2026-01-14)
  • takuyanagai0213, Zenn (2025-11-27); alirezarezvani/claude-skills
  • GitHub issues anthropics/claude-code #22345, #51165
*Original research completed 2026-04-27 by the poster.*

Tags

#ai-interview#claude-code#agent-skills#context-rot#context-engineering#progressive-disclosure#llm#subagents

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177618825