Agent skill

Cost Optimizer

by curiositech in curiositech/some_claude_skills

Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget.

MITAuto-check passedAI & LLM Engineering

Install Cost Optimizer

skills CLI
$ npx skills add curiositech/some_claude_skills --skill cost-optimizer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install curiositech/some_claude_skills cost-optimizer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/curiositech/some_claude_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/cost-optimizer .claude/skills/cost-optimizer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cost-optimizer
GitHub stars
243
Token cost
~1.1k tokens
SKILL.md length
290 words
Files
2
Skills in repo
109
Repo updated
First seen
Licence
MIT

At a glance

Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget.

  • Managing execution budgets
  • SKILL.md covers When to Use, Budget Enforcement Process and Anti-Patterns
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Analyzing cost breakdowns

What it does

Cost Optimizer is an agent skill from curiositech/some_claude_skills. Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget. Downgrades models, skips optional nodes, or stops early when cost exceeds thresholds. Use when managing execution budgets, analyzing cost breakdowns, or optimizing model routing for cost. Activate on "cost budget", "too expensive", "reduce cost", "cost optimization", "model downgrade", "budget exceeded". NOT for LLM model selection logic (use llm-router), pricing comparisons across providers, or billing/invoicing.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `.claude-plugin/plugin.json`).

It sits in AI & LLM Engineering, covering Model routing and gateways and LLM cost and token optimization. The repository describes itself as: Claude skills that make my life easier. The licence is MIT.

When your agent uses it

  • Managing execution budgets
  • Analyzing cost breakdowns
  • Optimizing model routing for cost

Example prompts

  • “cost budget”
  • “too expensive”
  • “reduce cost”
  • “/cost-optimizer”

Requirements

  • Pre-approved tools (allowed-tools): Read, Grep

What it can do on your machine

Read from SKILL.md and the folder at commit 6713fc7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are mermaid and yaml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cost Optimizer loads about 1.1k tokens when it runs. Until then it costs about 134 tokens; SKILL.md has 290 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~134
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from curiositech/some_claude_skills at commit 6713fc7, republished under its MIT licence (© curiositech). 290 words, ~1,096 tokens.

Download SKILL.mdSave it as .claude/skills/cost-optimizer/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
cost-optimizer
description
Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget. Downgrades models, skips optional nodes, or stops early when cost exceeds thresholds. Use when managing execution budgets, analyzing cost breakdowns, or optimizing model routing for cost. Activate on "cost budget", "too expensive", "reduce cost", "cost optimization", "model downgrade", "budget exceeded". NOT for LLM model selection logic (use llm-router), pricing comparisons across providers, or billing/invoicing.
allowed-tools
Read, Grep
argument-hint
[dag-id] [budget-usd]
metadata.tags
cost, optimizer, cost-budget, too-expensive, reduce-cost

Cost Optimizer

Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget: downgrade models, skip optional nodes, or stop early.


When to Use

✅ Use for:

  • Setting and enforcing cost budgets for DAG executions
  • Real-time cost monitoring during execution
  • Deciding when to downgrade model tiers mid-execution
  • Identifying which nodes are most expensive and why
  • Post-execution cost analysis and optimization recommendations

❌ NOT for:

  • Choosing which model to use per node (use llm-router)
  • Provider pricing comparisons (static data, not a skill)
  • Billing or invoicing features

Budget Enforcement Process

mermaid
flowchart TD
  N[Node about to execute] --> C[Check: spent + estimated_node_cost vs budget]
  C --> S{Within budget?}
  S -->|Yes, >20% remaining| E[Execute at planned model tier]
  S -->|Yes, <20% remaining| W[Execute but downgrade to Tier 1 if possible]
  S -->|No| D{Node optional?}
  D -->|Yes| SK[Skip node]
  D -->|No| H{Human gate available?}
  H -->|Yes| A[Ask human: continue over budget?]
  H -->|No| ST[Stop execution, return partial results]
Budget Tiers
Budget RemainingAction
>50%Execute at planned model tier
20-50%Log warning. Continue at planned tier.
10-20%Downgrade remaining Tier 2 nodes to Tier 1 (Haiku)
5-10%Downgrade ALL remaining nodes to Tier 1. Skip optional nodes.
<5%Stop execution unless next node is critical path
0%Stop. Return partial results with cost breakdown.
Cost Estimation Per Node

Before each node executes, estimate its cost:

estimated_cost = (avg_input_tokens × input_price + avg_output_tokens × output_price)

Use historical averages for this skill + model combination. If no history, use defaults:

  • Tier 1 (Haiku): ~800 input + 400 output = ~$0.001
  • Tier 2 (Sonnet): ~2000 input + 1000 output = ~$0.012
  • Tier 3 (Opus): ~3000 input + 1500 output = ~$0.16
Post-Execution Report
yaml
cost_report:
  total_budget: 0.50
  total_spent: 0.37
  budget_remaining: 0.13
  nodes_executed: 8
  nodes_skipped: 1
  nodes_downgraded: 2
  model_breakdown:
    haiku: { calls: 4, cost: 0.004 }
    sonnet: { calls: 3, cost: 0.036 }
    opus: { calls: 1, cost: 0.33 }
  savings_recommendations:
    - "Node 'deep-analysis' used Opus ($0.33) but downstream accepted on first try. Try Sonnet next time — potential saving: $0.32"
    - "Nodes 'validate-a' and 'validate-b' are sequential but independent. Parallelize to reduce wall-clock time."

Anti-Patterns

No Budget at All

Wrong: Running DAGs without any cost tracking until the API bill arrives. Right: Every DAG execution has a budget, even if generous. Track spend per node.

Aggressive Downgrading

Wrong: Downgrading Opus nodes to Haiku at 50% budget remaining, causing quality failures that trigger expensive retries. Right: Only downgrade when the alternative is stopping execution. Retries cost more than the original model tier.

Ignoring Retries in Cost

Wrong: Budgeting for one attempt per node. Right: Budget for avg_retries × cost_per_attempt. A node with 3 retries on Sonnet costs $0.036, not $0.012.

© curiositech, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .claude/skills/cost-optimizer of curiositech/some_claude_skills.

  • SKILL.md
  • .claude-plugin/plugin.json

Open the folder on GitHubat commit 6713fc7

Compare with similar skills

Cost Optimizer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cost Optimizer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cost Optimizer this skillcuriositech/some_claude_skills243—~1.1kAutomated safety check: PassMIT
Cost TrackingHabitat-Thinking/ai-literacy-superpowers114—~1.7kAutomated safety check: PassCustom licence
Cost Aware LLM Pipelinemajiayu000/claude-skill-registry6666 repos~1.4kAutomated safety check: PassMIT
Token OptimizerLeoYeAI/openclaw-master-skills2.2k—~4.2kAutomated safety check: PassMIT
Token OptimizerLeoYeAI/openclaw-master-skills2.2k—~5.2kAutomated safety check: PassMIT
Openrouter Context Optimizationjeremylongshore/tons-of-skills-marketplace2.8k—~2.4kAutomated safety check: PassMIT

Similar skills

  • Cost Tracking

    Habitat-Thinking/ai-literacy-superpowers

    A skill your agent uses when the user wants to capture AI tool costs, review spending trends, set cost budgets, or integrate cost data into health snapshots — guides quarterly cost capture, records…

    114 GitHub stars~1.7k tokensUpdated 18 days ago
    AI & LLM EngineeringAuto-check passed
  • Cost Aware LLM Pipeline

    majiayu000/claude-skill-registry

    Cost optimization patterns for LLM API usage — model routing by task complexity, budget tracking, retry logic, and prompt caching.

    666 GitHub starsUsed in 6 repos~1.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Token Optimizer

    LeoYeAI/openclaw-master-skills

    Reduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and multi-provider fallbacks.

    2.2k GitHub stars~4.2k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Token Optimizer

    LeoYeAI/openclaw-master-skills

    Reduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL…

    2.2k GitHub stars~5.2k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Openrouter Context Optimization

    jeremylongshore/tons-of-skills-marketplace

    Optimize context window usage for OpenRouter models to reduce cost and improve quality.

    2.8k GitHub stars~2.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Anth Cost Tuning

    jeremylongshore/tons-of-skills-marketplace

    Optimize Anthropic Claude API costs with model routing, prompt caching, batching, and spend monitoring.

    2.8k GitHub stars~2.1k tokensUpdated today
    AI & LLM EngineeringAuto-check passed

More from curiositech/some_claude_skills

All 109 skills in this repo
  • Crisis Detection Intervention AI

    curiositech/some_claude_skills

    Detect crisis signals in user content using NLP, mental health sentiment analysis, and safe intervention protocols.

    243 GitHub starsUsed in 3 repos~3.8k tokens
    Auto-check passed
  • Form Validation Architect

    curiositech/some_claude_skills

    End-to-end form handling with react-hook-form, Zod schemas, validation patterns, error messaging, field arrays, and multi-step wizards.

    243 GitHub stars~3.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Competitive Cartographer

    curiositech/some_claude_skills

    Strategic analyst that maps competitive landscapes, identifies white space opportunities, and provides positioning recommendations.

    243 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • GitHub Actions Pipeline Builder

    curiositech/some_claude_skills

    Build production CI/CD pipelines with GitHub Actions. An agent skill from curiositech/some_claude_skills.

    243 GitHub stars~2.8k tokensUpdated 1 mo ago
    Auto-check: notes
  • Computer Vision Pipeline

    curiositech/some_claude_skills

    Build production computer vision pipelines for object detection, tracking, and video analysis.

    243 GitHub starsUsed in 1 repo~4k tokens
    Auto-check passed
  • Design Archivist

    curiositech/some_claude_skills

    Long-running design anthropologist that builds comprehensive visual databases from 500-1000 real-world examples, extracting color palettes, typography patterns, layout systems, and interaction…

    243 GitHub starsUsed in 1 repo~1.6k tokens
    Auto-check passed

Questions about Cost Optimizer

What does Cost Optimizer do?

Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget. Cost Optimizer is an agent skill from curiositech/some_claude_skills. Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget.

When should I use Cost Optimizer?

Cost Optimizer fits situations like: managing execution budgets; analyzing cost breakdowns; optimizing model routing for cost.

How do I install Cost Optimizer in Claude Code?

Run `npx skills add curiositech/some_claude_skills --skill cost-optimizer -a claude-code`. Or copy the skill folder (.claude/skills/cost-optimizer in curiositech/some_claude_skills) into .claude/skills/cost-optimizer in your project. Claude Code loads it when a task matches its description.

How do I install Cost Optimizer in Codex?

Run `npx skills add curiositech/some_claude_skills --skill cost-optimizer -a codex`. Or copy the skill folder (.claude/skills/cost-optimizer in curiositech/some_claude_skills) into .agents/skills/cost-optimizer in your project. Codex loads it when a task matches its description.

Can I use Cost Optimizer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add curiositech/some_claude_skills --skill cost-optimizer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cost-optimizer, .gemini/skills/cost-optimizer, .github/skills/cost-optimizer and .opencode/skills/cost-optimizer in your project.

What does Cost Optimizer need to run?

SKILL.md names no scripts, command-line tools or credentials: Cost Optimizer is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Grep.

Does Cost Optimizer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Cost Optimizer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cost Optimizer use?

Cost Optimizer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cost Optimizer use?

About 1.1k tokens (SKILL.md is roughly 4.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Cost Optimizer?

Skills that share tags, products or a category with Cost Optimizer: Cost Tracking (Habitat-Thinking/ai-literacy-superpowers, 114 stars), Cost Aware LLM Pipeline (majiayu000/claude-skill-registry, 666 stars), Token Optimizer (LeoYeAI/openclaw-master-skills, 2.2k stars) and Token Optimizer (LeoYeAI/openclaw-master-skills, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cost Optimizer?

curiositech (a GitHub organization) maintains it in curiositech/some_claude_skills, which has 243 GitHub stars. The repository holds 109 skills in this directory. The repository was last updated on September 6, 2026.

Source: curiositech/some_claude_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.