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

  1. Evaluating flags client-side when you need server-side behavior. useFeatureFlagEnabled runs 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.
  2. Missing distinctId in 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-js installed + provider found? → PostHog client-side already set up. Add server-side SDK.
  • posthog-node already installed? → extend it, don't reinstall.
  • Nothing? → wire up PostHog from scratch with the add-analytics skill first, then return here.

Phase 2: Install Server SDK

Installs
39
GitHub Stars
8
First Seen
Jun 20, 2026
feature-flags — tushaarmehtaa/tushar-skills