Index of every page on this site: llms.txt
All skills
benwaffle avatar

/claude-stats

@d518105
Run it yourself

Generate an interactive HTML report of your Claude Code usage (sessions, messages, tokens, active days, streaks, peak times, model usage by day, top projects/tools) by parsing ~/.claude/projects/*.jsonl. Use when the user asks for their Claude stats, usage, activity, streaks, token breakdown, or wants to see how they use Claude over time.

Use this Skill: https://skilld.dev/gh/benwaffle/skills/claude-stats

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈89 tokens for metadata: the name and description. ≈585 when used: this file.

Description uses 4.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈355 characters, or 4.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

claude-stats

Builds a single self-contained HTML report from the user's local Claude Code conversation logs.

How to run

python3 "${CLAUDE_PLUGIN_ROOT:-$(dirname "$0")}/build_stats.py" [OUTPUT_HTML] [CLAUDE_DIR]
  • OUTPUT_HTML — where to write the report. Defaults to ./claude_stats.html.
  • CLAUDE_DIR — Claude config directory. Defaults to $CLAUDE_DIR or ~/.claude.

The script writes a sidecar .json next to the HTML (same basename) for debugging or re-use.

After running, open the HTML in the browser: open <output_html> (macOS) or xdg-open (Linux).

What it reports

  • Totals: sessions, user/assistant messages, tokens (input/output/cache-create/cache-read).
  • Timeline: daily activity, token usage over time.
  • Model usage by day (stacked bar, one color per model).
  • Peak hours + peak weekdays, hour×weekday heatmap.
  • Streaks: longest + current (computed over all time, not the current filter).
  • Top projects, top tools, top models.
  • Session table sortable by duration / messages / tokens.

Interactive filtering

The report has a filter bar: All time · By month · By week · Last 30d · Last 7d. Selecting By month or By week reveals clickable chips (one per bucket, showing its message count). All charts, cards, and tables rescope to the selection.

Streaks intentionally stay all-time — streak length inside a single week is meaningless.

Data source notes

  • Scans every *.jsonl under <CLAUDE_DIR>/projects/ recursively (includes subagent logs).
  • Timestamps are converted to local time for hour-of-day / weekday bucketing.
  • Excludes <synthetic> assistant messages from model tallies (they have no real usage).
  • Distinguishes genuine user prompts from tool-result blocks (both have type: "user" but tool results aren't counted as user messages).
  • Tool usage is counted per tool_use block in assistant messages.

Typical invocation pattern

When the user asks for "my Claude stats" or "usage report":

  1. Run the script to a temp path, e.g. /tmp/claude_stats.html.
  2. Summarize the top-level numbers in chat (sessions, messages, tokens, active days, streaks, peak hour/weekday).
  3. open the HTML so the user can explore interactively.

The report is fully client-side — Chart.js is loaded from jsdelivr CDN. No data leaves the machine.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill generates a local usage report by parsing Claude Code conversation logs. The generated HTML report is vulnerable to Cross-Site Scripting (XSS) if log files contain malicious strings from the environment, such as specially crafted project directory names.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at d518105. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
What it can do
Runs commands Reads files
user-invocable
true
All 3 allowed tools
Bash(python3 *)Bash(open *)Read

README badge

README badge for benwaffle/skills/claude-stats