Skip to main content
skill CX Codex

analyzing-expensive-users — Claude Code skill

analyzing-expensive-users — a skill for Claude Code, Codex, Cursor and other agents that finds the top spenders in PostHog AI observability and explains what drives their costs.

no license 192 installs ★ 101 updated 2026-11-16

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a claude-code
Open on GitHub

What analyzing-expensive-users does

Rather than a flat cost ranking, it queries PostHog through posthog:execute-sql, measures each of the top 25 users against a project-wide baseline, and identifies the actual driver — generation volume, model selection, prompt length, output size, error rate, cache misses, or heavy traces.

Five PostHog tools are involved: posthog:execute-sql for ranking and baseline statistics, posthog:query-llm-traces-list to pull high-cost traces for a specific person UUID, posthog:query-llm-trace to read individual traces, posthog:read-data-schema to discover custom event and person properties before grouping, and posthog:generate-app-url to build links back to the PostHog UI. When no date range is given, the skill defaults to the last 30 days and says so.

Some SDKs write $ai_trace_id as distinct_id when no user is identified. The skill filters those rows out and reports how much spend remains unattributed. Custom dimensions like feature, tenant_id, or plan are always discovered via posthog:read-data-schema before grouping — the PostHog MCP integration must be connected for all five tools to work.

What it helps with

  • rank the top 25 users by LLM spend over a chosen period
  • compare a single user's cost against the project p50 and p90
  • pinpoint whether a user is expensive due to errors, large prompts, or trace volume
  • measure how much spend is unattributed because no user identity was set
  • read representative traces for a high-cost user by person UUID

Example prompts for the agent

  • Show me the top 10 most expensive users over the last 30 days
  • Explain why this user costs so much — check their recent traces
  • Compare the top spenders against the project baseline

How to install analyzing-expensive-users

1Skills CLI (Vercel)

npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a claude-code

2Manually: put the files in place

~/.claude/skills/analyzing-expensive-users/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/analyzing-expensive-users/

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

Questions about analyzing-expensive-users

How do I install analyzing-expensive-users in Claude Code?

Run npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a claude-code. The skill is placed at ~/.claude/skills/analyzing-expensive-users/SKILL.md.

What does the analyzing-expensive-users skill do?

It ranks users by LLM generation spend in PostHog, builds a project-level cost baseline, and reads individual traces to explain what makes a specific user expensive — volume, model choice, errors, or large context.

Which PostHog tools does this skill rely on?

It uses posthog:execute-sql, posthog:query-llm-traces-list, posthog:query-llm-trace, posthog:read-data-schema, and posthog:generate-app-url. All five require the PostHog MCP to be connected in your agent environment.

Similar skills

All skills for AI and ML →

From the same set82

The whole set →
signals-scout-data-warehouse signals-scout-data-warehouse monitors warehouse imports for failures, stale data, and sharp row-count drops, then flags recurring query patterns that may merit materialized views. CX Codex +1 195installs signals-scout-mcp-tool-calls signals-scout-mcp-tool-calls — a PostHog Signals skill that sifts $mcp_tool_call telemetry for MCP tools agents struggle with, then files one report per product category. CX Codex +1 194installs signals-scout-web-vitals signals-scout-web-vitals tracks page p75 LCP, INP, CLS, and FCP from PostHog events, spots performance degradation against Google thresholds, and links regressions to deploys. CX Codex +1 194installs signals-scout-skills-store signals-scout-skills-store audits shared PostHog agent skills for vague descriptions, oversized bodies, broken links, and leaked secrets. Produces reports with copy-ready fixes. CX Codex +1 193installs turning-engineering-analytics-into-insights turning-engineering-analytics-into-insights — a skill for Claude Code and Codex: converts PR and CI metrics into saved PostHog insights, dashboards, and automated subscriptions. Triggers when visualizing engineering team performance. CX Codex +1 189installs investigating-logs The investigating-logs Claude Code skill investigates logs in a PostHog project, checks service health and traces error spikes. It runs for deploy checks, incident triage, change analysis, or a search around one trace or run. CX Codex +1 188installs investigating-ci-failures The investigating-ci-failures Claude Code skill traces an individual CI failure to its likely cause. It separates PR-specific problems from default-branch breaks and flaky tests. CX Codex +1 188installs review-hog-validation-criteria review-hog-validation-criteria serves as a final PR review gate, filtering candidate findings to keep real defects while discarding speculative noise. CX Codex +1 187installs

Project sponsors

Companies that keep this analytics open