feature-flags
Installation
SKILL.md
Wire PostHog feature flags end-to-end — server-side evaluation, client-side hook, and local dev overrides. Reads the project first, extends the existing PostHog setup if present.
Two things that silently break PostHog flags
- Evaluating flags client-side when you need server-side behavior.
useFeatureFlagEnabledruns in the browser after hydration. If you're using a flag to show/hide a page section, that section flashes on then disappears. For anything above the fold or that affects routing, evaluate the flag on the server. - Missing
distinctIdin server-side calls. PostHog's server SDK requires a distinct user identifier to evaluate flags. Using a placeholder like"anonymous"means every unauthenticated user gets the same flag variant — not a rollout, just a constant.
Phase 1: Detect the Project
cat package.json | grep -E "posthog"
grep -r "posthog" src/ app/ --include="*.ts" --include="*.tsx" -l 2>/dev/null | head -5
posthog-jsinstalled + provider found? → PostHog client-side already set up. Add server-side SDK.posthog-nodealready installed? → extend it, don't reinstall.- Nothing? → wire up PostHog from scratch with the add-analytics skill first, then return here.