Make the agent use the existing feature-flag hook, not a hardcoded boolean
The PR hides a new panel with const SHOW_NEW_PANEL = true or process.env.NEXT_PUBLIC_NEW_PANEL === "true" in the component file. The repo already has a useFeatureFlag hook (or flags.isEnabled) with defaults, a typed flag name, and a way to override in development. Nearby experiments already use it. The hardcoded boolean will not turn off in production the same way, and a second flag string appears that is not in the flag catalog.
I've started treating a hardcoded feature boolean as an incomplete gate, not as a faster ship. Hiding the panel is the easy part. A named flag, a default, and one place to flip it are why the hook is there.
Why the hardcoded boolean shows up
A tutorial "feature flag" example is a constant at the top of the file. The model can write that without finding useFeatureFlag or the flag catalog. Your hook may wrap Statsig, LaunchDarkly, or a homemade config file, and the name is easy to miss if the prompt only says "hide this behind a flag."
You also skip the existing default for unknown flags, and the rule about not reading process.env in a leaf component.
A simple feature-flag policy
- New UI experiments use the existing feature-flag hook and a named flag
- Do not hardcode a boolean or a raw env check in a feature file
- Add the flag to the existing catalog with a default
- A new targeting rule is a flag-config change, not a component special case
A flag that only exists in one file is not a flag. It is a comment that will be forgotten.
What to put in the prompt
Use the existing feature-flag hook for this gate. Do not hardcode a boolean or read process.env in this component. Add a named flag to the existing catalog with a default. If you need a new targeting rule, change the flag config, not the component. Paste one existing flag usage. In review, search the diff for a SHOW_ constant, a raw process.env check in JSX, and a flag name that is not in the catalog.
Reject / send back
Reject
- A hardcoded boolean that ships as a "flag"
- An env check in a leaf component when the hook is the convention
- A flag name that is not registered in the catalog
- A second flag SDK added for one experiment
Accept
- A gate that uses the existing hook and a catalogued flag
- A catalog PR that adds the flag and its default
- Removal of a flag that is already fully rolled out