instrument-metrics
Installation
SKILL.md
Add PostHog metric capture
Use this skill to add PostHog metric capture (counters, gauges, and histograms) for new or changed code. Use it after implementing features or reviewing PRs to ensure key operations are measured, when the user asks to add metrics or counters, or to mirror existing metrics instrumentation into PostHog. Supports any platform or language.
Supported platforms: Web (JavaScript), Node.js, Python via the posthog.metrics SDK API, Kubernetes via the metrics agent, and any language via OpenTelemetry (OTLP).
Instructions
Follow these steps IN ORDER:
STEP 1: Analyze the codebase and detect the platform.
- Detect the language, framework, and existing metrics setup.
- Look for dependency files and project files (package.json, requirements.txt, pyproject.toml, go.mod, pom.xml, etc.).
- Look for existing metrics instrumentation: Prometheus clients (prom-client, prometheus_client), StatsD/Datadog clients, OpenTelemetry meters, or an OpenTelemetry Collector config.
- Check whether a PostHog SDK (posthog-js, posthog-node, posthog-python) is already installed.