Skip to main content

Short-Lived Feature Flags

Short-lived flags are temporary flags designed to be removed once they've served their purpose. These flags are commonly used for feature rollouts and experimentation.

Common Use Cases

1. Feature Rollouts

The most common use case for short-lived flags is to decouple feature deployment from release:

  1. Create and implement the flag while developing the feature
  2. Deploy the code with the feature behind the flag
  3. Test the feature in production with limited exposure
  4. Gradually roll out to more users using segments
  5. Once fully rolled out, remove the flag

2. A/B Testing and Experimentation

Short-lived flags are perfect for temporary experiments:

  1. Create a multivariate flag for your test variants
  2. Run your experiment using percentage splits
  3. Collect data through your analytics platform
  4. Once the experiment concludes, implement the winning variant
  5. Remove the flag

Lifecycle Phases

1. Creation

  • Create the flag in Flagsmith
  • Add it to your application code
  • Document its purpose and expected lifetime

2. Implementation

  • Deploy code with the feature behind the flag
  • Set up any needed analytics tracking
  • Configure initial flag state across environments

3. Active Use

  • Control feature visibility/behavior
  • Monitor usage through Flag Analytics
  • Adjust rollout based on feedback/data

4. Deprecation

  1. Verify the flag is no longer needed
  2. Remove flag checks from your code
  3. Deploy the updated code
  4. Delete the flag from Flagsmith

Best Practices

  1. Clear Naming - Use names that indicate the flag is temporary

    feature_rollout_new_ui
    experiment_button_color
    beta_search_upgrade
  2. Documentation

    • Add clear descriptions when creating flags
    • Document expected lifetime/removal criteria
    • Use tags to mark temporary flags
  3. Regular Cleanup

    • Review flags regularly (e.g., monthly)
    • Use Flag Analytics to identify unused flags
    • Remove flags promptly after they're no longer needed
  4. Safe Removal

    • Verify no code references remain before deletion
    • Consider archiving instead of deletion if unsure
    • Use Change Requests for coordinated removal

Tools for Management

Flagsmith provides several tools to help manage short-lived flags:

  1. Flag Analytics - Track usage to identify when flags can be removed
  2. Flag Archiving - Temporarily hide unused flags
  3. Change Requests - Coordinate flag changes across team
  4. Flag Tags - Organize and track temporary flags