npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

clauduck

v0.1.1

Published

Analyze your Claude Code usage with DuckDB

Readme

ClauDuck

Analyze your Claude Code usage with DuckDB. Load your local ~/.claude session history into a queryable database and get insights about your coding patterns, token usage, costs, and tool usage.

Inspired by ClickHouse/alexeyprompts, but using DuckDB for zero-setup local analytics.

Quick Start

npx clauduck

This will:

  1. Load all your ~/.claude session data into DuckDB (~/.claude/clauduck.db)
  2. Run 15 built-in analytics queries
  3. Print results to the terminal

Interactive TUI

npx clauduck tui

Browse pre-built queries, run custom SQL, and explore your data interactively.

Date Filtering

npx clauduck --last 7d                # last 7 days
npx clauduck --last 4w                # last 4 weeks
npx clauduck --since 2025-01-01       # from a date
npx clauduck --since 2025-01-01 --until 2025-06-30  # date range
npx clauduck --source projects        # only project sessions

Claude Code Integration

Copy and paste this into your Claude Code session:

Read and follow the instructions at https://raw.githubusercontent.com/duyet/clauduck/main/CLAUDE.md — set up ClauDuck locally and give me insights about my Claude Code usage

Claude will automatically set up, load data, run analytics, and present a rich dashboard.

What Gets Analyzed

Data Sources

| Source | Path | Content | |--------|------|---------| | History | ~/.claude/history.jsonl | User prompt log with timestamps and project | | Sessions | ~/.claude/projects/*/*.jsonl | Full conversation transcripts with tool calls, tokens, models | | Transcripts | ~/.claude/transcripts/*.jsonl | Lightweight transcripts (older sessions) | | Metadata | ~/.claude/sessions/*.json | Session metadata (pid, cwd, kind) |

Database Schema

All data lives in a single events table with a type column:

| Type | Description | |------|-------------| | session | One row per session with aggregated stats (tokens, tools, duration) | | message | Individual messages with token counts and tool names | | tool_call | Every tool invocation (Bash, Read, Edit, etc.) | | history | Every prompt you've typed with timestamps |

Built-in Analytics (15 queries)

| # | Query | What it shows | |---|-------|---------------| | 1 | Overview | Total sessions, projects, tokens, hours | | 2 | Daily activity | Sessions, messages, tokens per day | | 3 | Top projects | Projects ranked by token usage | | 4 | Tool ranking | Most used tools across all sessions | | 5 | Cost estimate | Estimated USD cost by model (Haiku/Sonnet/Opus) | | 6 | Hourly pattern | What hours you code most | | 7 | Day of week | Weekday vs weekend patterns | | 8 | Longest sessions | Sessions by duration | | 9 | Token-heavy sessions | Most expensive sessions | | 10 | Cache efficiency | Cache hit rates by project | | 11 | Complexity distribution | Session size buckets | | 12 | Weekly trends | Week-over-week usage | | 13 | Git branches | Activity per branch | | 14 | Version history | Claude Code versions used | | 15 | Repeated prompts | Your most-typed commands |

Custom Queries

The database is standard DuckDB with a single events table. After running npx clauduck, you can query it directly:

duckdb ~/.claude/clauduck.db
-- Find sessions where you used Agent tool more than 10 times
SELECT session_id, project_name, tool_call_count, duration_minutes
FROM events
WHERE type='session' AND 'Agent' = ANY(tools_used) AND tool_call_count > 100
ORDER BY tool_call_count DESC;

-- Average tokens per hour by project
SELECT
    project_name,
    round(sum(total_input_tokens + total_output_tokens) / nullif(sum(duration_minutes / 60.0), 0) / 1e6, 2) as tokens_M_per_hour
FROM events
WHERE type='session' AND duration_minutes > 10
GROUP BY 1
ORDER BY 2 DESC;

Development

git clone https://github.com/duyet/clauduck.git
cd clauduck
bun install
bun run build     # Build with tsup
bun run test      # Run tests with vitest
bun run dev       # Run CLI in dev mode (tsx)

Privacy

All data stays local. ClauDuck reads only from your ~/.claude directory and writes to ~/.claude/clauduck.db. Nothing is sent to any server.

License

MIT