affaan-m/ECC

cost-tracking

ローカルのコスト追跡データベースからClaude Codeのトークン使用量、支出、予算を追跡・レポートします。コスト、支出、使用量、トークン、予算、またはプロジェクト、ツール、セッション、日付によるコスト内訳について質問する場合に使用します。

71CollectingClaude Code
See how to use itView GitHub source
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/cost-tracking"
Automated source guide

Source checked Jul 28, 2026·Refresh due Oct 26, 2026

Reorganized from the pinned upstream SKILL.md

Turn cost-tracking's source instructions into a guide you can follow

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

npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/cost-tracking"
Check the pinned source

Best fit

  • ローカルのコスト追跡データベースからClaude Codeのトークン使用量、支出、予算を追跡・レポートします。コスト、支出、使用量、トークン、予算、またはプロジェクト、ツール、セッション、日付によるコスト内訳について質問する場合に使用します。

Bring this context

  • A concrete task that matches the documented purpose of cost-tracking.
  • The files, examples, or context the task depends on.
  • Your constraints, target environment, and definition of done.

Expected outputs

  • A result that follows the pinned cost-tracking instructions.
  • A concise record of assumptions, inputs used, and unresolved questions.
  • A final check against the source workflow and relevant permission signals.

Key source sections

Read cost-tracking through these 5 source sections

Sections are extracted automatically from the pinned SKILL.md and link back to the source.

01

使用時期

ユーザーが「いくら使いましたか?」「このセッションのコストは?」「トークン使用量は?」と尋ねる場合

SKILL.md · 使用時期
ユーザーが「いくら使いましたか?」「このセッションのコストは?」「トークン使用量は?」と尋ねる場合ユーザーが予算、支出制限、超過、またはコスト管理について言及する場合ユーザーがプロジェクト、ツール、セッション、モデル、または日付ごとのコスト内訳を求める場合
02

動作方法

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

SKILL.md · 動作方法
データベースが見つからない場合、使用データを作成しません。ユーザーにコスト追跡が設定されていないことを伝え、信頼できるローカルコスト追跡フック/プラグインのインストールまたは有効化を提案します。期待されるusageテーブルには通常、ツール呼び出しまたはモデルインタラクションごとに1行が含まれます。列名はトラッカーによって異なりますが、以下の例では次のように仮定します:costusdを使用して手動で価格計算するよりも優先します。モデルの価格とキャッシュ価格は時間とともに変化し、トラッカーが各行の価格設定の信頼できる情報源であるべきです。
03

Review the “例” section in the pinned source before continuing.

SKILL.md ·
Review and apply the “例” source section.
04

クイックサマリー

Review the “クイックサマリー” section in the pinned source before continuing.

SKILL.md · クイックサマリー
Review and apply the “クイックサマリー” source section.
05

プロジェクト別コスト

Review the “プロジェクト別コスト” section in the pinned source before continuing.

SKILL.md · プロジェクト別コスト
Review and apply the “プロジェクト別コスト” source section.

SkillSignal prompt templates

Provide the task, context, and acceptance criteria

These prompts were written by SkillSignal from the source structure; they are not upstream text.

Task-start prompt

Confirm source fit, inputs, and outputs before acting.

Use cost-tracking to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.

Source-guided execution

Make the Agent explicitly follow the key extracted sections.

Apply the pinned cost-tracking source to [task]. Pay particular attention to these source sections: “使用時期”, “動作方法”, “例”, “クイックサマリー”, “プロジェクト別コスト”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].

Result-review prompt

Check omissions, permissions, and source drift before delivery.

Review the current cost-tracking result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.

Output checklist

Verify each item before delivery

The task matches the purpose documented in the SKILL.md.

The source section “使用時期” has been checked.

The source section “動作方法” has been checked.

The source section “例” has been checked.

The source section “クイックサマリー” has been checked.

Inputs, constraints, and acceptance criteria are explicit.

Unverified facts, compatibility, and outcome claims are clearly marked.

Any file, command, network, or data action has been reviewed.

Choose a different workflow

When another Skill is the better fit

FAQ

What does cost-tracking do?

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

How do I start using cost-tracking?

The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/cost-tracking". Inspect the command and pinned source before running it.

Which Agent platforms does it declare?

claude code

Repository stars
234,327
Repository forks
35,711
Quality
71/100
Source repository last pushed

Quality breakdown

Based on traceable docs and repository signals; stars are not treated as quality.

71/100
Documentation25/30
Specificity14/25
Maintenance20/20
Trust signals12/25

Compare before choosing

Related Agent Skills and source variants

These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.

View original Skill.mdThis page is parsed directly from the repository SKILL.md without editorial rewriting. Collected: Jul 28, 2026 · about 1 min

コスト追跡

このスキルを使用して、ローカル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 - 繰り返しのトークン支出を削減するためのコンテキスト圧縮。
Source repo
affaan-m/ECC
Skill path
docs/ja-JP/skills/cost-tracking/SKILL.md
Commit SHA
4e973d3eaf92
Repository license
MIT
Data collected