Skip to content

How to understand feature flags in a codebase

Feature flags mean the code you read isn't necessarily the code that runs. How to find flags, see which paths are live, and clean up flags that are always on.

October 13, 2026 · 2 min read · RepoGrasp team

Feature flags let a team ship code that's switched off, roll it out gradually, or turn it off quickly in an emergency. They also mean that a codebase contains several versions of its own behaviour, and you can't tell from the code alone which one users see.

Find how flags are read

Most codebases have one way of checking a flag, though older ones may have several:

  • A flag service SDK (LaunchDarkly, Statsig, Unleash, GrowthBook, PostHog, Flagsmith and others): calls like isEnabled('new-checkout') or useFlag('new-checkout')
  • Environment variables: process.env.ENABLE_NEW_CHECKOUT === 'true'
  • Config files or database settings
  • Hard-coded constants left from a past rollout

Find the helper function or hook and search for every call.

List the flags

FlagWhere checkedWhat it switchesStatus
new-checkoutCheckout.tsx:40, api/orders.ts:15New checkout flow50% rollout
legacy-taxpricing.ts:88Old tax calculationOff since March

Status comes from the flag service dashboard or config, not the code. Ask someone who has access.

Read both branches

When a flag is checked, both branches are live code until the flag is removed. Note where the paths differ and where they rejoin. Pay attention to data: if the new path writes data in a new format, the old path must still be able to read it, in case the flag is turned off.

Watch for flags evaluated in several places

A flag checked on both the client and the server can disagree if they evaluate it differently (different user context, cached values). Make sure both sides use the same evaluation.

Find stale flags

Flags that have been fully on or fully off for months are technical debt: they double the paths you have to read. Signs of stale flags:

  • The flag service shows 100% or 0% for a long time
  • The flag's name references a launch that's long past
  • One branch has had no changes in a year

Removing them is one of the best ways to make code easier to understand. Remove the flag check, delete the dead branch, and delete the flag in the service.

Ask which path runs

Ask RepoGrasp "which feature flags affect the checkout flow, and what does each branch do?" It finds flag checks across files and cites them. It can't see your flag service's current settings, so combine its answer with the dashboard to know what's live.

Try it.