Skip to content

Claude Code Cost Tracking

Lets the agent report Claude Code token usage and spending from a local SQLite cost database

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

When installed, the agent can answer questions about how much you have spent on Claude Code, broken down by project, tool, session, or date. It works by running read-only SQL queries via the sqlite3 command against a local database at ~/.claude-cost-tracker/usage.db, which must already be created by a separate cost-tracking hook or plugin. It will not invent usage data if the database is missing; it tells you tracking is not set up.

Great for

  • Developers who already run a Claude Code cost-tracking hook or plugin and want quick spending summaries
  • People managing a budget across several projects who want per-project or per-session cost breakdowns
  • Users who want a CSV-style export of recent usage records

Skip it if

  • Anyone without an existing local usage database: the skill only reads data and cannot track costs itself
  • Large databases where unrestricted exports could be slow; the skill itself warns against unlimited SELECT * exports
  • Official billing or invoice reconciliation: it relies on the cost_usd values written by a third-party tracker, which may not match Anthropic's bills

Try asking

  • “How much have I spent today compared with yesterday?”
  • “Which projects cost me the most this week?”
  • “Show a per-session cost breakdown for my last 10 sessions”
  • “Break down my Claude Code spending by tool name”
Step-by-step guide: how to use Claude Code Cost TrackingInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    cost-tracking.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip cost-tracking.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip cost-tracking.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Verify the database columns match the assumed schema (timestamp, project, tool_name, cost_usd, session_id, model) before trusting the numbers
  • Only install a cost-tracking hook or plugin you have reviewed, since the skill recommends against unvetted hooks that execute arbitrary code
  • Ask for specific slices (a project or date range) rather than full exports on large databases

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.