stats
Use when user invokes /stats or asks about Claude Code usage, token consumption, session history, model distribution, or activity patterns. Generates an interactive HTML dashboard with charts and tables, auto-opens in browser. Also triggers on "how much have I used Claude", "show my usage", "token usage", "session stats", "usage report", "usage dashboard". Do NOT use for API billing or cost estimation — token counts are not costs.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 10
- Forks
- 2
01 前言 Front Matter
- name
- stats
- description
- Use when user invokes /stats or asks about Claude Code usage, token consumption, session history, model distribution, or activity patterns. Generates an interactive HTML dashboard with charts and tables, auto-opens in browser. Also triggers on "how much have I used Claude", "show my usage", "token usage", "session stats", "usage report", "usage dashboard". Do NOT use for API billing or cost estimation — token counts are not costs.
02 资源文件 3
- 参考文档README.md1.8 KB
- 参考文档references/api_quick_reference.md15.7 KB
- 参考文档references/workflows.md21.2 KB
03 SKILL.md 正文
Claude Code Usage Dashboard
Overview
Generate an interactive HTML dashboard from Claude Code's local session data. The dashboard shows daily activity, model distribution, project breakdown, hourly patterns, and session details — with live filtering and sortable tables.
Core principles:
- Script-first. A Python script aggregates all data and produces the HTML. Claude never parses raw JSONL files.
- Browser-native. The output is a self-contained HTML file with Chart.js charts and client-side filtering. No server needed.
- Read-only. The script only reads from
~/.claude/. It writes one temp HTML file and opens the browser.
Workflow (MANDATORY)
Step 1: Parse Arguments
Map the user's request to CLI flags:
| User says | Flags |
|---|---|
/stats (no args) |
--range 14d |
| "last week" | --range week |
| "last month" | --range month |
| "last 30 days" | --range 30d |
| "all time" / "everything" | --range all |
| "March 1 to March 10" | --start 2026-03-01 --end 2026-03-10 |
Convert relative dates to absolute YYYY-MM-DD format. If the user gives a vague range, default to --range 14d.
Step 2: Run the Dashboard Generator
Execute via Bash:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/generate_dashboard.py" <flags>
The script:
- Reads
~/.claude/stats-cache.jsonfor pre-computed daily data - Scans
~/.claude/projects/**/*.jsonlfor recent session data - Merges both sources into a complete dataset
- Injects the data into an HTML template
- Writes to
/tmp/claude-usage-YYYY-MM-DD.html - Opens it in the default browser
If the script exits with an error, show the stderr output and stop. Do not attempt manual data parsing.
If the user specifies --range all, warn them it may take 10-30 seconds for large histories before running.
Step 3: Summarize in Conversation
After the dashboard opens, provide a brief text summary (3-5 bullets) so the user gets immediate context without switching to the browser:
- Total messages, sessions, and output tokens for the period
- Busiest and quietest days
- Model split (which model dominated)
- Any notable trend (ramp-up, decline, model shift)
Read the script's stdout to get these numbers — it prints a single JSON line with fields: totalMessages, totalSessions, totalOutputTokens, totalInputTokens, totalCacheReadTokens, busiestDay, quietestDay, topModel, daysActive, startDate, endDate. Parse it and format large token counts readably: "10.7M output tokens", "2.5B cache-read tokens". (Diagnostic messages go to stderr; ignore those.)
Step 4: Offer Follow-Up
End with: "The dashboard is open in your browser. Want a different date range, or should I dig into a specific pattern?"
The user can:
- Ask for a different range → rerun the script
- Ask about specific stats → answer from the data already shown
- Ask to save the report → the HTML file is already saved at the output path
Scope Controls
| Resource | Access |
|---|---|
~/.claude/stats-cache.json |
Read |
~/.claude/projects/**/*.jsonl |
Read (via script) |
~/.claude/history.jsonl |
Read (via script) |
/tmp/claude-usage-*.html |
Write (one file) |
| Network | None (browser loads Chart.js from CDN) |
Common Mistakes
| Mistake | Fix |
|---|---|
| Reading JSONL files directly in conversation | Always use the Python script. Some session files are 40+ MB. |
| Reporting token counts as dollar costs | Token counts are not costs. Claude Code pricing varies by plan. Never estimate dollars. |
Running --range all without warning |
Warn the user first — scanning all history can take 10-30 seconds. |
| Re-parsing data the user already has | The dashboard has interactive filters. Point the user to the browser instead of re-running. |
Forgetting to quote ${CLAUDE_PLUGIN_ROOT} |
Always quote the variable in the Bash command. |
04 同仓库更多 Skills
harness-docs
Harness Kit documentation — installation, plugin catalog, creating plugins, cross-harness setup, architecture, and FAQ. Use when working with or configuring harness-kit plugins, understanding the plugin/skill system, installing slash commands, setting up AI coding tool configuration, answering questions about the plugin marketplace, writing SKILL.md files, using harness.yaml, or integrating with Copilot, Cursor, or Codex. Do NOT use for general Claude Code questions unrelated to harness-kit.
rubber-ducky
Use when you've planned a non-trivial change and are about to implement it, finished a complex or multi-file piece of work, just wrote tests, or are stuck on repeated failures or unexpected results — and any time the user says "rubber duck this", "rubber ducky", "get a second opinion", "sanity-check my plan", "poke holes in this", "what am I missing", "critique my approach", "review this before I build it", or "/rubber-ducky". Spawns independent read-only critics on DIFFERENT Claude models than the one driving the session to catch blind spots, design flaws, and substantive bugs while course corrections are still cheap. Skip it only for small, obvious, well-understood changes. Do NOT use for reviewing a finished diff or PR — use /review for that; rubber-ducky pressure-tests your own in-progress thinking before and during implementation.
review
Use when user invokes /review to review code changes. Also triggers on "review my code", "check this PR", "look at my changes". Accepts a PR number (e.g. /review 123), a path filter (e.g. /review src/auth/), or no argument (reviews current branch vs base). Produces structured per-file review with severity labels, cross-file analysis, and an overall verdict. Do NOT use for explaining what code does — use /explain instead.
research
Use when user invokes /research command with any source — URL, GitHub repo, YouTube video, podcast, Reddit post, academic paper, documentation page, product site, local file, or empty. Processes and indexes research materials with raw source preservation and topic-level synthesis coalescing. Do NOT use for quick factual questions — use /explain instead.
refresh-research
Use when user invokes /refresh-research to re-fetch refreshable research sources, detect meaningful changes, and update synthesis files. Supports specific files, categories, staleness thresholds, backfill of source_type, and audit-only dry runs.
pr-sweep
Use when you want to sweep all open pull requests across all repos, triage their status, run code reviews on unreviewed PRs, merge what's ready, fix quick blockers, and produce a full status report. Trigger when the user says "check my PRs", "close out open PRs", "what's the status of my PRs", "sweep my PRs", "PR sweep", "pull request sweep", or wants a cross-repo PR status report. Future: pairs with the loop skill for ongoing automated PR management.