affaan-m/ECC/docs/ja-JP/skills/cost-tracking/SKILL.md
cost-tracking
Use it for engineering tasks; the detail page covers purpose, installation, and practical steps.
- Source repository stars
- 234,327
- Declared platforms
- 1
- Static risk flags
- 0
- Last source update
- 2026-07-27
- Source checked
- 2026-07-28
Decision brief
What it does—and where it fits
このスキルを使用して、ローカルSQLiteデータベースからClaude Codeのコストと使用履歴を分析します。これは、/.claude-cost-tracker/usage.dbに使用行を書き込むコスト追跡フックまたはプラグインをすでに持っているユーザーを対象としています。
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Declared | Source record | Install path and trigger |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/cost-tracking"Inspect the Agent Skill "cost-tracking" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/ja-JP/skills/cost-tracking/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
使用時期
ユーザーが「いくら使いましたか?」「このセッションのコストは?」「トークン使用量は?」と尋ねる場合
ユーザーが「いくら使いましたか?」「このセッションのコストは?」「トークン使用量は?」と尋ねる場合ユーザーが予算、支出制限、超過、またはコスト管理について言及する場合ユーザーがプロジェクト、ツール、セッション、モデル、または日付ごとのコスト内訳を求める場合 - 02
動作方法
データベースが見つからない場合、使用データを作成しません。ユーザーにコスト追跡が設定されていないことを伝え、信頼できるローカルコスト追跡フック/プラグインのインストールまたは有効化を提案します。
データベースが見つからない場合、使用データを作成しません。ユーザーにコスト追跡が設定されていないことを伝え、信頼できるローカルコスト追跡フック/プラグインのインストールまたは有効化を提案します。期待されるusageテーブルには通常、ツール呼び出しまたはモデルインタラクションごとに1行が含まれます。列名はトラッカーによって異なりますが、以下の例では次のように仮定します:costusdを使用して手動で価格計算するよりも優先します。モデルの価格とキャッシュ価格は時間とともに変化し、トラッカーが各行の価格設定の信頼できる情報源であるべきです。 - 03
例
Review the “例” section in the pinned source before continuing.
Review and apply the “例” source section. - 04
クイックサマリー
Review the “クイックサマリー” section in the pinned source before continuing.
Review and apply the “クイックサマリー” source section.
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 71/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 234,327 | Source | Repository attention, not individual Skill quality |
| Compatibility | 1 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- affaan-m/ECC
- Skill path
- docs/ja-JP/skills/cost-tracking/SKILL.md
- Commit
- 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
- License
- MIT
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
コスト追跡
このスキルを使用して、ローカル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_usd | USDで事前計算されたコスト |
session_id | Claude 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;
"
レポートガイダンス
コストデータを表示する場合、以下を含めます:
- 今日の支出と昨日の比較。
- 追跡されたデータベース全体の合計支出。
- コスト順にランク付けされた上位プロジェクト。
- コスト順にランク付けされた上位ツール。
- 十分なデータがある場合のセッション数とセッションごとの平均コスト。
少額の場合、通貨を小数点4桁でフォーマットします。大きな金額には2桁で十分です。
アンチパターン
cost_usdが存在する場合に生のトークン数からコストを推定しないこと。- 確認せずにデータベースが存在すると仮定しないこと。
- 大規模なデータベースで無制限の
SELECT *エクスポートを実行しないこと。 - ユーザー向けの回答で現在のモデル価格をハードコードしないこと。
- 任意のコードを実行する未審査のフックやプラグインのインストールを推奨しないこと。
関連
/cost-report- 同じデータベースを使用するコマンド形式のレポート。cost-aware-llm-pipeline- モデルルーティングと予算設計のパターン。token-budget-advisor- コンテキストとトークン予算の計画。strategic-compact- 繰り返しのトークン支出を削減するためのコンテキスト圧縮。
Alternatives
Compare before choosing
affaan-m/ECC
cost-tracking
Track and report Claude Code token usage, spending, and budgets from the local ECC cost-tracker metrics log. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by model, session, or date.
jackchuka/skills
claude-skill-spec-audit
Audit skill SKILL.md files for compliance with the agentskills.io specification and house conventions. Checks frontmatter fields (name, description, compatibility, metadata, argument-hint), metadata sub-fields (author, scope, layer, confirms), and layer/suffix consistency. Use when adding new skills, reviewing skill quality, or ensuring all skills follow the spec. Triggers: "audit skills", "check skill spec", "skill compliance", "are my skills up to spec", "/claude-skill-spec-audit".
affaan-m/ECC
autonomous-loops
Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems.
affaan-m/ECC
gan-style-harness
GAN-inspired Generator-Evaluator agent harness for building high-quality applications autonomously. Based on Anthropic's March 2026 harness design paper.