Feature flags are easy to create and easy to forget. Old flags clutter code and confuse new teammates. A few habits keep them under control.
Name them so people can understand them
| Better | Worse |
|---|---|
| new_checkout_flow | flag1 |
| enable_dark_mode | test |
| max_upload_size | newCheckoutFlow (inconsistent style) |
Keep keys in lower case with underscores and describe what the flag does. Use a readable name and a description in the dashboard, too.
A flag has a life
- CreateBuild and test behind the flag in Development.
- StageEnable in Staging and test both on and off.
- ReleaseEnable in Production with a gradual rollout.
- Reach 100%Leave it there while you confirm all is well.
- RemoveDelete the flag from your code.
- Archive and deleteArchive it in the dashboard, then delete after a retention period.
Put it in the review
- Ask for an owner and a planned removal date when a flag is created.
- Include the clean-up in the same plan as the feature.
- Review the list of flags at 100% regularly and remove the ones that are done.
The audit log records who changed what and when, which helps when you are not sure why a flag exists. See the user guide.
