cost

GitHub

追踪AI构建成本,按功能/模型分析支出,提供优化建议与预算预测。辅助用户记录Token消耗,识别高耗任务,推荐更经济的模型或架构调整策略,实现AI使用降本增效。

skills/cost/SKILL.md Houseofmvps/ultraship

Trigger Scenarios

用户希望了解AI使用花费 需要分析各功能模块的AI成本 寻求降低AI调用费用的建议 规划AI使用预算

Install

npx skills add Houseofmvps/ultraship --skill cost -g -y
More Options

Use without installing

npx skills use Houseofmvps/ultraship@cost

指定 Agent (Claude Code)

npx skills add Houseofmvps/ultraship --skill cost -a claude-code -g -y

安装 repo 全部 skill

npx skills add Houseofmvps/ultraship --all -g -y

预览 repo 内 skill

npx skills add Houseofmvps/ultraship --list

SKILL.md

Frontmatter
{
    "name": "cost",
    "description": "AI Build Cost Tracker — track how much AI is costing you per feature. Use when user wants to track AI spending, understand cost per feature, optimize AI usage, or budget their Claude\/GPT costs.",
    "allowed-tools": "Bash, Read, Write, Grep"
}

AI Build Cost Tracker

Know exactly what each feature costs to build with AI. Budget smarter, spend less.

Process

Phase 1: Show Current State

node ${CLAUDE_PLUGIN_ROOT}/tools/cost-tracker.mjs <project-directory> show

Parse the JSON output for cost history and summary.

Phase 2: Cost Dashboard

Present spending overview:

Total Spend:

  • All-time total cost
  • This week / this month breakdown
  • Average cost per task

By Task/Feature:

  • Ranked list of features by cost (most expensive first)
  • Flag any outliers (tasks costing 3x+ the average)

By Model:

  • Cost breakdown by AI model used
  • Potential savings from model switching

Daily Trend:

  • Last 30 days of daily spending
  • Identify high-spend days

Phase 3: Cost Insights

Generate actionable insights:

  1. Where money goes — what types of tasks cost the most (debugging? features? refactoring?)
  2. Optimization opportunities — tasks that could use a cheaper model
  3. Budget projection — at current rate, monthly spend estimate
  4. Cost per line of code — rough estimate based on git diff

Phase 4: Logging New Costs

To log a new cost entry:

node ${CLAUDE_PLUGIN_ROOT}/tools/cost-tracker.mjs <project-directory> log "<label>" <input_tokens> <output_tokens> --model=claude-opus-4-6

Labels should be descriptive kebab-case: auth-feature, bug-fix-login, refactor-api, seo-optimization

Phase 5: Recommendations

Based on spending patterns:

If debugging > 30% of spend:

  • "Consider investing in more tests upfront — debugging is your biggest cost driver"
  • Suggest running /test-driven-development skill

If a single task > 3x average:

  • "The [task] cost $X — consider breaking large tasks into smaller chunks"

Model optimization:

  • "Routine refactoring with Sonnet instead of Opus would save ~$X/month"
  • "Code review tasks can use Haiku — potential savings of ~$X/month"

Logging Guide

Help the user understand when and how to log costs:

  • Log at the END of each task/feature (not during)
  • Use consistent labels across sessions
  • Include ALL tokens (input + output) from the conversation
  • Estimate if exact numbers aren't available (Claude Code shows token usage in the UI)

Phase 6: Build vs. Buy Framework

When reviewing cost data, help the user think about the economics of building with AI:

Worth building with AI (high ROI):

  • Features that would take 2+ days manually but 2 hours with AI
  • Boilerplate-heavy work (CRUD, migrations, test suites, API endpoints)
  • Exploration and prototyping (try 3 approaches, keep the best one)

Consider alternatives:

  • If a feature costs >$100 in AI tokens, check if a library or SaaS already does it
  • If debugging the same issue costs >$20 in AI tokens, the root cause is architectural — fix the architecture, not the symptom
  • If AI-generated code needs significant manual correction, the prompt needs work, not more tokens

Cost benchmarks for solo founders:

Task Type Expected Cost If Higher, Investigate
New API endpoint $1-5 Complex business logic or unclear spec
Bug fix $0.50-3 Missing tests or hard-to-reproduce issue
Full feature (frontend + backend) $5-20 Large scope or frequent rework
Refactoring $2-10 Unclear boundaries or missing tests
Content/copy generation $0.25-1 Too many revision cycles

Key Principles

  • AI is an investment, not a cost. The goal isn't to minimize spend — it's to maximize ROI. A $50 feature that generates $5K MRR is a great investment. But a $50 bug fix that should have cost $5 with better tests is waste.
  • Track to learn, not to punish. Cost data reveals where your process is inefficient. High debugging costs mean insufficient tests. High rework costs mean unclear specs.
  • Optimize the expensive tasks, not the cheap ones. Switching from Opus to Haiku for a $0.10 task saves nothing. Reducing a $50 debugging session by improving test coverage saves real money.

Version History

  • ed232cb Current 2026-07-24 16:15

Same Skill Collection

skills/a11y/SKILL.md
skills/architecture/SKILL.md
skills/brainstorming/SKILL.md
skills/canary/SKILL.md
skills/clone-patterns/SKILL.md
skills/code-review/SKILL.md
skills/compete/SKILL.md
skills/demo/SKILL.md
skills/deploy/SKILL.md
skills/dispatching-parallel-agents/SKILL.md
skills/evals/SKILL.md
skills/executing-plans/SKILL.md
skills/finishing-a-development-branch/SKILL.md
skills/frontend-design/SKILL.md
skills/grow/SKILL.md
skills/guard/SKILL.md
skills/index-fix/SKILL.md
skills/investigate/SKILL.md
skills/launch/SKILL.md
skills/learn/SKILL.md
skills/onboard/SKILL.md
skills/pentest/SKILL.md
skills/perf-audit/SKILL.md
skills/receiving-code-review/SKILL.md
skills/release/SKILL.md
skills/requesting-code-review/SKILL.md
skills/rescue/SKILL.md
skills/retro/SKILL.md
skills/revise-claude-md/SKILL.md
skills/security-audit/SKILL.md
skills/seo-audit/SKILL.md
skills/seo-strategy/SKILL.md
skills/ship-gate/SKILL.md
skills/sprint/SKILL.md
skills/staying-current/SKILL.md
skills/subagent-driven-development/SKILL.md
skills/systematic-debugging/SKILL.md
skills/test-driven-development/SKILL.md
skills/using-git-worktrees/SKILL.md
skills/using-ultraship/SKILL.md
skills/verification-before-completion/SKILL.md
skills/visual-diff/SKILL.md
skills/writing-plans/SKILL.md
skills/writing-skills/SKILL.md

Metadata

Files
0
Version
ed232cb
Hash
b4969e5f
Indexed
2026-07-24 16:15

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:09
浙ICP备14020137号-1 $mapa de visitantes$