/toolbelt:cost-trackingfrom toolbelt
Track and report Claude Code token usage, spending, and budgets from a local cost-metrics JSONL log. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by model, session, or date.
Ships in toolbelt. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze Claude Code cost and usage history from a metrics log file, if one exists. This skill does not ship a hook of its own — it only reads and reports on a log. Whether that log exists at all depends on whether a cost-tracking hook has been set up (see below).
The original version of this skill (from ECC) assumed a stop:cost-tracker hook was already wired into settings.json, auto-appending a JSON row to ~/.claude/metrics/costs.jsonl every time a session stopped. That hook is not part of a default Claude Code install and is not configured on this machine — check first, don't assume:
node -e 'const fs=require("fs"),os=require("os"),p=require("path");const f=p.join(os.homedir(),".claude","metrics","costs.jsonl");console.log(fs.existsSync(f)?"cost log found: "+f:"cost log not found: "+f)'
If it's missing, you have two honest options — present both to the user, don't silently pick one:
/cost command reports total spend for the current session only (no history across sessions). Point the user at it if they just want "how much has this conversation cost so far."Stop hook that appends a cost snapshot to a JSONL file the user chooses (e.g. ~/.claude/metrics/costs.jsonl). Setting this up is a settings.json change — use the update-config skill for that, since it owns hook configuration. Do not write to settings.json from within this skill. Once such a hook exists and has run at least once, this skill's analysis below works unmodified regardless of exactly how the hook computed estimated_cost_usd.Never fabricate usage numbers when the log is absent. Say plainly that no cost history is being recorded yet and offer the two options above.
Ask the user to confirm the log path if it isn't the default — treat ~/.claude/metrics/costs.jsonl as a suggestion, not a hard-coded assumption. Each row is a cumulative snapshot for that session, so to total spend you take the latest row per session_id and sum across sessions — summing every row multiply-counts.
Row schema:
| Field | Meaning |
|---|---|
timestamp | ISO timestamp of the snapshot |
session_id | Claude Code session identifier |
transcript_path | Path to the session transcript |
model | Model used |
input_tokens / output_tokens | Token counts |
cache_write_tokens / cache_read_tokens | Prompt-cache token counts |
estimated_cost_usd | Precomputed cumulative cost in USD for the session |
Prefer estimated_cost_usd over hand-calculating pricing — model and cache prices change, and the log (whatever wrote it) is the source of truth for whatever assumptions it baked in.
Run this only after confirming the log file exists (see "No log yet?" above) and the path:
node -e '
const fs=require("fs"),os=require("os"),path=require("path");
const f=path.join(os.homedir(),".claude","metrics","costs.jsonl"); // adjust if the user pointed elsewhere
if(!fs.existsSync(f)){console.log("cost log not found: "+f);process.exit(0);}
const rows=fs.readFileSync(f,"utf8").split(/\r?\n/).filter(Boolean).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(Boolean);
const bySession=new Map();
for(const r of rows){const k=r.session_id||r.transcript_path||r.timestamp;const p=bySession.get(k);if(!p||String(r.timestamp)>String(p.timestamp))bySession.set(k,r);}
const latest=[...bySession.values()];
const cost=r=>Number(r.estimated_cost_usd)||0, day=r=>String(r.timestamp||"").slice(0,10), sum=a=>a.reduce((s,r)=>s+cost(r),0), f4=n=>"$"+n.toFixed(4);
const today=new Date().toISOString().slice(0,10), yest=new Date(Date.now()-864e5).toISOString().slice(0,10);
console.log("today: "+f4(sum(latest.filter(r=>day(r)===today)))+" | yesterday: "+f4(sum(latest.filter(r=>day(r)===yest)))+" | total: "+f4(sum(latest))+" ("+latest.length+" sessions)");
const m=new Map();for(const r of latest){const k=r.model||"(unknown)";m.set(k,(m.get(k)||0)+cost(r));}
console.log("by model:");[...m.entries()].sort((a,b)=>b[1]-a[1]).forEach(([k,v])=>console.log(" "+f4(v)+" "+k));
'
For a session drilldown or CSV export, iterate the same latest set (or the raw rows for CSV) and print the fields you need.
When presenting cost data, include today's spend vs yesterday, total across all sessions, a by-model breakdown, and session count. Format sub-dollar amounts with four decimals, larger amounts with two. If the underlying log's estimated_cost_usd methodology is unknown (e.g. a hand-rolled hook), say so — don't present it with false precision.
session_id first.estimated_cost_usd is present.update-config so the change goes through normal settings review.~/.claude/metrics/costs.jsonl when the user has an existing log elsewhere — ask.update-config — the skill that actually edits settings.json/hooks; use it if the user wants to set up cost-log recording.context-budget — a different kind of budget (context window tokens per session, not USD spend over time).What SKILL.md sets; muted values are Claude Code's defaults
40 skills in this plugin
/agent-self-evaluationUse after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions./architecture-audit프로젝트의 설계(데이터/스키마 생명주기, API·인터페이스 계약, 상태 머신, 실패·경계 처리, 결합도·확장성, 신뢰 경계)가 얼마나 견고한지 근거와 함께 감사하는 스킬. structure-audit(파일·계층 조직)과 다르다 — 이 스킬은 "어디에 있는가"가 아니라 "이 모델링이 맞는가"를 본다. 코드 수정 없이 조사·보고만 한다. Triggers - "설계 감사", "아키텍처 감사", "설계 검토", "이 스키마 설계 괜찮은지", "API 계약 검토", "이 상태 머신 맞게 짰는지", "design audit", "architecture review", "schema design review"/article-writingWrite articles, guides, blog posts, tutorials, newsletter issues, and other long-form content in a distinctive voice derived from supplied examples or brand guidance. Use when the user wants polished written content longer than a paragraph, especially when voice consistency, structure, and credibility matter.Other plugins' skills for the same job
npx claudepluginhub jh3779/agent-toolbelt-public --plugin toolbelt