Feature flag
A switch that turns a feature on or off at runtime, so code can ship to production while staying invisible to users.
See it
What it is
A feature flag is an 'if' statement whose answer lives outside your code: a config value, a dashboard switch, a row in a database. The new checkout flow ships to production on Tuesday, stays dark, and gets turned on Thursday at 10am without a deploy. Deploy and release become two separate events, which is the whole point.
Flavors worth knowing: a release flag hides unfinished work, an experiment flag splits traffic for measurement, a kill switch instantly disables a risky integration, and a permission flag gates a feature to specific plans or accounts. Tools like LaunchDarkly, Statsig, Unleash, PostHog, and Vercel Flags do the plumbing, but a single boolean in an env var counts too.
Gotcha: flags are debt with a half-life. Every flag doubles the number of code paths you have to reason about and test, and a codebase with forty stale flags is genuinely harder to change than one with none. Give each flag an owner and a removal date when you create it. Also, flags do not protect the database: the flagged-off code path may be invisible, but its schema changes already shipped.
Ask AI for it
Add a feature flag around this feature. Keep flag state in a runtime flag provider or a database-backed config service, not in environment variables, since those normally need a restart or a redeploy to change and that defeats the entire point. Create a typed flag module with a single isEnabled(flagName, context) function that reads the current value through a short-TTL cache and falls back to a hardcoded default of off, so a missing value or an unreachable provider never turns anything on. Wrap the new code path in the flag and keep the old path intact and reachable. Support percentage rollout with deterministic bucketing: hash the user id into a 0-99 bucket so the same user always lands the same way. Give me an authenticated control surface (an admin page or a CLI command) that changes a flag with no deploy, and add a short comment on each flag noting its owner and when it should be deleted.