Skip to main content
skill CX Codex

investigating-metric-anomalies skill for Claude Code: anomaly triage

investigating-metric-anomalies turns a PostHog Metrics symptom (rising lag, error spike, falling throughput) into a probable cause backed by logs and traces.

no license 206 installs ★ 101 updated 2026-10-24

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

What investigating-metric-anomalies does

Starts from a symptom in PostHog Metrics and works toward a cause you can defend. The metric name comes first: metric-names-list takes a fragment such as lag or error, and the type it returns decides the lens, since counters only make sense as a rate or increase, gauges as an average, histograms as a quantile.

One call to characterize-metric-anomaly with anomalyFrom answers three things: how far the value moved, when it started (onset_time), and which label values shifted (top_movers). A single pod or shard in the movers points at a local fault; everything moving at once points upstream. query-metrics then tests those guesses with filters and formulas like errors / requests, and logs (query-logs) plus spans (query-apm-spans) get pulled for the same service in a window around onset_time.

It runs on a project that already has PostHog Metrics and the PostHog MCP tools wired up. Without them there is nothing to call. Scraped Prometheus series also lag real time by 15–60 seconds, so the newest bucket is not the current value.

What it helps with

  • pin down which metric an alert refers to
  • date the onset of a spike from the alert time
  • split a single-pod fault from a shared upstream cause
  • separate a real error increase from a traffic jump
  • tie a metric spike to a process restart in the logs

Example prompts for the agent

  • Ingestion lag is climbing since 20:10 — find the metric and show what moved.
  • Investigate logs_rate_limiter_message_lag_seconds from the alert time and check that service's logs around the onset.
  • Error rate on the checkout endpoint is spiking; look at metrics first, then spans and logs for the same window.

How to install investigating-metric-anomalies

1Skills CLI (Vercel)

npx skills add PostHog/ai-plugin --skill investigating-metric-anomalies -a claude-code

2Manually: put the files in place

~/.claude/skills/investigating-metric-anomalies/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/investigating-metric-anomalies/

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

Questions about investigating-metric-anomalies

How do I install investigating-metric-anomalies in Claude Code?

Run npx skills add PostHog/ai-plugin --skill investigating-metric-anomalies -a claude-code; the skill lands at ~/.claude/skills/investigating-metric-anomalies/SKILL.md.

What does investigating-metric-anomalies do?

It takes an anomaly from symptom to evidence: identifies the metric, measures the shift and its onset, then looks for what changed in the logs and traces at that moment.

What does it need to work?

A project with PostHog Metrics and the PostHog MCP tools in place: metric listing, anomaly characterization, metric queries, log queries and APM spans. The whole loop runs on those calls.

Similar skills

All skills for DevOps and infrastructure →

From the same set82

The whole set →
authoring-error-tracking-alerts authoring-error-tracking-alerts guides your agent in configuring PostHog error tracking notifications, selecting lifecycle triggers, and connecting them to Slack or webhooks. CX Codex +1 209installs building-a-dashboard building-a-dashboard — a skill for Claude Code, Codex, and Cursor that builds and updates PostHog dashboards via MCP tools. Coordinates insight reuse and grid layout. CX Codex +1 208installs filtering-bot-traffic filtering-bot-traffic splits human traffic from bots and AI crawlers in PostHog. Use it to clean a metric or to see how much of the traffic runs on autopilot. CX Codex +1 208installs choosing-trend-or-slope-view choosing-trend-or-slope-view — a skill that settles what “change over time” means before a chart gets built: the full trend interval by interval, or only the gap between the two ends. CX Codex +1 204installs auditing-warehouse-source-health auditing-warehouse-source-health audits PostHog data warehouse sources and syncs to pinpoint broken connectors, failed schemas, and degraded webhooks. CX Codex +1 204installs signals-scout-product-analytics signals-scout-product-analytics — a skill for Claude Code and Codex monitoring core product analytics flows in PostHog. Detects derived-rate regressions across funnels and retention while entrant volume holds steady. CX Codex +1 204installs auditing-warehouse-view-health auditing-warehouse-view-health runs a project-wide check on PostHog materialized views: lists the ones that failed to refresh and points at materialized views nobody queries. CX Codex +1 204installs building-workflows building-workflows is a Claude Code skill for building, patching, and testing PostHog automation graphs over MCP before publishing them in the visual editor. CX Codex +1 204installs

Project sponsors

Companies that keep this analytics open