LaunchDarkly Flag Targeting & Rollout
You're using a skill that will guide you through changing who sees what for a feature flag. Your job is to understand the current state of the flag, figure out the right targeting approach for what the user wants, make the changes safely, and verify the resulting state.
Prerequisites
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.
Required MCP tools:
get-flag: understand current state before making changes
toggle-flag: turn targeting on or off for a flag in an environment
update-rollout: change the default rule (fallthrough) variation or percentage rollout
update-targeting-rules: add, remove, or modify custom targeting rules
update-individual-targets: add or remove specific users/contexts from individual targeting
Optional MCP tools:
copy-flag-config: copy targeting configuration from one environment to another
create-approval-request: create an approval request when direct changes are blocked
list-approval-requests: check on pending approval requests for a flag
apply-approval-request: apply an already-approved approval request
Core Concept: Evaluation Order
Before making any targeting changes, understand how LaunchDarkly evaluates flags. This determines what your changes actually do:
- Flag is OFF -> Serve the
offVariation to everyone. Nothing else matters.
- Individual targets -> If the context matches a specific target list, serve that variation. Highest priority.
- Custom rules -> Evaluate rules top-to-bottom. First matching rule wins.
- Default rule (fallthrough) -> If nothing else matched, serve this variation or rollout.
This means: if you add a targeting rule but the flag is OFF, nobody sees the change. If you set a percentage rollout on the default rule but there's an individual target, that targeted user bypasses the rollout.
Workflow
Step 1: Understand Current State
Before changing anything, check what's already configured.
- Confirm the environment. "Turn it on" without specifying an environment is ambiguous. Always confirm which environment the user means. Default to asking rather than assuming.
- Fetch the flag. Use
get-flag with the target environment to see:
on: Is targeting currently enabled?
fallthrough: What's the default rule? (variation or percentage rollout)
offVariation: What serves when the flag is off?
rules: Any custom targeting rules?
targets: Any individually targeted users/contexts?
prerequisites: Any flags this depends on?
- Assess complexity. A flag with no rules and no individual targets is simple. A flag with multiple rules, targets, and prerequisites needs more care.
Step 2: Determine the Right Approach
Based on what the user wants and what you found, choose the right tool and strategy. See Targeting Patterns for the full reference.
Common scenarios:
| User wants |
Tool |
Notes |
| "Turn it on" |
toggle-flag with on: true |
Simplest change |
| "Turn it off" |
toggle-flag with on: false |
Serves offVariation to everyone |
| "Roll out to X%" |
update-rollout with rolloutType: "percentage" |
Weights must sum to 100 |
| "Enable for beta users" |
update-targeting-rules: add a rule with clause |
Rules are ANDed within, ORed between |
| "Add specific users" |
update-individual-targets |
Highest priority, overrides all rules |
Before writing a rule, individual target, or percentage rollout, confirm the context supports it. A rule that names a context kind or attribute the flag's evaluation doesn't carry silently never matches; individual targets match the context key, not an attribute like email; and a rollout can only bucket by a kind present where the flag is read. See Context Availability to pick a context that will actually fire.
| "Full rollout" | update-rollout with rolloutType: "variation" | Serve one variation to everyone |
| "Copy from staging" | copy-flag-config | Promote tested config to production |
Step 3: Run the Safety Checklist
Before applying changes, especially in production, run through the Safety Checklist. The key checks:
- Right environment? Double-check you're targeting the intended environment.
- Approval required? Some environments require approval workflows. If any mutation tool returns
requiresApproval: true:
- Inform the user that this environment requires approvals.
- Share the
approvalUrl if provided.
- Offer to create an approval request using
create-approval-request with the same instructions (returned in the instructions field of the response).
- Do NOT attempt to bypass approval or auto-approve.
- See Approval Workflows for the full process.
- Prerequisite flags? If this flag has prerequisites, they must be met before targeting works as expected.
- Rule ordering impact? If adding rules, consider where they fall in evaluation order. Rules evaluate top-to-bottom, first match wins.
- Include a comment. Always add an audit trail comment, especially for production changes.
Step 4: Apply Changes
Use the appropriate tool for the change. Key notes:
toggle-flag: Specify on: true or on: false, the env, and a comment.
update-rollout: Use rolloutType: "percentage" with human-friendly weights (e.g., 80 for 80%) that sum to 100, or rolloutType: "variation" with a variationIndex.
update-targeting-rules: Instructions support addRule, removeRule, updateRuleVariationOrRollout, addClauses, removeClauses, reorderRules.
update-individual-targets: Instructions support addTargets, removeTargets, addContextTargets, removeContextTargets, replaceTargets.
See Targeting Patterns for detailed instruction examples.
Step 5: Verify
After applying changes, confirm the result:
- Fetch the updated flag. Use
get-flag again to verify the new state.
- Confirm what the user expects. Describe the resulting targeting in plain language:
- "The flag is now ON in production, serving
true to 25% of users and false to 75%."
- "Beta users now see variation A. Everyone else gets the default (variation B)."
- Check for side effects. If there are rules or individual targets, make sure the change interacts correctly with them.
Handling Approval-Required Environments
When any mutation tool returns requiresApproval: true, the direct change was blocked because the environment requires approvals. Follow the Approval Workflows reference to:
- Create an approval request with
create-approval-request using the instructions from the blocked response
- Inform the user about the pending approval and share the approval request details
- Check on approval status later with
list-approval-requests if requested
- Apply the request with
apply-approval-request once a reviewer has approved it (reviewStatus is "approved")
- Verify the result with
get-flag after applying
Important Context
update-rollout uses human-friendly percentages. Pass 80 for 80%, not 80000. The tool handles the internal weight conversion.
- Weights must sum to 100. For percentage rollouts, the weights across all variations must total exactly 100.
- Rule ordering matters. Rules evaluate top-to-bottom. Reordering rules can change behavior without changing any individual rule.
- Individual targets are highest priority. They override all rules and the default. Adding someone as an individual target means rules don't apply to them.
- "Launched" flags are still ON. A flag with status "launched" is serving a single variation to everyone. If you want to remove the flag, use the cleanup skill, not targeting changes.
References
- Targeting Patterns: Rollout strategies, rule construction, individual targeting, and cross-environment copying
- Context Availability: Which context kinds/attributes a rule, target, or rollout can use — matching the kind to the surface where the flag is read, key vs attribute, and rollout bucketing
- Safety Checklist: Pre-change verification, approval workflows, environment awareness
- Approval Workflows: Creating, checking, and applying approval requests
1---2name: launchdarkly-flag-targeting3description: Control LaunchDarkly feature flag targeting including toggling flags on/off, percentage rollouts, targeting rules, individual targets, and copying flag configurations between environments. Use when the user wants to change who sees a flag, roll out to a percentage, add targeting rules, or promote config between environments.4license: Apache-2.05---6
7# LaunchDarkly Flag Targeting & Rollout
8
9You're using a skill that will guide you through changing who sees what for a feature flag. Your job is to understand the current state of the flag, figure out the right targeting approach for what the user wants, make the changes safely, and verify the resulting state.
10
11## Prerequisites
12
13This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.
14
15**Required MCP tools:**
16- `get-flag`: understand current state before making changes
17- `toggle-flag`: turn targeting on or off for a flag in an environment
18- `update-rollout`: change the default rule (fallthrough) variation or percentage rollout
19- `update-targeting-rules`: add, remove, or modify custom targeting rules
20- `update-individual-targets`: add or remove specific users/contexts from individual targeting
21
22**Optional MCP tools:**
23- `copy-flag-config`: copy targeting configuration from one environment to another
24- `create-approval-request`: create an approval request when direct changes are blocked
25- `list-approval-requests`: check on pending approval requests for a flag
26- `apply-approval-request`: apply an already-approved approval request
27
28## Core Concept: Evaluation Order
29
30Before making any targeting changes, understand how LaunchDarkly evaluates flags. This determines what your changes actually do:
31
321. **Flag is OFF** -> Serve the `offVariation` to everyone. Nothing else matters.
332. **Individual targets** -> If the context matches a specific target list, serve that variation. Highest priority.
343. **Custom rules** -> Evaluate rules top-to-bottom. First matching rule wins.
354. **Default rule (fallthrough)** -> If nothing else matched, serve this variation or rollout.
36
37This means: if you add a targeting rule but the flag is OFF, nobody sees the change. If you set a percentage rollout on the default rule but there's an individual target, that targeted user bypasses the rollout.
38
39## Workflow
40
41### Step 1: Understand Current State
42
43Before changing anything, check what's already configured.
44
451. **Confirm the environment.** "Turn it on" without specifying an environment is ambiguous. Always confirm which environment the user means. Default to asking rather than assuming.
462. **Fetch the flag.** Use `get-flag` with the target environment to see:
47 - `on`: Is targeting currently enabled?
48 - `fallthrough`: What's the default rule? (variation or percentage rollout)
49 - `offVariation`: What serves when the flag is off?
50 - `rules`: Any custom targeting rules?
51 - `targets`: Any individually targeted users/contexts?
52 - `prerequisites`: Any flags this depends on?
533. **Assess complexity.** A flag with no rules and no individual targets is simple. A flag with multiple rules, targets, and prerequisites needs more care.
54
55### Step 2: Determine the Right Approach
56
57Based on what the user wants and what you found, choose the right tool and strategy. See [Targeting Patterns](references/targeting-patterns.md) for the full reference.
58
59**Common scenarios:**
60
61| User wants | Tool | Notes |
62|-----------|------|-------|
63| "Turn it on" | `toggle-flag` with `on: true` | Simplest change |
64| "Turn it off" | `toggle-flag` with `on: false` | Serves offVariation to everyone |
65| "Roll out to X%" | `update-rollout` with `rolloutType: "percentage"` | Weights must sum to 100 |
66| "Enable for beta users" | `update-targeting-rules`: add a rule with clause | Rules are ANDed within, ORed between |
67| "Add specific users" | `update-individual-targets` | Highest priority, overrides all rules |
68
69**Before writing a rule, individual target, or percentage rollout, confirm the context supports it.** A rule that names a context kind or attribute the flag's evaluation doesn't carry silently never matches; individual targets match the context **key**, not an attribute like email; and a rollout can only bucket by a kind present where the flag is read. See [Context Availability](references/context-availability.md) to pick a context that will actually fire.
70| "Full rollout" | `update-rollout` with `rolloutType: "variation"` | Serve one variation to everyone |
71| "Copy from staging" | `copy-flag-config` | Promote tested config to production |
72
73### Step 3: Run the Safety Checklist
74
75Before applying changes, especially in production, run through the [Safety Checklist](references/safety-checklist.md). The key checks:
76
771. **Right environment?** Double-check you're targeting the intended environment.
782. **Approval required?** Some environments require approval workflows. If any mutation tool returns `requiresApproval: true`:
79 - Inform the user that this environment requires approvals.
80 - Share the `approvalUrl` if provided.
81 - Offer to create an approval request using `create-approval-request` with the same instructions (returned in the `instructions` field of the response).
82 - Do NOT attempt to bypass approval or auto-approve.
83 - See [Approval Workflows](references/approval-workflows.md) for the full process.
843. **Prerequisite flags?** If this flag has prerequisites, they must be met before targeting works as expected.
854. **Rule ordering impact?** If adding rules, consider where they fall in evaluation order. Rules evaluate top-to-bottom, first match wins.
865. **Include a comment.** Always add an audit trail comment, especially for production changes.
87
88### Step 4: Apply Changes
89
90Use the appropriate tool for the change. Key notes:
91
92- **`toggle-flag`**: Specify `on: true` or `on: false`, the `env`, and a `comment`.
93- **`update-rollout`**: Use `rolloutType: "percentage"` with human-friendly weights (e.g., 80 for 80%) that sum to 100, or `rolloutType: "variation"` with a `variationIndex`.
94- **`update-targeting-rules`**: Instructions support `addRule`, `removeRule`, `updateRuleVariationOrRollout`, `addClauses`, `removeClauses`, `reorderRules`.
95- **`update-individual-targets`**: Instructions support `addTargets`, `removeTargets`, `addContextTargets`, `removeContextTargets`, `replaceTargets`.
96
97See [Targeting Patterns](references/targeting-patterns.md) for detailed instruction examples.
98
99### Step 5: Verify
100
101After applying changes, confirm the result:
102
1031. **Fetch the updated flag.** Use `get-flag` again to verify the new state.
1042. **Confirm what the user expects.** Describe the resulting targeting in plain language:
105 - "The flag is now ON in production, serving `true` to 25% of users and `false` to 75%."
106 - "Beta users now see variation A. Everyone else gets the default (variation B)."
1073. **Check for side effects.** If there are rules or individual targets, make sure the change interacts correctly with them.
108
109### Handling Approval-Required Environments
110
111When any mutation tool returns `requiresApproval: true`, the direct change was blocked because the environment requires approvals. Follow the [Approval Workflows](references/approval-workflows.md) reference to:
112
1131. **Create an approval request** with `create-approval-request` using the `instructions` from the blocked response
1142. **Inform the user** about the pending approval and share the approval request details
1153. **Check on approval status** later with `list-approval-requests` if requested
1164. **Apply the request** with `apply-approval-request` once a reviewer has approved it (reviewStatus is "approved")
1175. **Verify the result** with `get-flag` after applying
118
119## Important Context
120
121- **`update-rollout` uses human-friendly percentages.** Pass 80 for 80%, not 80000. The tool handles the internal weight conversion.
122- **Weights must sum to 100.** For percentage rollouts, the weights across all variations must total exactly 100.
123- **Rule ordering matters.** Rules evaluate top-to-bottom. Reordering rules can change behavior without changing any individual rule.
124- **Individual targets are highest priority.** They override all rules and the default. Adding someone as an individual target means rules don't apply to them.
125- **"Launched" flags are still ON.** A flag with status "launched" is serving a single variation to everyone. If you want to remove the flag, use the [cleanup skill](../launchdarkly-flag-cleanup/SKILL.md), not targeting changes.
126
127## References
128
129- [Targeting Patterns](references/targeting-patterns.md): Rollout strategies, rule construction, individual targeting, and cross-environment copying
130- [Context Availability](references/context-availability.md): Which context kinds/attributes a rule, target, or rollout can use — matching the kind to the surface where the flag is read, key vs attribute, and rollout bucketing
131- [Safety Checklist](references/safety-checklist.md): Pre-change verification, approval workflows, environment awareness
132- [Approval Workflows](references/approval-workflows.md): Creating, checking, and applying approval requests