Skill 30 · Launchdarkly Flag Create
Subchapter 30.1
references/flag-types.mdMarkdown5 KBView on GitHub
A reference for choosing the right flag type and configuring it properly.
The most common type. Two variations: true and false.
When to use:
true to a percentage of traffic)Configuration:
{
"kind": "boolean",
"variations": [
{"value": true},
{"value": false}
]
}Convention: Variation 0 is true (the new/enabled behavior), variation 1 is false (the old/disabled behavior). The offVariation should point to false.
Multiple string values. Use for text variants, feature versions, or named configurations.
When to use:
Configuration:
{
"kind": "multivariate",
"variations": [
{"value": "control", "name": "Control"},
{"value": "variant-a", "name": "Variant A"},
{"value": "variant-b", "name": "Variant B"}
]
}Numeric values. Use for thresholds, limits, or quantities.
When to use:
Configuration:
{
"kind": "multivariate",
"variations": [
{"value": 10, "name": "Default"},
{"value": 50, "name": "Increased"},
{"value": 100, "name": "Maximum"}
]
}Complex objects. Use for structured configuration.
When to use:
Configuration:
{
"kind": "multivariate",
"variations": [
{"value": {"theme": "light", "density": "comfortable"}, "name": "Default"},
{"value": {"theme": "dark", "density": "compact"}, "name": "Dark Compact"}
]
}Flag keys are immutable identifiers. Choose carefully.
Common conventions:
| Convention | Example | When used |
|---|---|---|
kebab-case | new-checkout-flow | Most common, LaunchDarkly default |
snake_case | new_checkout_flow | Common in Python/Ruby codebases |
camelCase | newCheckoutFlow | Sometimes in JS/TS codebases |
dot.notation | checkout.new-flow | Hierarchical organization |
Always check the existing codebase for which convention is in use before creating a new flag.
Good key practices:
new-checkout-flow not the-new-checkout-flow-featuredark-mode not jira-1234new-pricing not new-pricing-2025The human-readable display name in the LaunchDarkly UI. Can be changed later (unlike keys).
Good name practices:
Tags help organize flags in LaunchDarkly. Suggest tags based on:
| Category | Example tags |
|---|---|
| Team | team-checkout, team-platform |
| Feature area | payments, onboarding, search |
| Flag purpose | experiment, release, ops |
| Lifecycle | q1-2025, migration |
true -> “Enabled” / “New behavior”, false -> “Disabled” / “Old behavior”offVariation to false (index 1)nameoffVariation should be: typically the control/defaultfalse (feature off) unless the feature is already live