Feature flag

Definition
A feature flag is a switch in the code that turns a feature on or off without a new deployment, letting a team control who sees it and when.

Why it matters

Without a flag, shipping a feature and releasing it to every user are the same event. A problem found afterwards can only be fixed by shipping again, often in a hurry. A flag separates the two. The code goes live quietly and is tried on a small group. It is switched on for everyone once it proves itself, or switched straight back off if something goes wrong. A risky release becomes a controlled one, and a rollback becomes a switch flip.

For people building with AI tools, where changes arrive fast, a flag also limits the harm from one that misbehaves.

How to apply it

  • Put any risky or customer-facing change behind a flag before it reaches production, not after a problem appears.
  • Release to internal accounts first, then a small percentage, and watch real numbers before widening.
  • Give every flag an owner and a removal date.
  • Remove the flag and the old code once the decision is final.

What it is

A feature flag is a condition wrapped around new behaviour: if the flag is on for this user, show the new version, otherwise show the old one. The flag's value lives in a settings screen or service, not in the code, so changing it takes seconds and needs no new release. It can be on for everyone, off for everyone, or on for chosen accounts or a percentage of users.

Common mistakes

  • Leaving flags in the code for months. Each one doubles the paths that need testing, and old flags become technical debt.
  • Treating a flag as a security control. Hiding a button is not the same as blocking access.
Worked example

A small software company ships a redesigned dashboard behind a flag, visible to a handful of internal accounts. Feedback shows that a report several customers rely on has changed in a confusing way. The team fixes it and widens the rollout in stages. When a bug appears days later, the fix is switching one flag off.

  1. Article

    Deployment

    The act of putting code live, which a flag separates from release.

  2. Article

    Staging environment

    The place to test before a flag reaches real users.

  3. Article

    A/B testing

    A flag that shows different versions to different groups.

  4. Article

    Edge case

    The kind of problem a staged rollout surfaces early.

Where it shows up

  • Build
    Writing copy that feels like conversation instead of marketing. How to sound like yourself.
    12 stepsValue creation