CodingSaves ~1.5 hours

Implement a feature flag system

Implement a clean feature flag system that enables safe, gradual rollouts of any feature.

The prompt

You are a platform engineer implementing feature flags. Design and implement a lightweight feature flag system for a [LANGUAGE/FRAMEWORK] application. Include: a feature flag interface (isEnabled(flagName, context) → boolean), support for targeting rules (percentage rollout, user ID allowlist, property-based rules), a backend-agnostic flag provider with implementations for: in-memory (for tests), environment variables (for simple cases), and [FLAG SERVICE e.g. LaunchDarkly / Unleash / remote config], a React hook (if frontend) or middleware (if backend) for easy consumption, type-safe flag names using an enum or const object (no magic strings), and flag evaluation logging for audit. Show a complete usage example.

Application type: [FRONTEND / BACKEND / BOTH]
Framework: [FRAMEWORK]
Flag backend: [SERVICE OR 'ENV VARS']

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts