Implement PostHog feature flags, A/B experiments, and cohort management.
Use when rolling out features with flags, running A/B tests, creating cohorts,
or evaluating multivariate experiments with PostHog.
Trigger: "posthog feature flag", "posthog experiment", "posthog A/B test",
"posthog cohort", "feature rollout posthog", "posthog multivariate".
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Implement PostHog feature flags, A/B experiments, and cohort management.
Use when rolling out features with flags, running A/B tests, creating cohorts,
or evaluating multivariate experiments with PostHog.
Trigger: "posthog feature flag", "posthog experiment", "posthog A/B test",
"posthog cohort", "feature rollout posthog", "posthog multivariate".
Designed for Claude Code, also compatible with Codex and OpenClaw
PostHog Core Workflow B — Feature Flags & Experiments
Overview
Feature flag management, A/B experiment evaluation, and cohort analysis with PostHog. Covers boolean and multivariate flags, local evaluation for performance, experiment setup and statistical significance, and cohort creation via the API.
Prerequisites
Completed posthog-install-auth setup
Familiarity with posthog-core-workflow-a (event capture)
Personal API key (phx_...) for flag management API
Instructions
Step 1: Evaluate Feature Flags (Browser)
import posthog from'posthog-js';
// Boolean flagif (posthog.isFeatureEnabled('new-checkout-flow')) {
renderNewCheckout();
} else {
renderLegacyCheckout();
}
// Multivariate flag (returns string variant name)const variant = posthog.getFeatureFlag('pricing-page-experiment');
switch (variant) {
case'control':
renderOriginalPricing();
break;
case'annual-first':
renderAnnualFirstPricing();
break;
case'social-proof':
renderSocialProofPricing();
break;
default:
renderOriginalPricing(); // Fallback if flag not loaded yet
}
// Get flag payload (JSON data attached to a flag variant)const payload = posthog.getFeatureFlagPayload();
posthog.( {
enabled = posthog.();
(enabled ?? );
});