
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.
- Installs
- 4.1K
- Last 24h
- —
- Trending rank
- —
- Security
- Pass
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/launchdarkly/ai-tooling --skill launchdarkly-flag-create- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads launchdarkly-flag-create automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
LaunchDarkly Flag Create & Configure
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.
Prerequisites
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 correctly
Optional 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)
Workflow
Step 1: Explore the Codebase
Before creating anything, understand how this codebase uses feature flags.
-
Find the SDK. Search for LaunchDarkly SDK imports or initialization:
- Look for
launchdarkly,ldclient,ld-client,LDClientin imports - Check
package.json,requirements.txt,go.mod,Gemfile, or equivalent for the SDK dependency - Identify which SDK is in use (server-side Node, React, Python, Go, Java, etc.)
- Look for
-
Find existing flag evaluations. Search for variation calls to understand the patterns this codebase uses:
- Direct SDK calls:
variation(),boolVariation(),useFlags(), etc. - Wrapper patterns: Does this codebase abstract flags behind a service or utility?
- Constant definitions: Are flag keys defined as constants somewhere?
- See SDK Evaluation Patterns for patterns by language
- Direct SDK calls:
-
Understand conventions. Look at existing flags to learn:
- Naming convention: Are keys
kebab-case,snake_case,camelCase? - Organization: Are flag keys co-located with features, or centralized in a constants file?
- Default values: What defaults do existing evaluations use?
- Context/user construction: How does this codebase build the user/context object passed to the SDK? This determines which context kinds and attributes any future targeting can use — and it differs by surface (server vs client vs anonymous). See Context Availability before planning a rule, individual target, or rollout.
- Naming convention: Are keys
-
Check LaunchDarkly project conventions. Optionally use
list-flagsto see existing flags:- What tags are commonly used?
- Are flags marked as temporary or permanent?
- What naming patterns exist in the project?
Step 2: Determine the Right Flag Type
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:
- Set
temporary: trueunless the user explicitly says this is a permanent/long-lived flag. Most flags are release flags that should eventually be cleaned up. - Generate a
keyfrom the name if not provided (e.g., "New Checkout Flow" ->new-checkout-flow), but match the codebase's naming convention if one exists. - Suggest relevant tags based on the feature area, team, or context the user mentions.
Step 3: Create the Flag in LaunchDarkly
Use create-flag with the configuration determined in Step 2.
After creation:
- The flag is created with targeting OFF in all environments.
- The flag serves the
offVariationto everyone until targeting is turned on. - Remind the user they'll need to use the flag targeting skill to toggle it on and optionally set up rollout rules.
Step 4: Add Flag Evaluation to Code
Now add the code to evaluate the flag, matching the patterns you found in Step 1.
- Use the same SDK patterns the codebase already uses. If there's a wrapper, use the wrapper. If there are constants, add the new key to the constants file.
- Use an appropriate default value. The default (fallback) value in code should be the "safe" behavior: typically the existing behavior before the flag. This ensures the feature stays off if the SDK can't reach LaunchDarkly.
- Add the conditional logic. Wrap the new behavior in a flag check.
- Handle both branches. Make sure the code path for each variation is clear and complete.
See SDK Evaluation Patterns for implementation examples by language and framework.
Step 5: Verify
Confirm the flag is properly set up:
- Code compiles/passes linting. Run the project's build or lint step.
- Flag exists in LaunchDarkly. Use
get-flagto confirm it was created with the right configuration. - Both code paths work. The flag-off path preserves existing behavior; the flag-on path enables the new feature.
- Default value is safe. If LaunchDarkly is unreachable, the code falls back to the default: make sure that's the existing/safe behavior.
Updating Flag Settings
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.
Important Context
- Flag keys are immutable. Once created, a flag's key cannot be changed. Choose carefully.
- Flags start OFF. Creation never enables a flag. This is a safety feature.
- The default value in code is your safety net. It's what gets served when the SDK can't connect to LaunchDarkly. Always use the "safe" / existing behavior as the default.
- Follow existing codebase conventions. The most common mistake is introducing a flag pattern that doesn't match what the team already does. Step 1 exists to prevent this.
References
- Flag Types and Patterns: Boolean vs multivariate, naming conventions, configuration best practices
- SDK Evaluation Patterns: How to evaluate flags in each SDK, including common wrapper patterns
- Context Availability: Which context kinds/attributes targeting can use, matched to the surface where the flag is read (relevant once the flag will target rather than being a plain on/off switch)
FAQ
What does the launchdarkly-flag-create skill do?
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.
How do I install launchdarkly-flag-create?
Run npx skills add https://github.com/launchdarkly/ai-tooling --skill launchdarkly-flag-create in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/launchdarkly-flag-create/ (personal) or .claude/skills/launchdarkly-flag-create/ (project).
Which AI agents can use launchdarkly-flag-create?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is launchdarkly-flag-create safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains launchdarkly-flag-create?
It is published by launchdarkly in launchdarkly/ai-tooling, and it is an official skill from the maker of the technology it covers. It has 4,147 recorded installs.
More from launchdarkly/ai-tooling
onboarding
launchdarkly/ai-tooling
Scripted onboarding for LaunchDarkly: quiet execution, fixed sequence, SDK install, first flag with a live reveal, MCP offered afterwards. Enforces step completion before advancing and redirects drift. Use when adding LaunchDarkly, setting up or integrating feature flags in a project, SDK integration, or 'onboard me'.
launchdarkly-flag-discovery
launchdarkly/ai-tooling
Audit your LaunchDarkly feature flags to understand the landscape, find stale or launched flags, and assess removal readiness. Use when the user asks about flag debt, stale flags, cleanup candidates, flag health, or wants to understand their flag inventory.
launchdarkly-flag-targeting
launchdarkly/ai-tooling
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.
launchdarkly-flag-cleanup
launchdarkly/ai-tooling
Safely remove a feature flag from code while preserving production behavior. Use when the user wants to remove a flag from code, delete flag references, or create a PR that hardcodes the winning variation after a rollout is complete.
launchdarkly-metric-choose
launchdarkly/ai-tooling
Choose the right metrics for a LaunchDarkly experiment, guarded rollout, or release policy. Use when the user wants to know which metrics to use, which is the primary metric for an experiment, what guardrails to add, or which events to monitor in a rollout. Surfaces what will auto-attach from existing release policies before making additional recommendations.
launchdarkly-metric-create
launchdarkly/ai-tooling
Create a LaunchDarkly metric that measures what matters for an experiment or rollout. Use when the user wants to create a metric, track an event, measure page views, button clicks, conversion, latency, error rate, or any custom numeric or binary outcome. Instruments the event first when needed (including SDK setup and .env), then creates and verifies the metric.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.