Trigger when the user asks to audit Claude Code costs, reduce token spend, says "my Claude bill is too high", "optimize my CLAUDE.md", "why is this project burning tokens", or "/cost-optimizer". Scans a project for the common Claude Code cost leaks and returns a prioritized fix list.
76
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Audit a project's Claude Code setup for the handful of well-known cost leaks and output a prioritized remediation list. This is a static inspection — no pricing API calls, no guesswork about past spend.
Run each check and record PASS / WARN / FAIL with a short note.
wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/nullFix: move reference material (API keys, runbooks, verbose examples) into skill files or docs/, and leave CLAUDE.md as a thin pointer.
find ~/.claude/projects -name 'MEMORY.md' -exec wc -l {} \;
find .claude/memory -type f -exec wc -l {} \; 2>/dev/nullFix: extract old sections into memory/<topic>.md detail files and link from the index.
ls ~/.claude/skills/ .claude/skills/ 2>/dev/nullSKILL.md bodies (>300 lines) are loaded into the skill index every turn — prune them.Grep the project for Task/agent launch patterns:
grep -rn 'TaskCreate\|subagent\|parallel.*agent' --include='*.md' --include='*.js' --include='*.ts' .Fix: pass a short brief + a handful of file paths to each subagent, not the entire CLAUDE.md context.
Look for .claude/settings.json and check if the project sets an unusually short cache TTL, or if hooks invalidate the cache every message (e.g. a hook that echoes a timestamp into the system prompt).
date / uuidgen / random content into every turn — it kills the cache, 10x cost.Grep for explicit model pins:
grep -rn 'opus\|sonnet\|haiku\|claude-3\|claude-4' .claude/ CLAUDE.md 2>/dev/null/model-cost-compare skill for a per-task estimate.du -sh ~/.claude/projects/*/sessions 2>/dev/null | sort -h | tail -5Huge session dirs suggest you never /compact long-running threads. Suggest periodic compaction.
Print a ranked list. Top of the list = biggest win per effort.
Cost Optimizer — <project>
Priority 1 (FAIL)
[CLAUDE.md] 412 lines — prepended every turn. Extract sections into skills/.
[cache hygiene] .claude/settings.json hook injects `date +%s` on SessionStart. Remove it.
Priority 2 (WARN)
[memory] MEMORY.md is 820 lines. Index top, details linked.
[model pinning] Opus 4.6 pinned in 4 skill files — 2 could drop to Sonnet 4.6.
Priority 3 (nice-to-have)
[skills] 3 skills (haiku-card, foo, bar) never invoked in last 30 days.
Estimated impact: roughly halving per-turn overhead — validate with a before/after /cost check.Do not invent dollar savings. You can estimate relative impact ("~30% smaller context") but not absolute currency unless the user provides their current bill.
/cost-optimizer05820c5
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.