launchdarkly-flag-targeting
launchdarkly/agent-skills
Control LaunchDarkly feature flag targeting, rollouts, and rules across environments.
What is launchdarkly-flag-targeting?
Manage LaunchDarkly feature flag targeting including toggling flags on/off, setting percentage rollouts, creating targeting rules, and copying configurations between environments. Use this when you need to control who sees a flag, roll out to a percentage of users, add custom targeting rules, or promote flag settings from one environment to another.
- Toggle feature flags on or off in any environment
- Set percentage rollouts across user segments
- Create and manage custom targeting rules with clause-based conditions
- Add or remove individual users and contexts from target lists
- Copy flag configurations between environments for promotion
- Create approval requests for environments requiring change authorization
How to install launchdarkly-flag-targeting
npx skills add https://github.com/launchdarkly/agent-skills --skill launchdarkly-flag-targeting- LaunchDarkly MCP server must be configured and remotely hosted in your environment
How to use launchdarkly-flag-targeting
- 1.Confirm which environment you want to modify (e.g., production, staging)
- 2.Fetch the current flag state using get-flag to understand existing targeting, rules, and individual targets
- 3.Determine the targeting approach based on your goal (toggle, percentage rollout, rules, or individual targets)
- 4.Run the safety checklist: verify the correct environment, check if approvals are required, review prerequisite flags, and plan rule ordering
- 5.Apply the change using the appropriate tool (toggle-flag, update-rollout, update-targeting-rules, or update-individual-targets)
- 6.If the environment requires approvals and the change is blocked, create an approval request and wait for reviewer approval
- 7.Fetch the flag again to verify the new state matches your intent
Use cases
- Rolling out a new feature to 25% of users before full launch
- Enabling a flag only for beta users or specific user segments
- Promoting a tested flag configuration from staging to production
- Toggling a flag off immediately to serve a fallback variation
- Adding specific users to an individual target list for early access
- Feature flag managers
- Product managers coordinating rollouts
- DevOps engineers managing environment configurations
- Release managers promoting flags across environments
launchdarkly-flag-targeting FAQ
When a flag is OFF, the offVariation is served to everyone regardless of targeting rules, individual targets, or rollouts. Nothing else in the evaluation order matters.
LaunchDarkly evaluates in order: (1) if flag is OFF, serve offVariation; (2) check individual targets; (3) evaluate custom rules top-to-bottom, first match wins; (4) serve the default rule (fallthrough) variation or rollout.
Yes, use the copy-flag-config tool to promote targeting configuration from one environment (e.g., staging) to another (e.g., production).
If a mutation tool returns requiresApproval: true, create an approval request with create-approval-request, share it with reviewers, and apply it once approved using apply-approval-request.
Yes, when using percentage rollouts, the weights across all variations must total exactly 100. Pass human-friendly percentages (e.g., 80 for 80%), not internal weights.
Full instructions (SKILL.md)
Source of truth, from launchdarkly/agent-skills.
name: launchdarkly-flag-targeting description: "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." license: Apache-2.0 compatibility: Requires the remotely hosted LaunchDarkly MCP server metadata: author: launchdarkly version: "1.0.0-experimental"
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 changestoggle-flag: turn targeting on or off for a flag in an environmentupdate-rollout: change the default rule (fallthrough) variation or percentage rolloutupdate-targeting-rules: add, remove, or modify custom targeting rulesupdate-individual-targets: add or remove specific users/contexts from individual targeting
Optional MCP tools:
copy-flag-config: copy targeting configuration from one environment to anothercreate-approval-request: create an approval request when direct changes are blockedlist-approval-requests: check on pending approval requests for a flagapply-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
offVariationto 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-flagwith 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 |
| "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
approvalUrlif provided. - Offer to create an approval request using
create-approval-requestwith the same instructions (returned in theinstructionsfield 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: Specifyon: trueoron: false, theenv, and acomment.update-rollout: UserolloutType: "percentage"with human-friendly weights (e.g., 80 for 80%) that sum to 100, orrolloutType: "variation"with avariationIndex.update-targeting-rules: Instructions supportaddRule,removeRule,updateRuleVariationOrRollout,addClauses,removeClauses,reorderRules.update-individual-targets: Instructions supportaddTargets,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-flagagain 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
trueto 25% of users andfalseto 75%." - "Beta users now see variation A. Everyone else gets the default (variation B)."
- "The flag is now ON in production, serving
- 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-requestusing theinstructionsfrom the blocked response - Inform the user about the pending approval and share the approval request details
- Check on approval status later with
list-approval-requestsif requested - Apply the request with
apply-approval-requestonce a reviewer has approved it (reviewStatus is "approved") - Verify the result with
get-flagafter applying
Important Context
update-rolloutuses 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
- Safety Checklist: Pre-change verification, approval workflows, environment awareness
- Approval Workflows: Creating, checking, and applying approval requests
Related skills
More from launchdarkly/agent-skills and the wider catalog.

launchdarkly-guarded-rollout
Configure progressive feature rollouts with automated metric monitoring and safety rollbacks in LaunchDarkly.

launchdarkly-metric-choose
Choose the right metrics for LaunchDarkly experiments, guarded rollouts, and release policies.

launchdarkly-metric-create
Create LaunchDarkly metrics to measure experiments and rollouts—auto-instruments events when needed.

launchdarkly-metric-instrument
Add LaunchDarkly metric event tracking to your codebase with a single track() call.

mcp-configure
Configure LaunchDarkly's hosted MCP server for feature flag management in your coding agent.

migrate
Migrate an application with hardcoded LLM prompts to a full LaunchDarkly AgentControl implementation in five stages: audit the code, wrap the call, move the tools, add tracking, attach evaluators. Use when the user wants to externalize model/prompt configuration, move from direct provider calls (OpenAI, Anthropic, Bedrock, Gemini, Strands) to a managed config, or stage a full hardcoded-to-LaunchDarkly migration.