posthog-local-dev-loop

Featured

Configure PostHog local development with mocking, debug mode, and testing. Use when setting up a development environment, mocking PostHog for tests, or establishing a fast iteration cycle with posthog-js or posthog-node. Trigger: "posthog dev setup", "posthog local development", "posthog dev environment", "mock posthog", "test posthog".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PostHog Local Dev Loop ## Overview Set up a fast local development workflow for PostHog integrations. Covers debug mode for event inspection, mocking posthog-node for unit tests, and a dev/test PostHog project to avoid polluting production data. ## Prerequisites - Completed `posthog-install-auth` setup - Node.js 20+ with npm/pnpm - Vitest or Jest for testing - Separate PostHog project for development (recommended) ## Instructions ### Step 1: Project Structure ``` my-posthog-app/ ├── src/ │ ├── analytics/ │ │ ├── posthog.ts # Singleton client │ │ ├── events.ts # Event taxonomy (typed constants) │ │ └── flags.ts # Feature flag keys │ └── index.ts ├── tests/ │ ├── analytics.test.ts # Unit tests with mocked PostHog │ └── integration.test.ts # Integration tests (real PostHog dev project) ├── .env.local # Dev keys (git-ignored) ├── .env.example # Template: NEXT_PUBLIC_POSTHOG_KEY=phc_... └── package.json ``` ### Step 2: PostHog Client with Dev Mode ```typescript // src/analytics/posthog.ts import { PostHog } from 'posthog-node'; let client: PostHog | null = null; export function getPostHog(): PostHog { if (!client) { client = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { host: process.env.POSTHOG_HOST || 'https://us.i.posthog.com', flushAt: process.env.NODE_ENV === 'development' ? 1 : 20, flushInterval: process.env.NODE_ENV === 'development' ? 0 : 10000, ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

posthog-performance-tuning

Optimize PostHog performance: local flag evaluation, client batching config, event sampling, efficient HogQL queries, and serverless flush patterns. Trigger: "posthog performance", "optimize posthog", "posthog latency", "posthog caching", "posthog slow", "posthog batch", "posthog fast".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-hello-world

Create a minimal working PostHog example with event capture, identify, and feature flags. Use when starting a new PostHog integration, testing your setup, or learning basic posthog-js and posthog-node patterns. Trigger: "posthog hello world", "posthog example", "posthog quick start", "simple posthog code", "first posthog event".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-install-auth

Install and configure PostHog SDKs with authentication. Use when setting up posthog-js (browser), posthog-node (server), or configuring API keys for a new PostHog integration. Trigger: "install posthog", "setup posthog", "posthog auth", "configure posthog API key", "posthog init".

2,266 Updated today
jeremylongshore
AI & Automation Featured

posthog-ci-integration

Configure PostHog CI/CD with GitHub Actions: unit tests with mocked PostHog, integration tests against a dev project, and deployment annotations. Trigger: "posthog CI", "posthog GitHub Actions", "posthog automated tests", "CI posthog", "posthog pipeline".

2,266 Updated today
jeremylongshore
AI & Automation Featured

hubspot-local-dev-loop

Configure HubSpot local development with testing and sandbox accounts. Use when setting up a development environment, mocking HubSpot APIs, or establishing a fast iteration cycle for HubSpot integrations. Trigger with phrases like "hubspot dev setup", "hubspot local development", "hubspot test sandbox", "develop with hubspot", "mock hubspot".

2,266 Updated today
jeremylongshore