npx skills add ...
npx skills add launchdarkly/agent-skills --skill launchdarkly-flag-create
npx skills add launchdarkly/agent-skills --skill launchdarkly-flag-create
Create and configure LaunchDarkly feature flags in a way that fits the existing codebase. Use when the user wants to create a new flag, wrap code in a flag, add a feature toggle, or set up an experiment. Guides exploration of existing patterns before creating.
The same skill content is published under more than one repo. The install counts are split across them; any of these commands works.
You're using a skill that will guide you through introducing a new feature flag into a codebase. Your job is to explore how flags are already used in this codebase, create the flag in LaunchDarkly in a way that fits, add the evaluation code matching existing patterns, and verify everything is wired up correctly.
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.
Required MCP tools:
create-flag: create a new feature flag in a projectget-flag: verify the flag was created correctlyOptional MCP tools (enhance workflow):
list-flags: browse existing flags to understand naming conventions and tagsupdate-flag-settings: update flag metadata (name, description, tags, temporary/permanent status)Before creating anything, understand how this codebase uses feature flags.
Find the SDK. Search for LaunchDarkly SDK imports or initialization:
launchdarkly, ldclient, ld-client, LDClient in importspackage.json, requirements.txt, go.mod, Gemfile, or equivalent for the SDK dependencyFind existing flag evaluations. Search for variation calls to understand the patterns this codebase uses:
variation(), boolVariation(), useFlags(), etc.Understand conventions. Look at existing flags to learn:
kebab-case, snake_case, camelCase?Check LaunchDarkly project conventions. Optionally use list-flags to see existing flags:
Based on what the user needs, choose the appropriate flag configuration. See Flag Types and Patterns for the full guide.
Quick decision:
| User intent | Flag kind | Variations |
|---|---|---|
| "Toggle a feature on/off" | boolean | true / false |
| "Gradually roll out a feature" | boolean | true / false |
| "A/B test between options" | multivariate (string) | User-defined values |
| "Configure a numeric threshold" | multivariate (number) | User-defined values |
| "Serve different config objects" | multivariate (JSON) | User-defined values |
Defaults to apply:
temporary: true unless the user explicitly says this is a permanent/long-lived flag. Most flags are release flags that should eventually be cleaned up.key from the name if not provided (e.g., "New Checkout Flow" -> new-checkout-flow), but match the codebase's naming convention if one exists.Use create-flag with the configuration determined in Step 2.
After creation:
offVariation to everyone until targeting is turned on.Now add the code to evaluate the flag, matching the patterns you found in Step 1.
See SDK Evaluation Patterns for implementation examples by language and framework.
Confirm the flag is properly set up:
get-flag to confirm it was created with the right configuration.If the user wants to change flag metadata (not targeting), use update-flag-settings. Supported changes:
| Change | Instruction |
|---|---|
| Rename | {kind: "updateName", value: "New Name"} |
| Update description | {kind: "updateDescription", value: "New description"} |
| Add tags | {kind: "addTags", values: ["tag1", "tag2"]} |
| Remove tags | {kind: "removeTags", values: ["old-tag"]} |
| Mark as temporary | {kind: "markTemporary"} |
| Mark as permanent | {kind: "markPermanent"} |
Multiple instructions can be batched in a single call. These changes are project-wide, not environment-specific.
Important: Metadata updates (above) are separate from targeting changes (toggle, rollout, rules). If the user wants to change who sees what, direct them to the flag targeting skill.