From claude-slim
Analyzes Claude Code environment for token waste in skills, plugins, memory files, and CLAUDE.md; proposes and performs safe cleanups with user approval. Invoke via /claude-slim for token optimization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-slim:claude-slimThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze the user's Claude Code environment for token waste and perform non-destructive cleanup.
Analyze the user's Claude Code environment for token waste and perform non-destructive cleanup.
/claude-slim or /claude-slim run → full pipeline (scan → propose → execute → report)/claude-slim scan → report only, no changes/claude-slim scan --json → raw JSON output/claude-slim doctor → check scanner prerequisites and session-log signal quality/claude-slim restore → restore previously disabled itemsRun the CLI to collect environment data:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js scan --json
If CLAUDE_PLUGIN_ROOT is not set:
PLUGIN_DIR=$(find ~/.claude/plugins -path "*/claude-slim/dist/cli.js" -type f 2>/dev/null | head -1 | xargs dirname | xargs dirname)
cd "$PLUGIN_DIR" && node dist/cli.js scan --json
If node is not available, fall back to the legacy bash scanner:
bash "${CLAUDE_PLUGIN_ROOT}/skills/claude-slim/scripts/scan.sh"
After getting the scan JSON, YOU must interpret and present results to the user. Do NOT just dump raw CLI output. Present a full diagnostic report in the user's language.
Templates below are shown in English for readability. Always translate headers, labels, and prompts into the user's detected language when rendering.
Show a summary table:
| Item | Count | Tokens |
|---|---|---|
| Local skills | N (XKB) | X tok |
| Plugins | N (M skills) | ~X tok |
| CLAUDE.md | XKB | X tok |
| Memory files | N (XKB) | ~X tok |
| Session startup overhead | ~X tok |
List each plugin with skill count and a judgment:
| Plugin | Skills | Notes |
|---|---|---|
| omc | 36 | Core plugin. Keep. |
| temp_local_... | 1 | Failed install remnant. Cleanup target. |
Annotate each with status: actively used, possibly unused, or cleanup target. Flag temp_local_* entries as failed install remnants.
Group issues by tier and explain EACH one with context and recommendation:
Tier 1 — Immediate cleanup (zero risk): These are safe to remove with zero risk: broken symlinks, empty templates, .skill/ duplicates, temp_local_* cache. Pre-selected. Explain why each is safe.
Tier 2 — Recommended cleanup: These are recommended but need user judgment. For each issue, explain:
Example: "frontend-design exists both locally and in a plugin. Removing the local copy is safe because the plugin version remains. Saves ~823 tok."
Tier 3 — Optional (user judgment): These are large skills that cost tokens but might be in active use. For each:
End with a numbered action list, ordered by impact:
Show estimated total token savings if all recommended actions are taken.
If subcommand is scan, stop here. Ask a localized equivalent of "Proceed with cleanup?" only for the full pipeline.
Run the interactive clean command:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js clean
Or with dry-run:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js clean --dry-run
After cleanup, re-run scan to get updated numbers, then show the savings report:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js report
Present the report box AND the before/after breakdown table to the user.
When /claude-slim restore is invoked:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js restore
When /claude-slim doctor is invoked:
cd "${CLAUDE_PLUGIN_ROOT}" && node dist/cli.js doctor
Explain warnings in the user's language. Pay special attention to session-log warnings because they explain why unused-skill detection may be suppressed.
Detect the user's language from their most recent message. Present all reports, analysis, and explanations in that language — including table headers, tier labels, prompts, and every user-facing string. The CLI output is machine-readable (always English) and must not be echoed verbatim; translate its content into the user's language when you interpret it. The example tables above are written in English only for authoring clarity — do not treat them as a required output format.
~/.claude/skills.disabled/; dead symlink files and failed-install temp_local_* caches are permanent cleanups and should be described that way.--dry-run to preview changes.npx claudepluginhub iops-leo/claude-slim --plugin claude-slimAudits Claude Code or Codex setup for context window waste, recovers 5–25% via config cleanup and compaction.
Audits Claude Code setup for token waste and context bloat. Checks MCP servers, CLAUDE.md, skills, and settings. Trigger with 'audit my context', 'usage audit', or similar phrases.
Optimizes .claude/ configurations to cut token usage: compresses CLAUDE.md under 150 lines, deduplicates content, prunes unused skills with confirmation, extracts verbose sections to on-demand skills. Requires prior /evaluate.