Omnibus
200 skills · 1230 min
Omnibus
Skill 78 of 200
Add PostHog SDK integration to your application. Use when setting up PostHog for the first time or reviewing PRs that need PostHog initialization.
4 minutes · 932 words · 4 sections
Install
npx skills add PostHog/skills --skill instrument-integrationnpx skills add PostHog/skills/plugin marketplace add PostHog/skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
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 token instead.projects-get MCP response for a region field — US maps to https://us.i.posthog.com, EU maps to https://eu.i.posthog.com. If the region is not available from the MCP response or from existing project configuration, ask the user: “Are you on PostHog US Cloud or EU Cloud?” Do not assume US 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 codeEach framework reference contains SDK-specific installation, initialization, and usage patterns. Find the one matching the user’s stack.
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.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 24 September 2026.SKILL.md, not by matching a directory convention. 2 distinct layouts observed: skills/omnibus/*/SKILL.md, skills/posthog/all/skills/*/SKILL.md.h1 and no skipped levels:references/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.jsreferences/react.md - Reactreferences/react-router-v6.md - React router v6references/react-router-v7-framework-mode.md - React router v7 framework mode (remix v3)references/react-router-v7-data-mode.md - React router v7 data modereferences/react-router-v7-declarative-mode.md - React router v7 declarative modereferences/nuxt-js-3-6.md - Nuxt.js (v3.0 to v3.6)references/nuxt-js.md - Nuxt.jsreferences/vue-js.md - Vue.jsreferences/tanstack-start.md - Tanstack startreferences/svelte.md - Sveltereferences/astro.md - Astroreferences/angular.md - Angularreferences/js.md - JavaScript webreferences/posthog-js.md - PostHog JavaScript web SDKreferences/node.md - Node.jsreferences/posthog-node.md - PostHog Node.js SDKreferences/django.md - Djangoreferences/flask.md - Flaskreferences/python.md - Pythonreferences/posthog-python.md - PostHog python SDKreferences/dotnet.md - .netreferences/elixir.md - Elixirreferences/go.md - Goreferences/laravel.md - Laravelreferences/php.md - Phpreferences/ruby-on-rails.md - Ruby on railsreferences/ruby.md - Rubyreferences/android.md - Androidreferences/ios.md - Iosreferences/usage.md - Ios SDK usagereferences/configuration.md - Ios SDK configurationreferences/flutter.md - Flutterreferences/react-native.md - React nativereferences/identify-users.md - Identify usersreferences/COMMANDMENTS.md - Framework-specific rules the integration must follow.claude-plugin/marketplace.json by PostHog, declaring 6 plugins. It is read for editorial metadata only — never as the skill index, which is always the repository tree./PostHog/skills.md, and each skill at its own .md URL.69 files · 1.5 MB
Everything this skill ships beside its prose. All of it is set here, as subchapters of skill 78.
Documentation the agent loads on demand, rather than up front.