# analyzing-expensive-users

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.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 192 installs · ★ 101 repo stars
- Author: PostHog
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/PostHog/ai-plugin/tree/HEAD/skills/analyzing-expensive-users/SKILL.md
- Updated: 2026-11-16
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/analyzing-expensive-users

## What it 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.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/analyzing-expensive-users/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/analyzing-expensive-users/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/analyzing-expensive-users/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/analyzing-expensive-users/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install PostHog/ai-plugin skills/analyzing-expensive-users
```

2. **Manually: put the files in place**
- File: `.github/skills/analyzing-expensive-users/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/PostHog/ai-plugin --path skills/analyzing-expensive-users
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/analyzing-expensive-users/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add PostHog/ai-plugin --skill analyzing-expensive-users -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/PostHog/ai-plugin/tree/HEAD/skills/analyzing-expensive-users/SKILL.md

## When to use it
- 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
- 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

## Similar
- [exploring-llm-clusters](https://affpapa.org/en/nevibecode/skills/exploring-llm-clusters.md) — skill · 436 installs
- [exploring-llm-costs](https://affpapa.org/en/nevibecode/skills/exploring-llm-costs.md) — skill · 416 installs
- [analyzing-mlflow-trace](https://affpapa.org/en/nevibecode/skills/analyzing-mlflow-trace.md) — skill · 1000 installs
- [agent-observability-auto-experiment](https://affpapa.org/en/nevibecode/skills/agent-observability-auto-experiment.md) — skill · 589 installs
- [analyzing-mlflow-session](https://affpapa.org/en/nevibecode/skills/analyzing-mlflow-session.md) — skill · 966 installs
- [analyzing-data](https://affpapa.org/en/nevibecode/skills/analyzing-data.md) — skill · 1500 installs

From the same set: [posthog/ai-plugin](https://affpapa.org/en/nevibecode/by/posthog/ai-plugin.md) — 82 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
