Labsco
posthog logo

instrument-feature-flags

β˜… 59

by posthog Β· part of posthog/ai-plugin

Use this skill to add PostHog feature flags that gate new or changed functionality. Use it after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup
🧩 One of 7 skills in the posthog/ai-plugin package β€” works on its own, and pairs well with its siblings.

This is the playbook your agent receives when the skill activates β€” you don't need to read it to use the skill, but it's here to audit before installing.

by posthog

Use this skill to add PostHog feature flags that gate new or changed functionality. Use it after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language. npx skills add https://github.com/posthog/ai-plugin --skill instrument-feature-flags Download ZIPGitHub59

Add PostHog feature flags

Use this skill to add PostHog feature flags that gate new or changed functionality. Use it after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language.

Supported platforms: React, Next.js, React Native, Web (JavaScript), Node.js, Python, PHP, Ruby, Go, Java, Rust, .NET, Elixir, Android, iOS, Flutter, and the REST API.

Instructions

Follow these steps IN ORDER:

STEP 1: Analyze the codebase and detect the platform.

Reference files

  • references/react.md - React feature flags installation - docs

  • references/react-native.md - React native feature flags installation - docs

  • references/web.md - Web feature flags installation - docs

  • references/nodejs.md - Node.js feature flags installation - docs

  • references/python.md - Python feature flags installation - docs

  • references/django.md - Django - docs

  • references/flask.md - Flask - docs

  • references/php.md - Php feature flags installation - docs

  • references/laravel.md - Laravel - docs

  • references/ruby.md - Ruby feature flags installation - docs

  • references/ruby-on-rails.md - Ruby on rails - docs

  • references/go.md - Go feature flags installation - docs

  • references/java.md - Java feature flags installation - docs

  • references/rust.md - Rust feature flags installation - docs

  • references/dotnet.md - .net feature flags installation - docs

  • references/dotnet.md - .net - docs

  • references/elixir.md - Elixir feature flags installation - docs

  • references/android.md - Android feature flags installation - docs

  • references/ios.md - Ios feature flags installation - docs

  • references/usage.md - Ios SDK usage - docs

  • references/flutter.md - Flutter feature flags installation - docs

  • references/api.md - API feature flags installation - docs

  • references/next-js.md - Next.js - docs

  • references/adding-feature-flag-code.md - Adding feature flag code - docs

  • references/best-practices.md - Best practices for production-ready flags - docs

Each platform reference contains SDK-specific installation, flag evaluation, and code examples. Find the one matching the user's stack. If unlisted, use the API reference as a fallback.

Key principles

  • Environment variables: Always use environment variables for PostHog keys. Never hardcode them.

  • Minimal changes: Add feature flag code alongside existing logic. Don't replace or restructure existing code.

  • Boolean flags first: Default to boolean flag checks unless the user specifically asks for multivariate flags.

  • Server-side when possible: Prefer server-side flag evaluation to avoid UI flicker.