Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Cost Tracking

  • 2.2k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/everything-claude-code

cost-tracking reports Claude Code usage and spend from the local cost-tracker SQLite database.

About

The cost-tracking skill analyzes Claude Code cost and usage history from a local SQLite database at ~/.claude-cost-tracker/usage.db written by cost tracking hooks or plugins. Japanese SKILL.md documents activation when users ask how much they spent, session cost, token usage, budget limits, overages, or breakdowns by project, tool, session, model, or date including today vs yesterday trends and CSV export of recent records. Agents verify prerequisites exist before querying. Rescued from community PR #1304. Use when users track Claude Code spend locally rather than cloud billing dashboards alone. Queries local SQLite usage.db for Claude Code token and cost history Breakdowns by project, tool, session, model, and date ranges Budget, spend limit, and overage reporting when data exists Today vs yesterday comparisons and recent usage CSV export Requires cost tracking hook writing to ~/.claude-cost-tracker/usage.db cost-tracking reports Claude Code usage and spend from the local cost-tracker SQLite database Cost and token report by session, project, tool, model, or date from local DB User asks session cost, token usage, budget, or Claude Code spend

  • Queries local SQLite usage.db for Claude Code token and cost history.
  • Breakdowns by project, tool, session, model, and date ranges.
  • Budget, spend limit, and overage reporting when data exists.
  • Today vs yesterday comparisons and recent usage CSV export.
  • Requires cost tracking hook writing to ~/.claude-cost-tracker/usage.db.

Cost Tracking by the numbers

  • 2,198 all-time installs (skills.sh)
  • +217 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #224 of 3,282 Productivity & Planning skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

cost-tracking capabilities & compatibility

Capabilities
spend reporting · token breakdowns · budget monitoring · trend comparison · csv export
Use cases
token optimization · planning
npx skills add https://github.com/affaan-m/everything-claude-code --skill cost-tracking

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.2k
repo stars238k
Security audit3 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryaffaan-m/everything-claude-code

How much have I spent on Claude Code and how is usage broken down?

Report Claude Code token usage, spend, and budget breakdowns from the local ~/.claude-cost-tracker/usage.db SQLite database.

Who is it for?

Users with cost tracking hooks populating ~/.claude-cost-tracker/usage.db.

Skip if: Cloud API billing without local Claude Code usage.db records.

When should I use this skill?

User asks session cost, token usage, budget, or Claude Code spend breakdown.

What you get

Cost and token report by session, project, tool, model, or date from local DB.

  • spending reports
  • token usage summaries
  • project cost breakdowns

By the numbers

  • Reads usage from SQLite at ~/.claude-cost-tracker/usage.db
  • Salvaged from stale community PR #1304 by MayurBhavsar

Files

SKILL.mdMarkdownGitHub ↗

コスト追跡

このスキルを使用して、ローカルSQLiteデータベースからClaude Codeのコストと使用履歴を分析します。これは、~/.claude-cost-tracker/usage.dbに使用行を書き込むコスト追跡フックまたはプラグインをすでに持っているユーザーを対象としています。

出典: MayurBhavsarによるコミュニティのPR #1304から救済されました。

使用時期

  • ユーザーが「いくら使いましたか?」「このセッションのコストは?」「トークン使用量は?」と尋ねる場合
  • ユーザーが予算、支出制限、超過、またはコスト管理について言及する場合
  • ユーザーがプロジェクト、ツール、セッション、モデル、または日付ごとのコスト内訳を求める場合
  • ユーザーが今日と昨日を比較したい、または最近のトレンドを確認したい場合
  • ユーザーが最近の使用記録のCSVエクスポートを求める場合

動作方法

まず前提条件を確認します:

command -v sqlite3 >/dev/null && echo "sqlite3 available" || echo "sqlite3 missing"
test -f ~/.claude-cost-tracker/usage.db && echo "Database found" || echo "Database not found"

データベースが見つからない場合、使用データを作成しません。ユーザーにコスト追跡が設定されていないことを伝え、信頼できるローカルコスト追跡フック/プラグインのインストールまたは有効化を提案します。

期待されるusageテーブルには通常、ツール呼び出しまたはモデルインタラクションごとに1行が含まれます。列名はトラッカーによって異なりますが、以下の例では次のように仮定します:

意味
timestamp使用イベントのISOタイムスタンプ
projectプロジェクトまたはリポジトリ名
tool_nameツールまたはイベント名
input_tokens記録された場合の入力トークン数
output_tokens記録された場合の出力トークン数
cost_usdUSDで事前計算されたコスト
session_idClaude Codeセッション識別子
modelイベントに使用されたモデル

cost_usdを使用して手動で価格計算するよりも優先します。モデルの価格とキャッシュ価格は時間とともに変化し、トラッカーが各行の価格設定の信頼できる情報源であるべきです。

クイックサマリー

sqlite3 ~/.claude-cost-tracker/usage.db "
  SELECT
    'Today: $' || ROUND(COALESCE(SUM(CASE WHEN date(timestamp) = date('now') THEN cost_usd END), 0), 4) ||
    ' | Total: $' || ROUND(COALESCE(SUM(cost_usd), 0), 4) ||
    ' | Calls: ' || COUNT(*) ||
    ' | Sessions: ' || COUNT(DISTINCT session_id)
  FROM usage;
"

プロジェクト別コスト

sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
  SELECT project, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
  FROM usage
  GROUP BY project
  ORDER BY cost DESC;
"

ツール別コスト

sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
  SELECT tool_name, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
  FROM usage
  GROUP BY tool_name
  ORDER BY cost DESC;
"

過去7日間

sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
  SELECT date(timestamp) AS date, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
  FROM usage
  GROUP BY date(timestamp)
  ORDER BY date DESC
  LIMIT 7;
"

セッション詳細

sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
  SELECT session_id,
    MIN(timestamp) AS started,
    MAX(timestamp) AS ended,
    ROUND(SUM(cost_usd), 4) AS cost,
    COUNT(*) AS calls
  FROM usage
  GROUP BY session_id
  ORDER BY started DESC
  LIMIT 10;
"

レポートガイダンス

コストデータを表示する場合、以下を含めます:

1. 今日の支出と昨日の比較。 2. 追跡されたデータベース全体の合計支出。 3. コスト順にランク付けされた上位プロジェクト。 4. コスト順にランク付けされた上位ツール。 5. 十分なデータがある場合のセッション数とセッションごとの平均コスト。

少額の場合、通貨を小数点4桁でフォーマットします。大きな金額には2桁で十分です。

アンチパターン

  • cost_usdが存在する場合に生のトークン数からコストを推定しないこと。
  • 確認せずにデータベースが存在すると仮定しないこと。
  • 大規模なデータベースで無制限のSELECT *エクスポートを実行しないこと。
  • ユーザー向けの回答で現在のモデル価格をハードコードしないこと。
  • 任意のコードを実行する未審査のフックやプラグインのインストールを推奨しないこと。

関連

  • /cost-report - 同じデータベースを使用するコマンド形式のレポート。
  • cost-aware-llm-pipeline - モデルルーティングと予算設計のパターン。
  • token-budget-advisor - コンテキストとトークン予算の計画。
  • strategic-compact - 繰り返しのトークン支出を削減するためのコンテキスト圧縮。

Related skills

Forks & variants (1)

Cost Tracking has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.

How it compares

Pick cost-tracking over generic spreadsheet tracking when Claude Code hooks already persist structured usage rows locally and you want agent-native cost Q&A.

FAQ

Where is usage data stored?

Local SQLite at ~/.claude-cost-tracker/usage.db from cost tracking hooks.

What breakdowns are supported?

By project, tool, session, model, and date including today vs yesterday.

What if the database is missing?

Verify cost tracking hook prerequisites before querying usage.

Is Cost Tracking safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.