# Why ship behind a flag?

Source: https://www.sheepit.ai/docs/concepts/flags

_Four moments when a feature flag saves you a Saturday._

A feature flag is a switch in your code. The new feature ships off by default. You flip it on for a slice of users, watch what happens, then expand — or roll it back on the SDK's next check-in if something breaks. No re-deploy, no panic — see the callout below on how the check-in timing works.

Most teams build flags themselves, badly, three times before they admit they need a real one. Here are the four moments when the cost-of-not-having-a-flag shows up.

## 1. The risky release

You're shipping a checkout rewrite. It works on staging. It worked in code review. It will probably work in production. "Probably" is the word that costs you weekends. Ship it behind a flag, flip it on for 5%, watch your conversion rate for an hour. If it holds, expand. If it doesn't, you flip it back in the time it takes to refresh a dashboard.

## 2. The A/B test you keep meaning to run

Sheepit experiments are flags with two variants and a metric attached. Same code path, same SDK, same audit log. You don't need a second tool, a third dashboard, or a stats consultant — just pick a flag, pick a goal, split traffic, wait for significance.

## 3. The paid feature

Pro-tier features are the same switch, gated by a different rule. Free users get false. Pro users get true. Trial users get true for 14 days. Internal users get true forever. All of that is one flag and a handful of rules.

> **Warning:** A flag decides what your app shows, not what a user is allowed to do. The app receives the flag's value, and a modified app can ignore it — so hide the Pro button with a flag, but check the subscription on your server before serving the Pro feature.

## 4. The beta group

You're showing the new dashboard to your three friendliest customers before everyone else sees it. Create a cohort ("emails ending in @acme.com"), attach the flag, done. When you're ready to expand, you change the rule — not the code.

## Not ready yet? Create it as a draft

A draft flag isn't sent to any app: every SDK returns the default compiled into your code. Codegen still emits its key (marked as a draft), so you can write the code, set up its rules, prepare a rollout, and publish when you're ready — the rollout starts after you publish, so give its steps dates after your publish date. Publishing is one-way: once a flag is live, retire it by archiving it.

> **Note:** If you find yourself wrapping a new feature in if (DEBUG) { ... } you've just built a flag — minus the controls, the audit log, and the ability to flip it without a deploy. Use the real thing.

> **Note:** A flip isn't instant — each SDK picks it up on its own refresh schedule, not the moment you flip it. iOS is the slowest by default.

**Do next:** [Install the SDK →](https://www.sheepit.ai/docs/sdks.md)
