# Designing Feature Flags

This document covers considerations when designing Feature Flags.\
Examples are included to aid understanding.

| Scenario                                                                                                 |
| -------------------------------------------------------------------------------------------------------- |
| Company A, which operates a ball sports community site, wants to change the welcome image of their site. |

## 1. Select the Feature

A Feature Flag has an on (enabled) state and an off (disabled) state.\
You need to decide which feature to apply when it is on and which feature to apply when it is off.\
Typically, the existing feature is activated when off, and the new feature is activated when on.

Developer support is required for introducing a feature.\
In addition to implementing the new feature, you need to integrate the Hackle SDK and write the code related to the Feature Flag.

| Scenario                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Company A's current welcome image prominently features a ball, but they are considering replacing it with an image featuring various sports to accommodate future expansion into other sports.</p><p>However, given the nature of the ball sports community site, they are concerned that current users might react negatively. So they decided to use the Feature Flag feature to test the reaction with a small number of users first.</p><p>They decide to show the new image when the Feature Flag is on, and the existing image when it is off.</p> |

## 2. Configure Traffic

You need to decide how many people will see the feature when it is on.\
You also need to devise a strategy for how long you will observe the reaction, and how you will increase or decrease traffic based on what you see.

| Scenario                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The initial traffic allocation was set to 10%, showing the new image to 10% of users.<br>If popular posts about this image appear within 2-3 days, the reaction is fast, so they decided to observe the response and adjust traffic accordingly.<br>If there is no noticeable reaction, they decided to wait a week and then increase traffic by 10% at a time.</p> |

## 3. Draw Conclusions

Once you have collected sufficient reactions while adjusting traffic, you need to make a final decision on which feature to adopt.\
Afterwards, ask the developer in charge to remove the code related to the Hackle SDK.

| Scenario                                                                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>We leave the conclusion of Company A to your imagination.<br>What we can say for certain is that after deciding which image to adopt, Company A's developer thoroughly cleaned up the code related to the Hackle SDK.</p> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hackle.io/en/feature-flag/ff-design.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
