Skip to main content
skill CX Codex

instrument-metrics — Claude Code skill for PostHog metrics

The instrument-metrics Claude Code skill adds PostHog metric capture to a codebase. It runs after feature work or PR review, and when a request calls for counters or other metrics.

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

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

What instrument-metrics does

The skill checks the project language and its current metrics setup, then adds PostHog capture. It can instrument counters, gauges, and histograms while leaving existing metrics in place. For new measurements, it chooses a metric type and assigns units to histograms.

An installed PostHog SDK can provide the capture API; projects already exporting OpenTelemetry metrics can redirect that exporter to PostHog. The fallback uses OpenTelemetry. Setup requires a PostHog project token and host, sourced from project configuration or the PostHog MCP server's projects-get tool. The skill puts credentials in environment variables and describes how to check incoming metrics in PostHog.

What it helps with

  • count successful and failed operations
  • measure request and job durations
  • send existing Prometheus or OpenTelemetry metrics to PostHog
  • configure an OTLP metrics exporter

Example prompts for the agent

  • Add PostHog metrics to the new API handlers.
  • After reviewing this PR, track failures and request durations.
  • Send the existing OpenTelemetry metrics to PostHog.

How to install instrument-metrics

1Skills CLI (Vercel)

npx skills add PostHog/ai-plugin --skill instrument-metrics -a claude-code

2Manually: put the files in place

~/.claude/skills/instrument-metrics/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/instrument-metrics/

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

Questions about instrument-metrics

How do I install instrument-metrics in Claude Code?

Run npx skills add PostHog/ai-plugin --skill instrument-metrics -a claude-code. The skill file is placed at ~/.claude/skills/instrument-metrics/SKILL.md.

What does instrument-metrics do?

It adds PostHog metric capture to project code or routes existing OpenTelemetry metrics to PostHog. The skill uses counters, gauges, or histograms according to the measurement.

What does instrument-metrics need to work?

It needs a PostHog project token and host. If the token is not already configured, it can be retrieved through projects-get on a connected, authenticated PostHog MCP server; otherwise, the project token is needed.

Similar skills

All skills for Backend and APIs →

From the same set82

The whole set →
modeling-revenue-metrics modeling-revenue-metrics builds reusable revenue models for MRR, ARR, churn, ARPU and LTV from PostHog views or dbt. Use it for revenue analysis by customer, product or period. CX Codex +1 175installs modeling-product-usage-metrics modeling-product-usage-metrics builds retention, frequency, and lifecycle models using PostHog HogQL views or dbt data marts with built-in tests. CX Codex +1 175installs modeling-dimension-tables modeling-dimension-tables builds star-schema dimension tables in PostHog HogQL views or dbt projects so you avoid repetitive joins across your metrics. CX Codex +1 174installs modeling-warehouse-foundations modeling-warehouse-foundations sets core guidelines for building PostHog data models via native HogQL views or an external dbt setup. CX Codex +1 172installs debugging-experiments debugging-experiments — a Claude Code skill for investigating PostHog experiment results. It checks uneven or missing exposures against the experiment’s data and known causes. CX Codex +1 150installs context-layer-health-check The context-layer-health-check Claude Code skill checks a context wiki after changes are consolidated. It triages missed entries, conflicting claims, and outdated priorities. CX Codex +1 150installs understanding-billing-usage understanding-billing-usage is a Claude Code skill that investigates PostHog usage and spend through Billing MCP tools. It handles questions about spikes, changes, and the products or projects behind usage. CX Codex +1 150installs building-html-canvases The building-html-canvases Claude Code skill builds PostHog canvases with semantic HTML, CSS, and browser APIs. It runs when a canvas request is routed to a plain HTML implementation. CX Codex +1 149installs

Project sponsors

Companies that keep this analytics open