mcpbeat Sign in

Cost Optimizer Agent Skill

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.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
177
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/curiositech/some_claude_skills --skill cost-optimizer

The instruction itself

10 sections, as written by the author

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

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 Remaining | Action |

|-----------------|--------|

| >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

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.

Other skills for the same job

different authors, same section of the catalogue
Content Creator
by ComeOnOliver
×2

Create SEO-optimized marketing content with consistent brand voice. Includes brand voice analyzer, SEO optimizer, content frameworks, and social media templates. Use when writing blog posts, creating social media content, analyzing brand voice, optimizing SEO, planning content calendars, or when user mentions content creation, brand voice, SEO optimization, social media marketing, or content strategy.

17k tokens scripts
SEO Content Planner
by ComeOnOliver
×2

Creates comprehensive content outlines and topic clusters for SEO. Plans content calendars and identifies topic gaps. Use PROACTIVELY for content strategy and planning.

3k tokens
Crisis Response Protocol
by BioTender-max
×1

Handle mental health crisis situations in AI coaching safely. Use when implementing crisis detection, safety protocols, emergency escalation, or suicide prevention features. Activates for crisis keywords, safety planning, hotline integration, and risk assessment.

3k tokens
Social Content
by ComeOnOliver
×1

When the user wants help creating, scheduling, or optimizing social media content for LinkedIn, Twitter/X, Instagram, TikTok, Facebook, or other platforms. Also use when the user mentions 'LinkedIn post,' 'Twitter thread,' 'social media,' 'content calendar,' 'social scheduling,' 'engagement,' or 'viral content.' This skill covers content creation, repurposing, and platform-specific strategies.

9k tokens
Gtm Partnership Architecture
by github
vendor

Build and scale partner ecosystems that drive revenue and platform adoption. Use when building partner programs from scratch, tiering partnerships, managing co-marketing, making build-vs-partner decisions, or structuring crawl-walk-run partner deployment.

4k tokens
Monetization Strategy
by phuryn

Brainstorm 3-5 monetization strategies with audience fit, risks, and validation experiments. Use when exploring revenue models, evaluating pricing strategies, or deciding how to monetize a product.

2k tokens
Positioning Ideas
by phuryn

Brainstorm product positioning ideas differentiated from competitors. Identifies top competitors and generates positioning statements with rationale. Use when developing product positioning, differentiating from competitors, or crafting brand positioning strategy.

750 tokens
Campaign Plan
by anthropics
vendor

Generate a full campaign brief with objectives, audience, messaging, channel strategy, content calendar, and success metrics. Use when planning a product launch, lead-gen push, or awareness campaign, when you need a week-by-week content calendar with dependencies, or when translating a marketing goal into a structured, executable plan.

4k tokens

How to use it

Copy the folder

Take curiositech/cost-optimizer from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.