ワンクリックで
context-budget
Audit context usage across agents, skills, and MCP servers; recommend token savings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Audit context usage across agents, skills, and MCP servers; recommend token savings.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
1Password CLI (op) でサインイン・vault 確認・secret 注入を行う時に使う。Claude セッションでは service account token (OP_SERVICE_ACCOUNT_TOKEN) をtoken ファイル (~/.config/op/service-account-token) から直前注入する方式を使い、op read の stdout を Claude context に流さない方針を強制する。「op signin」「op service-account」「op read」「op run」「op inject」「1Password から取って」などで発火。
Browser automation for opening sites, forms, clicks, screenshots, scraping, login, and web app testing.
Run browser automation on AWS Bedrock AgentCore cloud browsers or AWS-hosted sessions.
Capture architecture decisions as ADRs with context, alternatives, and rationale.
不具合修正のワークフロー(調査→再現→修正→検証)を controller がオーケストレーションするための指揮書。バグ・不具合・障害の修正で使う。explorer で原因特定、implementer で再現テスト→修正、verifier で検証。「バグを直して」「不具合修正」「この障害を調査して直す」などで参照。
Create CodeTour `.tour` walkthroughs with file/line anchors.
| name | context-budget |
| description | Audit context usage across agents, skills, and MCP servers; recommend token savings. |
| origin | ECC |
| ecc-source | {"upstream-commit":"4e66b2882da9afb9747468b08a253ca2f09c85f3","upstream-path":"skills/context-budget/SKILL.md","imported-at":"2026-04-27T00:00:00+09:00","adapted":true} |
Analyze token overhead across every loaded component in a Claude Code session and surface actionable optimizations to reclaim context space.
/context-budget command (this skill backs it)Scan all component directories and estimate token consumption.
Delegate the raw scan to a haiku subagent (token-economy: the scan reads many files
whose contents you never reference again — keep them out of the main context). Use the
Agent tool with subagent_type="general-purpose", model="haiku" and instruct it to
measure and normalize, not to judge. The subagent does the file walk / line+token
counting / symlink resolution and returns structured data; the main context does Phase 2–4
(meaning-making). This mirrors the skill-stocktake precedent (mechanical work → haiku).
The haiku subagent prompt MUST include these instructions verbatim:
Symlink rule (apply to EVERY file before counting): run
readlink/ls -laon each file first. If it is a symlink, attribute it to its target's canonical path and do not count it again. The same applies to symlinked directories (e.g..claude/skills/foo -> .agents/skills/foo). This avoids DUPE false-positives in chezmoi-style setups that cross-link via symlinks.Return only measured/normalized data — make NO value judgments (no Always/Sometimes/ Rarely bucketing; that is the caller's job). Return:
- Normalized inventory rows:
canonical_path | type(agent|skill|mcp|claude.md) | lines | est_tokens | is_symlink | symlink_target(symlinks already collapsed onto their target, no double counts).- Flag candidates as RAW data only: agents >200 lines, descriptions >30 words, skills >400 lines, MCP servers >20 tools, CLAUDE.md chain total >300 lines.
- Category subtotals + grand total tokens.
Scope the subagent over these surfaces:
agents/*.md): lines + tokens (words × 1.3) per file, description frontmatter length.skills/*/SKILL.md): tokens per SKILL.md (symlinks collapsed onto target first)..mcp.json / active MCP config): server count + total tool count (~500 tok/tool rough; spread ~80–1.8k).@imports recursively.Preferred source of truth (applied in the main context, not delegated): run the
built-in /context command first. It reports authoritative live token counts per component
(system prompt, system tools, MCP tools, custom agents, memory files, skills, messages, free
space) for the current session. Treat the haiku subagent's words × 1.3 heuristics only as
a supplement (per-file breakdown, redundancy hints) — never override /context numbers with
heuristic estimates.
Sort every component into a bucket:
| Bucket | Criteria | Action |
|---|---|---|
| Always needed | Referenced in CLAUDE.md, backs an active command, or matches current project type | Keep |
| Sometimes needed | Domain-specific (e.g. language patterns), not referenced in CLAUDE.md | Consider on-demand activation |
| Rarely needed | No command reference, overlapping content, or no obvious project match | Remove or lazy-load |
Identify the following problem patterns:
Produce the context budget report:
Context Budget Report
═══════════════════════════════════════
Total estimated overhead: ~XX,XXX tokens
Context model: Claude Sonnet (200K window)
Effective available context: ~XXX,XXX tokens (XX%)
Component Breakdown:
┌─────────────────┬────────┬───────────┐
│ Component │ Count │ Tokens │
├─────────────────┼────────┼───────────┤
│ Agents │ N │ ~X,XXX │
│ Skills │ N │ ~X,XXX │
│ MCP tools │ N │ ~XX,XXX │
│ CLAUDE.md │ N │ ~X,XXX │
└─────────────────┴────────┴───────────┘
WARNING: Issues Found (N):
[ranked by token savings]
Top 3 Optimizations:
1. [action] → save ~X,XXX tokens
2. [action] → save ~X,XXX tokens
3. [action] → save ~X,XXX tokens
Potential savings: ~XX,XXX tokens (XX% of current overhead)
In verbose mode, additionally output per-file token counts, line-by-line breakdown of the heaviest files, specific redundant lines between overlapping components, and MCP tool list with per-tool schema size estimates.
Basic audit
User: /context-budget
Skill: Scans setup → 16 agents (12,400 tokens), 28 skills (6,200), 87 MCP tools (43,500), 2 CLAUDE.md (1,200)
Flags: 3 heavy agents, 14 MCP servers (3 CLI-replaceable)
Top saving: remove 3 MCP servers → -27,500 tokens (47% overhead reduction)
Verbose mode
User: /context-budget --verbose
Skill: Full report + per-file breakdown showing planner.md (213 lines, 1,840 tokens),
MCP tool list with per-tool sizes, duplicated rule lines side by side
Pre-expansion check
User: I want to add 5 more MCP servers, do I have room?
Skill: Current overhead 33% → adding 5 servers (~50 tools) would add ~25,000 tokens → pushes to 45% overhead
Recommendation: remove 2 CLI-replaceable servers first to stay under 40%
/context over heuristics: the built-in /context slash command gives
authoritative live token counts. Use this skill for what to do about them, not for
re-estimating numbers /context already knows.readlink / ls -la first and
attribute symlinks to their canonical target. Without this, every dotfiles repo that
cross-references rules via symlinks will produce false "DUPE" warnings./context isn't available, use words × 1.3 for
prose, chars / 4 for code-heavy files. Treat these as ±30% rough./context to see the
real per-tool numbers before recommending cuts.