audit-events · v1.55.0 · 2026-09-26 · sha256 1f0fb77d241b9c5b
audit-events v1.55.0A
Immutable. This exact content never changes and is served at /api/v1/blob/1f0fb77d241b9c5b.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_mvnrb6qrl4ene5b4/1f0fb77d241b9c5be82c3be8b0bb493cadddde231f5645445ae3d3858c0acc57.json
Then /plugin install audit-events@markdownregistry-mvnrb6qrl4ene5b4 in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.
---
name: audit-events
description: >-
Audit a PostHog integration's event capture quality and cost-optimization
opportunities
metadata:
author: PostHog
version: 1.55.0
---
# PostHog Audit — Events
This skill audits an existing PostHog integration's **event capture quality** for both correctness (fix) and cost-optimization (optimize). **Read-only** — the only file you create is the final audit report. The audit never mutates PostHog state and never edits project source.
The audit covers two lenses:
- **Fix** — quality checks on `posthog.capture()` call sites: static event names, naming consistency, duplicate / kitchen-sink events, and codebase-specific quality issues (PII, cardinality, hot paths, JSON-stringified payloads, missing `$session_id`). These reuse the broader PostHog audit's event-capture and event-quality checks.
- **Optimize** — cost-side checks on event usage downstream, autocaptured pageview defaults on high-traffic SPAs, and dev/staging events leaking into production. These use PostHog MCP to read the operator's tenant; they gracefully skip if MCP is unavailable.
## Workflow
The audit runs as a step chain. **The exact step list lives in the reference files themselves, not in this overview.** Step 1 lives at `references/1-presence.md`; each step file ends with a `next_step:` frontmatter pointer to the next, and the final step has `next_step: null`. Follow them in the order they point. You must resolve each step in order before any source-tree exploration.
Step 1 seeds the audit ledger itself with one pending check per event check through `mcp__wizard-tools__audit_seed_checks`, because the runtime does not pre-seed this skill. **Each step gracefully handles a missing check id**: if a step's expected id is not in the ledger, it skips its `audit_resolve_checks` call for that id and continues. Use `mcp__wizard-tools__audit_resolve_checks` to patch each check as you finish it.
**Start by reading the path relative to this file at `references/1-presence.md`.** Do not Glob, ls, or find the skill directory. Do not preload future steps. Do not re-read a step file once you've moved past it. Do not re-read SKILL.md.
`ToolSearch` is only for loading a tool by exact name when the SDK has it deferred (e.g. `select:Grep`). Do **not** use it to browse for other tools — every tool the audit needs (`Glob`, `Grep`, `Read`, `Write`, `Bash`, the named `mcp__wizard-tools__audit_*` tools) is already named in this skill. The optimize-side checks reach PostHog through its single `exec` tool, described in the optimize reference.
**Do not call `TaskCreate` / `TaskUpdate` / `TaskGet` / `TaskList`.** The audit doesn't track its own task list — progress comes from the audit ledger plus `[STATUS]` lines.
## Live activity — `[STATUS]`
The "Working on …" banner reads from `[STATUS]` lines you emit in plain text. Whenever you start a new sub-step, write a line like:
```
[STATUS] Scanning capture call sites
```
The wizard intercepts these and updates the spinner. Use them freely — they are cheap. Each step file lists the exact `[STATUS]` strings to emit at each sub-step.
## Audit checks ledger
The ledger lives at `.posthog-audit-checks.json` and is rendered live in the "Audit plan" tab. It is owned by MCP tools — **never `Write` this file directly**:
- `mcp__wizard-tools__audit_seed_checks({ checks })` — writes the full pending checklist once, at Step 1. The tool replaces the file atomically, so one call per run is safe.
- `mcp__wizard-tools__audit_resolve_checks({ updates })` — patch one or more checks by `id`. Each `update` is `{ id, status, file?, details? }`. Batch updates from the same step into a single call.
All audit ledger calls are atomic and serialize internally — **concurrent calls from parallel subagents cannot lose updates**, so feel free to fan out runtime checks across `Agent` subagents when a step says so.
### Check entry shape
- `id` — stable kebab-case slug. Reuse the existing seeded ids exactly when calling `audit_resolve_checks`.
- `area` — short group name. This skill seeds two areas: `Event Capture` (fix) and `Event Capture — Optimize` (cost).
- `label` — short human name.
- `status` — `pending` | `pass` | `error` | `warning` | `suggestion`.
- `file` — optional `path:line` for findings tied to a location.
- `details` — optional one-line explanation.
After the final step writes the report, delete `.posthog-audit-checks.json`.
## Severity levels
- `error`: Must fix. Broken functionality, data corruption, or security issue.
- `warning`: Should fix. Pattern that causes subtle bugs or data-quality problems.
- `suggestion`: Nice to have. Best-practice improvement or cost-savings opportunity.
## Key principles
- **Read-only**: Do not edit project source files. The only file you create is the audit report.
- **Evidence-based**: Reference specific `file:line` for every non-pass finding. For MCP-based optimize checks, include the SQL or MCP call summary in `details`.
- **Actionable**: Every finding states what to fix and how.
- **Graceful MCP fallback**: When PostHog MCP is unavailable, optimize checks resolve as `suggestion` with `details: "PostHog MCP unavailable — could not measure X"`. Do not block the audit.
## Abort statuses
Report abort states with `[ABORT]` prefixed messages. The wizard catches these and terminates the run — do not halt yourself.
- PostHog SDK initialization not found (no `posthog.init` and no `posthog.capture` anywhere in the codebase)
## Framework guidelines
- A missing PostHog configuration must never break the app — read keys optionally (never a required setting), guard init and capture behind their presence, and keep build and boot working with no PostHog environment set — but never silently: in development or debug builds fail loudly, using the language's idiomatic error, with the message "<VAR> variable required by PostHog is missing or un-configured, this causes events to be silently missed. This error stops appearing once <VAR> is configured" (substituting the actual variable name); production stays a no-op