posthog-multi-env-setup
Configure PostHog across development, staging, and production environments. Separate PostHog projects per environment, environment-specific SDK config, feature flag rollout per env, and session recording controls. "posthog environment setup", "posthog project per env". '
npx skills add jeremylongshore/claude-code-plugins-plus-skills --skill posthog-multi-env-setup --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PostHog Multi-Environment Setup ## Overview Use separate PostHog projects for each environment (dev, staging, production). This prevents dev/test events from polluting production analytics, allows different feature flag rollout percentages per environment, and lets you disable session recordings in non-production. ## Prerequisites - PostHog Cloud account or self-hosted instance - Admin access to create multiple projects - Deployment platform with environment variable support ## Environment Strategy | Environment | PostHog Project | Session Recording | Autocapture | Feature Flags | |-------------|----------------|-------------------|-------------|---------------| | Development | `myapp-dev` | Disabled | Enabled | 100% rollout (test all) | | Staging | `myapp-staging` | Disabled | Enabled | 100% rollout (QA all) | | Production | `myapp-prod` | 10% sampled | Tuned | Gradual rollout | ## Instructions ### Step 1: Create Separate PostHog Projects In PostHog Cloud (app.posthog.com), create three projects: 1. `myapp-development` — copy the `phc_...` project API key 2. `myapp-staging` — copy the `phc_...` project API key 3. `myapp-production` — copy the `phc_...` project API key ### Step 2
- Overview
- Prerequisites
- Environment Strategy
- Instructions
- Step 1: Create Separate PostHog Projects
- Step 2: Environment Variables
- Step 3: Environment-Aware SDK Configuration
- Step 4: Browser SDK with Environment Config
- Step 5: Server SDK with Environment Config
- Step 6: Feature Flag Rollout Per Environment
- Error Handling
- Output
- Resources
- Next Steps
Production (secret manager — never in files) set -euo pipefail Set all flags to 100% in staging project (for QA) curl "https://app.posthog.com/api/projects/$POSTHOG_STAGING_PROJECT_ID/feature_flags/" \ jq -r '.results[].id' | while read FLAG_ID; do curl -X PATCH "https://app.posthog.com/api/projects/$POSTHOG_STAGING_PROJECT_ID/feature_flags/$FLAG_ID/" \ done
What does the posthog-multi-env-setup skill do?
Configure PostHog across development, staging, and production environments. Separate PostHog projects per environment, environment-specific SDK config, feature flag rollout per env, and session recording controls. "posthog environment setup", "posthog project per env". '
How do I install it?
Run `npx skills add jeremylongshore/claude-code-plugins-plus-skills --skill posthog-multi-env-setup --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From jeremylongshore/claude-code-plugins-plus-skills, a repository with 2,630 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.