Analyze Claude Code usage, spending, and budgets from a local database.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "cost-tracking" skill from askskill: 1. Download https://raw.githubusercontent.com/affaan-m/ECC/main/skills/cost-tracking/SKILL.md 2. Save it as ~/.claude/skills/cost-tracking/SKILL.md 3. Reload skills and tell me it's ready
Summarize today's Claude Code spend, total cost, call count, and session count.
A concise summary of today's spend, total spend, calls, and sessions.
Break down Claude Code cost and call count by project, sorted by highest cost first.
A list of projects with their costs and call counts.
Show me the last 7 days of Claude Code cost and call count by day to inspect the trend.
A 7-day daily trend table of cost and calls.
Use it when you want the cost, call count, and token usage for the current or a recent Claude Code session. It can summarize records from the local database if they exist.
Use it to compare spending across projects, tools, or models and identify the biggest cost drivers for budgeting and optimization.
Use it when you need to watch for overruns, daily burn, or a recent 7-day trend. It helps with cost control through time-based analysis.
This skill analyzes Claude Code cost and usage history from a local SQLite usage.db. It supports checking total spend, breaking costs down by project or tool, reviewing date-based trends, and exporting recent records. The document also states the prerequisites: sqlite3 must be available locally, and a trusted cost-tracking hook or plugin must already write data to the database; if the database is missing, the skill should report that tracking is not configured instead of inventing results.
Use this skill to analyze Claude Code cost and usage history from a local SQLite
database. It is intended for users who already have a cost-tracking hook or
plugin writing usage rows to ~/.claude-cost-tracker/usage.db.
Source: salvaged from stale community PR #1304 by MayurBhavsar.
First verify prerequisites:
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"
If the database is missing, do not fabricate usage data. Tell the user that cost tracking is not configured and suggest installing or enabling a trusted local cost-tracking hook/plugin.
The expected usage table usually contains one row per tool call or model
interaction. Column names vary by tracker, but the examples below assume:
| Column | Meaning |
|---|---|
timestamp | ISO timestamp for the usage event |
project | Project or repository name |
tool_name | Tool or event name |
input_tokens | Input token count, when recorded |
output_tokens | Output token count, when recorded |
cost_usd | Precomputed cost in USD |
session_id | Claude Code session identifier |
model | Model used for the event |
Prefer cost_usd over hand-calculating pricing. Model prices and cache pricing
change over time, and the tracker should be the source of truth for how each row
was priced.
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;
"
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;
"
When presenting cost data, include:
For small amounts, format currency with four decimal places. For larger amounts, two decimals are enough.
cost_usd is present.SELECT * exports on large databases.…
You need sqlite3 available locally and a `~/.claude-cost-tracker/usage.db` written by a cost-tracking hook or plugin. If the database is missing, it should not fabricate usage data.
It can report by project, tool, session, model, and date, and can show recent trends. The materials also mention exporting recent usage records as CSV.
It should tell the user that cost tracking is not configured and suggest installing or enabling a trusted local cost-tracking hook/plugin. For more implementation details, see the source repository.
Learn robust error-handling patterns across TypeScript, Python, and Go applications.
Manage carrier portfolios, negotiate freight rates, and evaluate carrier performance.
Design and implement robust F# unit, property, and integration tests
Apply test-driven development to Quarkus 3.x features, fixes, and refactors.
Generate images, videos, and audio with one unified AI media workflow.
Run a pre-release verification loop for Quarkus builds, tests, scans, and reviews.
Summarize CodexBar local cost logs by model for Codex or Claude.
Track expenses, budgets, and personal finance summaries using natural language.
Monitor Claude Code costs, ROI, budgets, anomalies, and usage forecasts.
Track expenses, budgets, invoices, and project finances with natural language.
Audit Claude Code context usage and get prioritized token-saving recommendations.
Check Claude plan usage and remaining quota through a logged-in browser.