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
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/analyzing-expensive-users/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/analyzing-expensive-users/
1Skills CLI (Vercel)
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a codex2Manually: put the files in place
.agents/skills/analyzing-expensive-users/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a cursor2Manually: put the files in place
.cursor/skills/analyzing-expensive-users/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install PostHog/ai-plugin skills/analyzing-expensive-users2Manually: put the files in place
.github/skills/analyzing-expensive-users/SKILL.md1Skills CLI (Vercel)
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a gemini-cli2Platform CLI
gemini skills install https://github.com/PostHog/ai-plugin --path skills/analyzing-expensive-usersManually: put the files in place
.devin/skills/analyzing-expensive-users/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.