From usage-insights
Generate a time-aware, config-aware HTML usage insight report from Claude Code session data. Improves on the built-in /insights command by adding trend classification (↓ Declining / → Persistent / ↑ Emerging) per friction category, config-awareness that suppresses suggestions already addressed in your CLAUDE.md, hooks, and installed skills, and checkpoint-driven incremental synthesis so report cost scales only with new sessions — not total history. Use this skill whenever the user invokes /usage-insights, asks for a usage report, or wants to understand trends in their Claude Code session history.
How this skill is triggered — by the user, by Claude, or both
Slash command
/usage-insights:usage-insightsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a time-aware, config-aware HTML usage insight report from Claude Code
deps.ednreferences/facet-prompt.mdreferences/friction-taxonomy.mdreferences/report-structure.mdscripts/src/usage_insights/collect_sessions.cljscripts/src/usage_insights/merge_checkpoint.cljscripts/src/usage_insights/read_config.cljscripts/test/usage_insights/collect_sessions_test.cljscripts/test/usage_insights/merge_checkpoint_test.cljscripts/test/usage_insights/read_config_test.cljGenerate a time-aware, config-aware HTML usage insight report from Claude Code
session data. Output: ~/.claude/usage-insights/report-{timestamp}.html.
Executes in six sequential phases. Complete all phases before printing the confirmation message.
Create output directory if absent:
mkdir -p ~/.claude/usage-insights
Run collect-sessions and capture the JSON output:
clojure -M:collect \
--session-dir ~/.claude/usage-data/session-meta \
--facets-dir ~/.claude/usage-data/facets \
--checkpoint ~/.claude/usage-insights/checkpoint.json \
$([ -n "$ARGUMENTS_SINCE" ] && echo "--since $ARGUMENTS_SINCE")
Parse the JSON output. Store:
new_sessions — sessions not yet in the checkpointunfaceted_ids — new sessions that lack a facet filewindow_sessions — sessions to include in the report narrativeignore_sessions — session IDs that failed to parseShort-circuit check: If new_sessions is empty and ignore_sessions is empty:
clojure -M:config --claude-dir ~/.claude
jq -c '.config_snapshot' ~/.claude/usage-insights/checkpoint.json
No new sessions or config changes since last report.
Most recent report: ~/.claude/usage-insights/report-{most recent filename}.
Note: the current session will be included in the next run.
Then stop — do not proceed to Phase 2.Ignore prompt: For each ID in ignore_sessions, ask the user:
Session
{id}appears corrupted. Ignore it and continue?
confirmed_ignore_ids list. Inform the user:
"Added {id} to the ignore list — it will be skipped on all future runs."Proceed to Phase 2 only after all ignore_sessions prompts are resolved.
For each session ID in unfaceted_ids:
~/.claude/usage-data/session-meta/{session_id}.jsonfirst_prompt is absent or "No prompt" and tool_counts is empty,
skip this session — do not write a facet file.{SESSION_META_JSON} with the raw JSON content.~/.claude/usage-data/facets/{session_id}.jsonProcess sessions one at a time. Skip this phase entirely if unfaceted_ids is empty.
Read the current config inventory:
clojure -M:config --claude-dir ~/.claude
Store the JSON output as CONFIG_SNAPSHOT.
Merge all sessions from new_sessions into the checkpoint:
clojure -M:merge \
--checkpoint ~/.claude/usage-insights/checkpoint.json \
--session-meta-dir ~/.claude/usage-data/session-meta \
--facets-dir ~/.claude/usage-data/facets \
--new-session-ids "{comma-separated session IDs from new_sessions}" \
--config-snapshot '{CONFIG_SNAPSHOT as JSON string}' \
--ignored-session-ids "{comma-separated IDs from confirmed_ignore_ids}"
If new_sessions is empty, omit --new-session-ids.
If confirmed_ignore_ids is empty, omit --ignored-session-ids.
Read ~/.claude/usage-insights/checkpoint.json.
For each friction category key present in weekly_buckets across 3 or more
distinct weeks, classify the trajectory:
For each classified category, compose a one-line trend note such as: "5 instances in January, 0 since February."
Read the config_snapshot from the checkpoint (hooks, skills, CLAUDE.md).
For each suggestion you plan to include in "Existing Features to Try",
classify it as one of:
Store all classifications — they are used in Phase 5.
Synthesize the HTML report. Use window_sessions facets for the report
narrative; use the full checkpoint for trend analysis.
Follow the structure in @references/report-structure.md exactly — same section IDs, same CSS class names.
Include all CSS from report-structure.md in the <style> block,
together with the full CSS from the existing /insights report.
Render immediately after .subtitle. Include:
start_time in window_sessionswindow_sessions--since {value} only if $ARGUMENTS.since was providedcheckpoint: ~/.claude/usage-insights/checkpoint.jsonFor each friction card in section-friction, add the trend badge and
trend note from Phase 4. Omit if Unclassified.
For each feature card in section-features, add the config pill from
Phase 4. Apply .muted to cards with status "Already in place".
TIMESTAMP=$(date -Iseconds)
Write the complete HTML to ~/.claude/usage-insights/report-${TIMESTAMP}.html.
Print to the terminal:
Report written to: ~/.claude/usage-insights/report-{TIMESTAMP}.html
Sessions in scope: {count of window_sessions}
Checkpoint: ~/.claude/usage-insights/checkpoint.json ({count of analyzed_session_ids} total sessions analyzed)
Note: the current session will be included in the next run.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub christianromney/claude-plugins --plugin usage-insights