cost-optimizer
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…
Skill by mergisi
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mergisi-cost-optimizer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: security, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/cost-optimizer
What's inside
- Skill name
cost-optimizer- Description
- 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.
- License
- MIT
- Instructions
- 116 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Cost Optimizer
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.
## When to use
- "My Claude Code bill doubled this month — what's going on?"
- "Audit this project for token waste"
- "Why is my session context always huge?"
- Post-mortem after a runaway agent run
## What to check
Run each check and record `PASS` / `WARN` / `FAIL` with a short note.
### 1. CLAUDE.md size
```bash
wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/null
```
- **PASS:** under 100 lines
- **WARN:** 100-300 lines
- **FAIL:** >300 lines — this is prepended to every message, so every line costs tokens forever.
Fix: move reference material (API keys, runbooks, verbose examples) into skill files or `docs/`, and leave CLAUDE.md as a thin pointer.
### 2. Memory file bloat
```bash
find ~/.claude/projects -name 'MEMORY.md' -exec wc -l {} \;
find .claude/memory -type f -exec wc -l {} \; 2>/dev/null
```
- **WARN** if any memory file is >500 lines.
- **FAIL** if >1500 lines — memory should be a curated index with links to detail files, not a dump.
Fix: extract old sections into `memory/<topic>.md` detail files and link from the index.
### 3. Unused or shadowed skills
```bash
ls ~/.claude/skills/ .claude/skills/ 2>/dev/null
```
- Cross-reference with the skill invocations in the last 30 days of shell history or session logs if available.
- Skills that have never been invoked but have huge `SKILL.md` bodies (>300 lines) are loaded into the skill index every turn — prune them.
### 4. Subagent fan-out patterns
Grep the project for Task/agent launch patterns:
```bash
grep -rn 'TaskCreate\|subagent\|parallel.*agent' --include='*.md' --include='*.js' --include='*.ts' .
```
- **WARN** if the repo spawns >5 parallel subagents per run without aggregation — each spins up its own context window.
- **FAIL** if subagents re-read the whole repo instead of receiving a scoped prompt.
Fix: pass a short brief + a handful of file paths to each subagent, not the entire CLAUDE.md context.
### 5. Prompt cache hygiene
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).
- **FAIL** any hook that injects `date` / `uuidgen` / random content into every turn — it kills the cache, 10x cost.
### 6. Model selection
Grep for explicit model pins:
```bash
grep -rn 'opus\|sonnet\|haiku\|claude-3\|claude-4' .claude/ CLAUDE.md 2>/dev/null
```
- **WARN** if Opus is pinned for routine tasks that Sonnet could handle. Recommend the `/model-cost-compare` skill for a per-task estimate.
### 7. Session file size
```bash
du -sh ~/.claude/projects/*/sessions 2>/dev/null | sort -h | tail -5
```
Huge session dirs suggest you never `/compact` long-running threads. Suggest periodic compaction.
## Output format
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.
## Example invocations
- `/cost-optimizer`
- "Audit this project for Claude Code cost waste"
- "My CLAUDE.md feels too big — what should I cut?"
- "Why is my prompt cache missing every turn?"From mergisi/awesome-openclaw-agents, MIT.
More from mergisi/awesome-openclaw-agents
- 0.663score
openclaw-debugger
mergisi
Trigger when an OpenClaw agent is broken, silent, crashing, stuck, not responding, returning empty output, or the user says "my agent is down", "agent not…
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
git-commit-writer
mergisi
Trigger when the user asks to write a commit message, generate a commit from staged changes, review a diff before committing, or says "/commit".
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
model-cost-compare
mergisi
Trigger when the user asks which model to use, wants to compare model costs, says "what's cheapest for this task", "should I use Opus or Sonnet", "can a…
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
excalidraw-architecture
mergisi
Trigger when the user asks for an architecture diagram, says "draw the system", "update the architecture diagram", "give me an excalidraw of this codebase"…
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
growth-ideas
mergisi
Describe your product or project and get three actionable growth ideas tailored to your stage.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
haiku-card
mergisi
Write a haiku about a topic and render it as a shareable card.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
meeting-notes
mergisi
Paste raw meeting notes and get a clean summary with key decisions and action items.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
pricing-advisor
mergisi
Describe your product and target customer, get a pricing strategy with three tiers and rationale.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
regex-builder
mergisi
Describe a text pattern in plain English and get a working regular expression with an explanation.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
tone-shifter
mergisi
Rewrite any text in a different tone — formal, casual, friendly, bold, or concise.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
code-explainer
mergisi
Paste any code snippet and get a plain English explanation of what it does and how it works.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
commit-message
mergisi
Generate a clean, conventional commit message from a description of your changes.
SkillDFreshness: D★ 4KClaude Code +9
Signals
- Stars
- 4,024
- Forks
- 643
- Open issues
- 26
- Last commit (this folder)
- Apr 13, 2026 (6 months ago)
- Last release
- Apr 4, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Website
- crewclaw.com
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.246score
cost-optimizer
heledmx-lab
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…
SkillDFreshness: DClaude Code +9 - 0.242score
cost-optimizer
TheophilusChinomona
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…
SkillDFreshness: DClaude Code +9
More from mergisi
- 0.663score
openclaw-debugger
mergisi
Trigger when an OpenClaw agent is broken, silent, crashing, stuck, not responding, returning empty output, or the user says "my agent is down", "agent not…
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
excalidraw-architecture
mergisi
Trigger when the user asks for an architecture diagram, says "draw the system", "update the architecture diagram", "give me an excalidraw of this codebase"…
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
git-commit-writer
mergisi
Trigger when the user asks to write a commit message, generate a commit from staged changes, review a diff before committing, or says "/commit".
SkillDFreshness: D★ 4KClaude Code +9 - 0.663score
model-cost-compare
mergisi
Trigger when the user asks which model to use, wants to compare model costs, says "what's cheapest for this task", "should I use Opus or Sonnet", "can a…
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
standup-summary
mergisi
Tell Gemma what you did, what you're working on, and any blockers.
SkillDFreshness: D★ 4KClaude Code +9 - 0.576score
sql-explainer
mergisi
Paste a SQL query and get a plain English explanation of what it does.
SkillDFreshness: D★ 4KClaude Code +9
Cite this page
cost-optimizer skill. Agent Mart. https://agentmart.dev/skills/mergisi-cost-optimizer (last updated 2026-10-24)