Skip to content
Skill

Cost tracking

Reports Claude Code token usage and spend from a local cost log

Cost tracking is an open-source agent skill for analytics and data. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
76
Last commit
License
MIT
Listing updated

Similar skills

About Cost tracking

This skill reads the metrics log written by an ECC cost-tracker hook for Claude Code and turns it into spending and usage reports. Each log row is a cumulative snapshot per session, so the skill reduces the log to the latest row for each session before totaling spend, which avoids double counting.

The workflow starts by checking that the log file exists in the user's home metrics folder. If it is missing, the skill tells the user that tracking only begins after a session ends with the hook enabled, rather than inventing figures. When the log is present, it summarizes today's and yesterday's spend, the all-time total, the session count and a breakdown by model, and it can drill into individual sessions or prepare a CSV export. It relies on the precomputed cost field instead of recalculating prices from token counts.

It expects Node.js to run the inline scripts and the ECC cost-tracker hook to have produced the log. No external services or API keys are needed.

When your agent uses it

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.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 2 files (5 KB) on GitHub on 5 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the rea-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath

Or copy only this skill to ~/.claude/skills/cost-tracking:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.claude/skills/cost-tracking &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/cost-tracking inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/cost-tracking to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.agents/skills/cost-tracking &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/cost-tracking inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/cost-tracking to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.cursor/skills/cost-tracking &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/cost-tracking inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/cost-tracking

Or copy the folder to ~/.gemini/skills/cost-tracking yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/cost-tracking:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/cost-tracking &&
cp -R "$tmp/.agents/skills/cost-tracking" ~/.copilot/skills/cost-tracking &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/cost-tracking inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git

Then copy REA_Skill/.agents/skills/cost-tracking into your agent's skills folder as cost-tracking. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Session-level cost totals
Reduces cumulative log rows to the latest snapshot per session before summing spend.
Model breakdown
Groups spending by the model recorded in each session.
Daily spend comparison
Shows today's and yesterday's spend alongside the all-time total.
Missing log handling
Checks for the metrics file first and reports clearly when no data exists.
Session drilldown and CSV export
Lists individual sessions or exports the underlying rows for further analysis.
Token usage fields
Works with input, output and prompt-cache token counts recorded by the tracker.

Good for

  • How much have I spent on Claude Code today?
  • Break down my total usage cost by model.
  • Show what the last session cost.
  • Export my cost history to CSV.
  • Check whether I am close to my token budget.

Cost tracking FAQ

What does Cost tracking need to run?

It needs Node.js for the inline scripts and a cost log at ~/.claude/metrics/costs.jsonl, which the stop:cost-tracker hook writes after sessions end.

What happens if no cost log exists?

The skill reports that the log was not found and tells the user that tracking starts after the first session ends with the hook enabled. It does not fabricate usage data.

Does Cost tracking recalculate prices itself?

No. It prefers the estimated_cost_usd value recorded by the tracker, since model and cache prices change over time.

Why are rows reduced to the latest per session?

Each row is a cumulative snapshot for its session, so summing every row would count the same spend several times.

How do I install Cost tracking in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/cost-tracking to use it in all your projects, or to .claude/skills/cost-tracking in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

Does Cost tracking run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Cost tracking?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Cost tracking?

The closest alternatives to Cost tracking are Cloud logging finops, Product tracking edho ferdian, Conversion tracking, Cost analysis and Gke cost analysis.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from smartworldarafath/REA_Skill

  1. Guides building and auditing UI to WCAG 2.2 AA across web, iOS and Android

    • Open source
    • 76 GitHub stars
    • Developer tools
  2. Diagnoses agent and LLM stacks for hidden failures and ranks the fixes by severity

    • Open source
    • 76 GitHub stars
    • Developer tools
  3. Compare coding agents head-to-head on your own tasks by pass rate, cost and time

    • Open source
    • 76 GitHub stars
    • Developer tools
  4. Guides an agent to design tool sets, observations and error recovery for better completion

    • Open source
    • 76 GitHub stars
    • Developer tools
  5. Lets an AI agent make x402 payments within per-task budgets and spending policies

    • Open source
    • 76 GitHub stars
    • Finance and payments