05.3.1 · Skill in Controlled releases

Feature flags

Turning features on and off without deploying.

Feature flags separate deploying from releasing. They enable gradual rollouts, experiments, beta access and kill switches. Old flags need removing, or they become technical debt.

Your status · Feature flags

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

Flags let a small team merge and deploy every day, and decide separately when users see the change. The engineer decides where the check lives in the code. That choice decides whether turning the flag off is safe, and whether the flag is easy to remove later.

How to do it

  1. Decide what kind of flag it is before you add it. A release flag should live days or weeks. A kill switch for operations can stay longer. An experiment flag lives as long as the test. A permission flag can be permanent. Put the type in the name.
  2. Check the flag in one place, inside one function, as high in the code as you can: the route or the component that changes, not ten scattered if statements.
  3. Identify the user before you evaluate the flag, so the same person gets the same answer on every request and every device.
  4. Decide what the code does when the flag service does not answer. “Not evaluated yet” is not the same as “off”.
  5. Start with your own team, then a small share of users, and widen it while you watch errors and the one metric that matters.
  6. When the flag reaches 100%, delete the flag and the old code path in the same week.

Common mistakes

  • One flag checked in many files, so nobody is sure what turning it off does.
  • Flags evaluated in the browser before the user is known, so a user sees the new version, then the old one.
  • Release flags that stay for months. Ten on-off flags give 1,024 possible combinations, and nobody tests most of them.
  • Using a flag for settings that need a restart. That is configuration, not a feature flag.

Example

Mamitsu is built by one person with a team of coding agents. After a merge, the agent turns on a feature flag if the change needs one, watches the logs until about ten requests have gone through the new code, and rolls back if something breaks. That has happened once. Otherwise Unai Esteibar, its maker, gets a Slack message that all is well. (Mamitsu in In practice)

Sequence

What Mamitsu's agent does after a merge

AgentProductionUnai, on Slack01 Deploy the merge02 Turn on the flag, if needed03 Logs of about 10 requests04 Roll back if it breaks05 All is wellAgentProductionUnai, onSlack01 Deploy the merge02 Turn on the flag, if needed03 Logs of about 10 requests04 Roll back if it breaks05 All is well
  1. 04This has happened once.

The flag and the logs give the agent a small, fast check. A person hears about it only when something needs them.

Sources: Feature toggles (Pete Hodgson, martinfowler.com) ↗ · Best practices for production-ready flags (PostHog docs) ↗ · 11 feature flag best practices for scale (Unleash docs) ↗

AI leverage

Use AI in your work

Use AI to support this skill. Your judgment and verification remain part of the work.

Workflow
Draft rollout rules and a test matrix for flag combinations, including both enabled and disabled behavior.
Limitations
Generated conditions can expose the wrong cohort or leave an untested fallback.
Verification
Check targeting with representative identities and exercise disablement before widening exposure.

Technical leverage

Decouple release from deployment, compare cohorts and turn a failing change off without a full redeploy.

Evidence of mastery

Put it into practice
Practice
Release one improvement to a bounded cohort with explicit expansion criteria.
Artifact
A rollout record with exposure data, outcome metrics and a tested disable switch.

What good looks like

  • Both flag states work.
  • The flag has an owner and a removal condition.

Use this evidence to assess your work. Your map status is a self-assessment, not a certification.

In practice

Real products

Resources

2

Tools

3