skills/claude-code-usage-report/SKILL.md
Generates a token usage and cost estimation report for Claude Code sessions. Analyzes local session JSONL files to report per-model token consumption, API-equivalent costs, and per-project breakdowns. Use when user mentions token usage, cost report, spending, usage report, session stats, or how much Claude Code costs. Supports filtering by date range, project, or plan type.
npx skillsauth add rlespinasse/agent-skills claude-code-usage-reportInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze Claude Code token consumption and estimate costs from session JSONL files
stored locally in ~/.claude/projects/.
Session data is stored as JSONL files in ~/.claude/projects/<project-id>/:
<project-dir>/*.jsonl<project-dir>/*/subagents/*.jsonlEach line is a JSON object. Token usage is at message.usage:
| Field | Description |
| --- | --- |
| input_tokens | Direct input tokens |
| output_tokens | Model output tokens |
| cache_read_input_tokens | Tokens read from prompt cache |
| cache_creation_input_tokens | Tokens written to prompt cache (5m or 1h TTL) |
Model identification is at message.model (contains opus, sonnet, or haiku).
Timestamps are at timestamp (ISO 8601 format).
All pricing data (model token costs and subscription plans) is stored in
scripts/pricing.json — the single source of truth
used by the script. The file includes an updated date field so the user
can see when prices were last verified.
Prompt caching has two write tiers: 5-minute (1.25x base input) and 1-hour (2x base input). Cache reads cost 0.1x base input. The script uses the 5-minute cache write price for cost estimation because Claude Code uses ephemeral caching.
If the user asks to update pricing:
python3 <skill-path>/scripts/usage_report.py --update-pricing
to display the current pricing.json values and update the checked datepricing.json valuespricing.json with any changed valuesThe report displays the pricing data date so the user knows how current the prices are.
Parse the user's request to determine:
If the user does not specify a scope, ask them to clarify. Default to "all projects" if only a date range is given.
Run the bundled script at scripts/usage_report.py to scan and aggregate session data. Resolve the script path relative to the skill installation directory.
python3 <skill-path>/scripts/usage_report.py \
[--start-date YYYY-MM-DD] \
[--end-date YYYY-MM-DD] \
[--project PROJECT_NAME] \
[--output PATH] \
[--update-pricing]
| Argument | Description | Default |
| --- | --- | --- |
| --start-date | Include only data on or after this date | No filter |
| --end-date | Include only data on or before this date | No filter |
| --project | Project directory name or substring | All projects |
| --output | Report output file path | ~/claude-code-usage-report.txt |
| --update-pricing | Fetch pricing page and guide update of pricing.json | — |
The script outputs the formatted report to stdout and saves it to the output file. It uses only Python stdlib (no dependencies to install).
The report always includes a Plan ROI Comparison section showing savings for all plans (Pro, Max 5x, Max 20x) against API-equivalent cost.
The script produces a formatted report with these sections:
Present the script output to the user. The report is also saved
automatically to the --output path (default ~/claude-code-usage-report.txt).
Inform the user of the saved file path.
After the full report, add a brief summary highlighting:
1,234,567)$X.XX format for costs| Anti-pattern | Better alternative |
| --- | --- |
| Generating a script from scratch | Use the bundled scripts/usage_report.py |
| Making per-file tool calls | The bundled script scans everything |
| Hardcoding prices in the skill | Prices live in scripts/pricing.json |
| Ignoring subagent files | Script includes */subagents/*.jsonl |
| Showing raw directory names | Script cleans up to readable project names |
| Omitting cache tokens | Script shows all four token types |
| Guessing the date range | Ask the user if ambiguous |
development
Ensures all project content is written in proper French with correct accents, grammar, and typography. Use when user mentions french, français, langue française, accents, orthographe, typographie, or when working on a project that requires French language content. Also use when generating any text-based file (SVG, Mermaid, PlantUML, Draw.io, HTML, CSV, JSON, YAML, etc.) in a French-language project. Helps enforce French writing conventions across all file types.
development
Verifies that features listed in a README (or similar documentation) are actually implemented in the codebase. Use when user mentions verify features, check feature list, confirm README, validate documentation claims, or audit feature accuracy. Helps catch stale, missing, or inaccurate feature descriptions.
development
Checks GitHub Actions CI logs on a pull request, diagnoses failures, and guides the agent to implement fixes. Use when user mentions CI failing, check PR logs, fix pipeline, GitHub Actions errors, workflow failures, build broken, tests failing on PR, or debug CI. Focuses on PR-scoped CI analysis only.
testing
Migrates GitHub Actions workflows to use pinned commit SHAs instead of tags, resolves the latest release versions, flags major version jumps, and configures Dependabot with grouped updates. Use when user mentions pin actions, pinned versions, SHA pinning, GitHub Actions security, dependabot setup, or supply-chain security.