skills/instrument-integration/SKILL.md
Add PostHog SDK integration to your application. Use when setting up PostHog for the first time or reviewing PRs that need PostHog initialization. Covers SDK installation, provider setup, and basic configuration for any framework.
npx skillsauth add posthog/ai-plugin instrument-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to add the PostHog SDK to an application. Use it when setting up PostHog for the first time, or reviewing PRs that need PostHog initialization. Covers SDK installation, provider setup, and basic configuration. Supports any framework or language.
Supported frameworks and languages: Next.js, React, React Router, Vue, Nuxt, TanStack Start, SvelteKit, Astro, Angular, Django, Flask, FastAPI, Laravel, PHP, Ruby on Rails, Go, Elixir, Android, iOS, Swift, Flutter, React Native, Expo, Node.js, and vanilla JavaScript.
Follow these steps IN ORDER:
Look for lockfiles (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lockb, go.sum, pubspec.lock, Podfile.lock, Package.resolved, mix.lock) to determine the package manager.
STEP 2: Research integration. 2.1. Find the reference file below that matches the detected framework — it is the source of truth for SDK initialization, provider setup, and configuration patterns. Read it now. 2.2. If no reference matches, fall back to your general knowledge and web search. Use posthog.com/docs as the primary search source.
STEP 3: Install the PostHog SDK.
STEP 4: Initialize PostHog.
STEP 5: Identify users.
identify() calls on the client side during login and signup events.X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers to the server-side code.STEP 6: Set up environment variables.
.env, .env.local, or framework-specific env files). If valid values already exist, skip this step.projects-get tool to retrieve the project's api_token. If multiple projects are returned, ask the user which project to use. If the MCP server is not connected or not authenticated, ask the user for their PostHog project API key instead.https://us.i.posthog.com for US Cloud or https://eu.i.posthog.com for EU Cloud..env.local for Next.js, .env for others) using the framework's naming convention.STEP 7: Verify and clean up.
references/EXAMPLE-next-app-router.md - next-app-router example project codereferences/EXAMPLE-next-pages-router.md - next-pages-router example project codereferences/EXAMPLE-react-react-router-6.md - react-react-router-6 example project codereferences/EXAMPLE-react-react-router-7-framework.md - react-react-router-7-framework example project codereferences/EXAMPLE-react-react-router-7-data.md - react-react-router-7-data example project codereferences/EXAMPLE-react-react-router-7-declarative.md - react-react-router-7-declarative example project codereferences/EXAMPLE-react-vite.md - react-vite example project codereferences/EXAMPLE-nuxt-3-6.md - nuxt-3-6 example project codereferences/EXAMPLE-nuxt-4.md - nuxt-4 example project codereferences/EXAMPLE-vue-3.md - vue-3 example project codereferences/EXAMPLE-react-tanstack-router-file-based.md - react-tanstack-router-file-based example project codereferences/EXAMPLE-react-tanstack-router-code-based.md - react-tanstack-router-code-based example project codereferences/EXAMPLE-tanstack-start.md - tanstack-start example project codereferences/EXAMPLE-sveltekit.md - sveltekit example project codereferences/EXAMPLE-astro-static.md - astro-static example project codereferences/EXAMPLE-astro-view-transitions.md - astro-view-transitions example project codereferences/EXAMPLE-astro-ssr.md - astro-ssr example project codereferences/EXAMPLE-astro-hybrid.md - astro-hybrid example project codereferences/EXAMPLE-angular.md - angular example project codereferences/EXAMPLE-javascript-node.md - javascript-node example project codereferences/EXAMPLE-javascript-web.md - javascript-web example project codereferences/EXAMPLE-django.md - django example project codereferences/EXAMPLE-flask.md - flask example project codereferences/EXAMPLE-fastapi.md - fastapi example project codereferences/EXAMPLE-python.md - python example project codereferences/EXAMPLE-laravel.md - laravel example project codereferences/EXAMPLE-php.md - php example project codereferences/EXAMPLE-ruby-on-rails.md - ruby-on-rails example project codereferences/EXAMPLE-ruby.md - ruby example project codereferences/EXAMPLE-android.md - android example project codereferences/EXAMPLE-swift.md - swift example project codereferences/EXAMPLE-react-native.md - react-native example project codereferences/EXAMPLE-expo.md - expo example project codereferences/next-js.md - Next.js - docsreferences/react.md - React - docsreferences/react-router-v6.md - React router v6 - docsreferences/react-router-v7-framework-mode.md - React router v7 framework mode (remix v3) - docsreferences/react-router-v7-data-mode.md - React router v7 data mode - docsreferences/react-router-v7-declarative-mode.md - React router v7 declarative mode - docsreferences/nuxt-js-3-6.md - Nuxt.js (v3.0 to v3.6) - docsreferences/nuxt-js.md - Nuxt.js - docsreferences/vue-js.md - Vue.js - docsreferences/tanstack-start.md - Tanstack start - docsreferences/svelte.md - Svelte - docsreferences/astro.md - Astro - docsreferences/angular.md - Angular - docsreferences/js.md - JavaScript web - docsreferences/posthog-js.md - PostHog JavaScript web SDKreferences/node.md - Node.js - docsreferences/posthog-node.md - PostHog Node.js SDKreferences/django.md - Django - docsreferences/flask.md - Flask - docsreferences/python.md - Python - docsreferences/posthog-python.md - PostHog python SDKreferences/dotnet.md - .net - docsreferences/elixir.md - Elixir - docsreferences/go.md - Go - docsreferences/laravel.md - Laravel - docsreferences/php.md - Php - docsreferences/ruby-on-rails.md - Ruby on rails - docsreferences/ruby.md - Ruby - docsreferences/android.md - Android - docsreferences/ios.md - Ios - docsreferences/usage.md - Ios SDK usage - docsreferences/configuration.md - Ios SDK configuration - docsreferences/flutter.md - Flutter - docsreferences/react-native.md - React native - docsreferences/identify-users.md - Identify users - docsEach framework reference contains SDK-specific installation, initialization, and usage patterns. Find the one matching the user's stack.
testing
Focused Signals scout for PostHog projects running surveys. Watches active surveys for score regressions (NPS / CSAT / rating drops), response-volume drops, abandonment spikes, and targeting drift, AND aggregates open-text responses into recurring themes the team should know about (clusters of complaints, praise, feature requests). Emits findings only when a theme or anomaly clears the confidence bar; otherwise writes durable memory and closes out empty. Self-contained peer in the signals-scout-* fleet — no dependencies on other skills. Picked uniformly at random by the coordinator alongside `signals-scout-general` and other specialists.
development
Focused Signals scout for PostHog projects using revenue analytics. Watches the derived revenue product for upstream failures (Stripe sync stalls, capture regressions), config drift (missing subscription property, currency mix surprises, broken Stripe↔person joins, deferred-revenue gaps), and goal-miss escalations. Emits findings only when they clear the confidence bar; otherwise writes durable memory and closes out empty. Self-contained peer in the signals-scout-* fleet — no dependencies on other skills. Picked uniformly at random by the coordinator alongside `signals-scout-general` and other specialists.
testing
Focused Signals scout for finding observability gaps in PostHog itself — significant event volumes the team isn't tracking, custom events with no insight or dashboard coverage, insights pointing at events that have stopped firing, dashboards missing related context, critical events with no alerts. Watches the event-stream-vs-saved- inventory delta as the team's product evolves and emits findings recommending new insights, dashboard additions, or alerts when gaps clear the confidence bar. Self-contained peer in the signals-scout-* fleet — picked uniformly at random by the coordinator alongside `signals-scout-general` and other specialists.
testing
Focused Signals scout for PostHog projects using logs. Watches for volume bursts, severity-distribution shifts, service silence, fresh message patterns, and trace-correlated bursts via the logs ingestion pipeline. Emits findings only when they clear the confidence bar; otherwise writes durable memory and closes out empty. Self-contained peer in the signals-scout-* fleet — no dependencies on other skills. Picked uniformly at random by the coordinator alongside `signals-scout-general` and other specialists.