/engineering-advanced-skills:llm-cost-optimizerfrom engineering-advanced-skills
Estimates LLM token counts and per-request cost across models, flags wasteful prompt text, and models prompt-cache break-even. Use when budgeting LLM spend, comparing models on cost, or trimming prompt tokens.
Ships in engineering-advanced-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The agent turns "what will this cost?" into a number with its assumptions shown: estimated tokens, cost per request and per 1,000 requests by model, savings from caching, and prompt text that costs tokens without changing the result. The built-in price table is an illustrative snapshot, not verified current pricing: for real numbers, copy rates from each provider's pricing page into a JSON file and pass it with --prices FILE (shape: assets/sample_prices.json).
The LLM Cost Optimizer skill provides tools for counting tokens, estimating costs across different LLM providers, and optimizing prompts to reduce token usage without sacrificing quality. Essential for teams managing LLM API budgets at scale.
Before estimating or optimizing, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
--file/--text/--stdin).--models and the pricing comparison).token_counter.py vs prompt_optimizer.py and sets --target-reduction).Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
# Count tokens and estimate costs. Built-in prices are illustrative; real numbers come from --prices FILE
python3 scripts/token_counter.py --text "Summarize the attached contract in five bullets." --models claude-opus-5-5 claude-sonnet gpt-4o-mini
# Count tokens from stdin
echo "Hello world" | python3 scripts/token_counter.py --stdin --models all
# Costs from your own price file (copy current rates from the providers' pricing pages)
python3 scripts/token_counter.py --file assets/sample_prompt.txt --prices assets/sample_prices.json
# Analyze a prompt: three findings, one per line (role preamble, CoT scaffold, all-caps emphasis)
python3 scripts/prompt_optimizer.py --file assets/sample_prompt.txt
Exit codes: 0 report produced; 2 unusable input (missing file, empty input, invalid numbers, unreadable --prices).
| Tool | Purpose | Key Flags |
|---|---|---|
token_counter.py | Count tokens and estimate costs across models | --file, --text, --stdin, --models, --output-ratio, --prices FILE |
prompt_optimizer.py | Analyze prompts for token reduction opportunities | --file, --target-reduction, --format |
cache_savings_calculator.py | Model prompt-cache economics: naive vs cached cost, break-even reuse, % savings | --requests, --cached-tokens, --cache-write-multiplier, --cache-read-multiplier, --base-input-price, --json |
token_counter.py with target modelsprompt_optimizer.py on eachIn Scope:
token_counter.py's built-in catalog, using an assumed output/input ratio (--output-ratio, default 1.5).prompt_optimizer.py: repeated content, filler phrases, redundant instructions and formatting overhead, with estimated savings checked against an optional --target-reduction.cache_savings_calculator.py: naive versus cached cost, break-even reuse count and percentage savings from user-supplied prices and multipliers.references/.Out of Scope:
engineering/agentic-evaluation-framework/).engineering/batch-api-orchestrator/) or designing context and memory management (see engineering/context-engine/).engineering/prompt-governance/).Important Caveats:
token_counter.py and references/llm-pricing-guide.md are an illustrative snapshot assembled in Q1 2026 and not verified against current provider pages. Use --prices FILE with rates from each provider's pricing page for any budget decision.prompt_optimizer.py lists suggested edits. It does not rewrite the prompt or judge whether a removed phrase mattered, so each change needs a quality check against the original.Mistake: Budgeting from the built-in price snapshot.
Why it matters: Prices and model lines change several times a year; a stale table can be off by a factor of two or more.
Instead: Pass --prices with rates copied from each provider's pricing page, and record the date.
Mistake: Picking the cheapest model from a one-request estimate. Why it matters: At small sizes every model rounds to fractions of a cent; quality differences cost far more than the token bill. Instead: Compare per-1K-request cost at real volume, and only among models that pass the quality bar.
Mistake: Applying every optimizer suggestion. Why it matters: Some "redundant" text carries meaning; removing it can lower quality more than it saves. Instead: Apply edits, then run the prompt's eval suite before shipping the shorter version.
cache_savings_calculator.pyassets/sample_prices.json (opens in a new tab)assets/sample_prompt.txt (opens in a new tab)references/caching-and-batch-economics.md (opens in a new tab)references/llm-pricing-guide.md (opens in a new tab)scripts/cache_savings_calculator.py (opens in a new tab)scripts/prompt_optimizer.py (opens in a new tab)scripts/token_counter.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub borghei/claude-skills --plugin engineering-advanced-skills100 skills in this plugin
/a11y-auditStatic WCAG scan of HTML files (alt text, headings, labels, ARIA, lang, landmarks) and colour contrast checks for colour pairs or CSS. Use when auditing templates for accessibility, checking contrast, or adding an a11y gate to CI.
/agent-designerDesigns multi-agent system architectures with orchestration patterns, tool schemas, and performance evaluation. Use when building AI agent systems, designing agent workflows, creating tool schemas, or evaluating agent performance.
/agent-harnessTest and evaluation harness for AI agents — scenario suites, deterministic replay, regression diffing, cost and latency budgets. Use when agent quality is vibe-checked, before shipping a prompt or model change, or when evals drift.
Other plugins' skills for the same job