Skip to main content
skill CX Codex

usage-trends — Claude Code skill: what it does, how to install

Tracks Claude Code session history, token consumption, and tool frequency through Agent Monitor API endpoints. Useful for diagnosing agent errors and checking cache efficiency over 365 days.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill usage-trends -a claude-code
Open on GitHub

What usage-trends does

The skill pulls operational data from Agent Monitor using GET /api/analytics, GET /api/stats, and GET /api/sessions?limit=200. It calculates daily session averages, week-over-week deltas, and ranks the top 20 tools by call count. The output formats into Markdown tables marked with ASCII trend arrows like ▲, ▼, and →.

Token analytics track total input, output, and cache read volumes to measure cache efficiency over time. The skill also compares PreToolUse against PostToolUse events. A widening gap between them highlights failing tools.

This skill depends on a live Agent Monitor instance serving its HTTP endpoints. Without that service active, queries fail immediately because metrics are pre-aggregated at the database level.

What it helps with

  • measure token cache efficiency and output verbosity ratios
  • spot broken tool executions by comparing PreToolUse and PostToolUse counts
  • compile a top 20 leaderboard of the most active agent tools
  • track daily session counts and week-over-week shifts across 365 days

Example prompts for the agent

  • Analyze tool trends and rankings for the last 30 days
  • Check token volume trends and cache efficiency for the last quarter
  • Review session health and API errors during peak hours

How to install usage-trends

1Skills CLI (Vercel)

npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill usage-trends -a claude-code

2Manually: put the files in place

~/.claude/skills/usage-trends/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/usage-trends/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about usage-trends

How to install usage-trends in Claude Code?

Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill usage-trends -a claude-code in your terminal. The file is saved to ~/.claude/skills/usage-trends/SKILL.md.

What does usage-trends do?

It queries the Agent Monitor API to analyze session activity, token volumes, model distribution, and tool usage rankings. The resulting breakdown is delivered as Markdown tables with ASCII trend indicators.

What are the prerequisites for usage-trends?

You must have an active Agent Monitor server running and exposing /api/analytics and /api/stats. If the monitor API is unreachable, the skill cannot fetch session metrics.

Source text

SKILL.md · MIT
---
name: usage-trends
description: >
  Analyze Claude Code usage trends over time using the Agent Monitor's
  analytics API — daily session counts, daily event counts, token volumes
  by type, model distribution, tool usage rankings, and agent/event type
  distributions across 365-day retention windows.
---

# Usage Trends

Analyze usage patterns and trends from the Agent Monitor analytics data.

## Input

The user provides: **$ARGUMENTS**

Options: "last 7 days", "last 30 days", "last quarter", "peak hours", "tool trends", "model usage".

## Data Sources

| Endpoint | Returns |
|----------|---------|
| `GET /api/analytics` | Comprehensive analytics object (see schema below) |
| `GET /api/stats` | `{ total_sessions, active_sessions, active_agents, total_agents, total_events, events_today, ws_connections, agents_by_status, sessions_by_status }` |
| `GET /api/sessions?limit=200` | Full session records with timestamps and metadata |

### Analytics response schema (`GET /api/analytics`)

```json
{
  "overview": { "total_sessions", "active_sessions", "active_agents", "total_agents", "total_events" },
  "tokens": {
    "total_input": N, "total_output": N,
    "total_cache_read": N, "total_cache_write": N
  },
  "tool_usage": [{ "tool_name": "...", "count": N }],  // top 20
  "daily_events": [{ "date": "YYYY-MM-DD", "count": N }],  // 365 days
  "daily_sessions": [{ "date": "YYYY-MM-DD", "count": N }],  // 365 days
  "agent_types": [{ "subagent_type": "task"|"explore"|null, "count": N }],
  "event_types": [{ "event_type": "PreToolUse"|"PostToolUse"|..., "count": N }],
  "avg_events_per_session": N,
  "total_subagents": N,
  "sessions_by_status": { "active": N, "completed": N, "error": N, "abandoned": N },
  "agents_by_status": { "working": N, "completed": N, "error": N, ... }
}
```

## Trend Analyses to Produce

### 1. Daily Activity Trend
Plot `daily_sessions` and `daily_events` for the requested period. Compute:
- **Average sessions/day** and **events/day**
- Week-over-week delta (%)
- Peak day and quietest day

### 2. Token Volume Trends
From analytics tokens (baselines are pre-summed into totals at the DB level):
- Total tokens: `total_input`, `total_output`, `total_cache_read`, `total_cache_write`
- **Cache efficiency over time**: `total_cache_read / (total_cache_read + total_input)` — trending up = improving
- **Output intensity**: `total_output / total_input` ratio — high = Claude is verbose

### 3. Tool Usage Ranking
From `tool_usage` (top 20 tools by event count):
- Bar chart data (tool name → count)
- Tool diversity: unique tools used
- Subagent spawns: count of "Agent" tool uses (each = a subagent launched)

### 4. Model Distribution
From `agent_types` + per-session model field:
- Which models are used most frequently
- Subagent type distribution: main (null) vs task vs explore vs code-review

### 5. Session Health Distribution
From `sessions_by_status`:
- Completion rate: `completed / total × 100`
- Error rate: `error / total × 100`
- Abandoned rate: `abandoned / total × 100`

### 6. Event Type Distribution
From `event_types`:
- PreToolUse/PostToolUse ratio (should be ~1:1; gap = tools failing)
- Compaction frequency relative to session count
- APIError count (quota hits, rate limits, overloaded)

## Output

Markdown with tables and ASCII trend indicators (▲▼→). Include period comparison when applicable.

© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set60

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor