
first-flag
Create a boolean first flag, add evaluation, toggle on/off for end-to-end proof. Parent onboarding Step 6; uses MCP, API, or ldcli; optional flag-create skill.
- Installs
- 2.3K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/launchdarkly/ai-tooling --skill first-flag- 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 first-flag automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Create first feature flag
The SDK is connected. Now help the user create their first feature flag and see it work end-to-end.
This skill is nested under LaunchDarkly onboarding; the parent Step 6 is first flag. Prior: Apply code changes.
Optional -- Flag Create skill already installed: If the launchdarkly-flag-create skill from github.com/launchdarkly/ai-tooling is available in the session (install with npx skills add launchdarkly/ai-tooling --skill launchdarkly-flag-create -y --agent <agent>), you may use it for creating the flag and choosing evaluation code that matches the repo. You must still complete default off -> verify OFF -> toggle on -> verify ON (Steps 3-5 below). Do not require that skill: this page stays the full fallback when it is missing or MCP-only flows conflict with the user's setup.
Security: Credential handling
Never substitute literal token values into commands. Use environment variable references instead:
- Shell commands:
$LAUNCHDARKLY_ACCESS_TOKEN(expanded by the shell, not visible inpsoutput) - Set the variable in your session:
export LAUNCHDARKLY_ACCESS_TOKEN=<your-token>
This prevents tokens from appearing in process lists, shell history, and screen recordings.
Step 0: Consult SDK flag-key guidance
Before creating the flag or wiring evaluation code, check the Flag key behavior by SDK table below. Some SDKs transform flag keys before exposing them in application code (e.g. the React SDK camelCases kebab-case keys). The flag key you create in LaunchDarkly, the SDK/framework configuration, and the key you reference in code must all align.
- If the SDK transforms keys (e.g. React
useFlags()camelCasesmy-first-flag→myFirstFlag): generate evaluation code using the transformed key. The flag key in LaunchDarkly stays as-is (kebab-case is conventional). - If the SDK preserves keys as-is (most server-side SDKs): use the exact LaunchDarkly flag key string in code.
- If the SDK supports both modes (e.g. React allows disabling camelCase via provider options): decide which mode the project uses (check existing code or provider config), then generate code that matches.
Flag key behavior by SDK
| SDK | Key transformation | Code key for my-first-flag | Notes |
|---|---|---|---|
React Web (useFlags()) | camelCase by default | myFirstFlag | reactOptions: { useCamelCaseFlagKeys: false } on the provider disables this |
React Native (useFlags()) | camelCase by default | myFirstFlag | Same reactOptions override available |
Vue (useLDFlag()) | None (pass original key) | 'my-first-flag' | |
| JavaScript Browser | None | 'my-first-flag' | |
| Node.js Server | None | 'my-first-flag' | |
| Python Server | None | 'my-first-flag' | |
| Go Server | None | "my-first-flag" | |
| Java Server | None | "my-first-flag" | |
| .NET Server | None | "my-first-flag" | |
| Ruby Server | None | 'my-first-flag' | |
| Swift/iOS | None | "my-first-flag" | |
| Android | None | "my-first-flag" | |
| Flutter | None | 'my-first-flag' |
When wiring the evaluation code in Step 2 below, use the Code key column value, not the raw LaunchDarkly key, whenever the SDK applies a transformation.
Step 1: Create the flag
REST / curl auth: Use $LAUNCHDARKLY_ACCESS_TOKEN as the Authorization header value (LaunchDarkly uses the raw token, no Bearer prefix). The shell expands the variable but doesn't log it.
Via MCP (preferred)
If the LaunchDarkly MCP server is available, use create-feature-flag (or the equivalent flag-creation tool your server exposes):
- Key:
my-first-flag(or a name relevant to the user's project) - Name: "My First Flag"
- Kind:
boolean - Variations:
true/false - Temporary:
true
Via LaunchDarkly API
curl -s -X POST \
"https://app.launchdarkly.com/api/v2/flags/PROJECT_KEY" \
-H "Authorization: $LAUNCHDARKLY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Flag",
"key": "my-first-flag",
"kind": "boolean",
"variations": [
{"value": true},
{"value": false}
],
"temporary": true
}'
Via ldcli
ldcli flags create \
--access-token "$LAUNCHDARKLY_ACCESS_TOKEN" \
--project PROJECT_KEY \
--data '{"name": "My First Flag", "key": "my-first-flag", "kind": "boolean", "temporary": true}'
After creation, the flag starts with targeting OFF, serving the off variation (false) to everyone. When the project key is known, link the user to the flag's dashboard page: https://app.launchdarkly.com/projects/{projectKey}/flags/my-first-flag (substitute the real project key).
Step 2: Add flag evaluation code
Add code to evaluate the flag in the application. Place this where it makes sense for the user's feature.
Server-side examples
// Node.js (@launchdarkly/node-server-sdk) -- ldClient is your initialized server client after waitForInitialization
const context = { kind: 'user', key: 'example-user-key', name: 'Example User' };
const showFeature = await ldClient.boolVariation('my-first-flag', context, false);
if (showFeature) {
console.log('Feature is ON');
} else {
console.log('Feature is OFF');
}
# Python (launchdarkly-server-sdk) -- client is ldclient.get() after set_config
from ldclient import Context
context = Context.builder("example-user-key").name("Example User").build()
show_feature = client.variation("my-first-flag", context, False)
if show_feature:
print("Feature is ON")
else:
print("Feature is OFF")
// Go
context := ldcontext.NewBuilder("example-user-key").Name("Example User").Build()
showFeature, _ := ldClient.BoolVariation("my-first-flag", context, false)
if showFeature {
fmt.Println("Feature is ON")
} else {
fmt.Println("Feature is OFF")
}
Client-side examples
// React — useFlags() camelCases keys: "my-first-flag" → myFirstFlag (see Step 0 table)
import { useFlags } from 'launchdarkly-react-client-sdk';
function MyComponent() {
const { myFirstFlag } = useFlags();
return (
<div>
{myFirstFlag ? <p>Feature is ON</p> : <p>Feature is OFF</p>}
</div>
);
}
The React SDK's useFlags() hook camelCases kebab-case flag keys by default, so my-first-flag becomes myFirstFlag. If the project disables this via reactOptions: { useCamelCaseFlagKeys: false } on the provider, use the original key string instead. Always check the project's provider configuration before choosing which form to use — see the Flag key behavior table above.
Step 3: Verify the default value
With targeting OFF, the flag should evaluate to false. Run the application and confirm:
Feature is OFF
Step 4: Toggle the flag on
Via MCP
The LaunchDarkly MCP server exposes update-feature-flag (JSON Patch), not a tool named toggle-flag -- use the tool names your MCP server lists.
Simplest path: Prefer ldcli or the LaunchDarkly API block below when you only need to turn the flag on once.
If using update-feature-flag: Call it with projectKey, featureFlagKey, and PatchWithComment.patch as a JSON Patch array. Turning the flag on for an environment typically uses a replace operation on that environment's on field (confirm the exact path from get-feature-flag for your account if needed):
{
"projectKey": "PROJECT_KEY",
"featureFlagKey": "my-first-flag",
"PatchWithComment": {
"patch": [
{
"op": "replace",
"path": "/environments/ENVIRONMENT_KEY/on",
"value": true
}
],
"comment": "Onboarding: turn on my-first-flag"
}
}
Replace ENVIRONMENT_KEY with the environment key for the environment you are targeting (e.g. test, production).
Via LaunchDarkly API
curl -s -X PATCH \
"https://app.launchdarkly.com/api/v2/flags/PROJECT_KEY/my-first-flag" \
-H "Authorization: $LAUNCHDARKLY_ACCESS_TOKEN" \
-H "Content-Type: application/json; domain-model=launchdarkly.semanticpatch" \
-d '{
"environmentKey": "ENVIRONMENT_KEY",
"instructions": [
{"kind": "turnFlagOn"}
]
}'
Via ldcli
ldcli flags toggle-on \
--access-token "$LAUNCHDARKLY_ACCESS_TOKEN" \
--project PROJECT_KEY \
--environment ENVIRONMENT_KEY \
--flag my-first-flag
Step 5: Verify the toggle
After toggling the flag on, the application should now show:
Feature is ON
For server-side SDKs using streaming (the default), the change should be reflected within seconds. For client-side SDKs, the change appears on the next page load or when the SDK polls for updates.
Step 6: Add an interactive demo
Now that the flag works, add a visible, interactive element so the user can see the flag in action -- not just a console log. This creates a "wow" moment and gives the user a tangible proof point they can show others.
Choose the right demo based on what you detected:
| App type | What to add | User experience |
|---|---|---|
| Frontend (React, Vue, SPA) | A banner, badge, or button gated by the flag | Toggle flag in dashboard → refresh page → element appears/disappears |
| Backend API (Node, Python, Go, etc.) | A /launchdarkly-demo endpoint that returns flag state as JSON | curl the endpoint → toggle flag → curl again → response changes |
| Full-stack (Next.js SSR, Rails, etc.) | Both: an API endpoint + a UI element that displays the flag state | Toggle flag → see both API and UI reflect the change |
| CLI / script | A --feature-demo flag or distinct output mode | Run script → toggle flag → run again → output changes |
Frontend demo example (React)
Add a component or element that's visually obvious when the flag is on:
// Add to an existing page component
import { useFlags } from 'launchdarkly-react-client-sdk';
function FeatureFlagDemo() {
const { myFirstFlag } = useFlags();
if (!myFirstFlag) return null;
return (
<div style={{
padding: '12px 20px',
backgroundColor: '#405BFF',
color: 'white',
borderRadius: '8px',
margin: '16px 0',
fontWeight: 500
}}>
LaunchDarkly is working — this banner is controlled by a feature flag
</div>
);
}
Place it somewhere visible (e.g., at the top of the main page or in a dashboard/header area).
Backend demo example (Node.js/Express)
Add an endpoint that returns the flag state:
// Add to your Express app (or equivalent for other frameworks)
app.get('/launchdarkly-demo', async (req, res) => {
const context = { kind: 'user', key: 'demo-user' };
const flagValue = await ldClient.boolVariation('my-first-flag', context, false);
res.json({
flag: 'my-first-flag',
enabled: flagValue,
message: flagValue
? 'LaunchDarkly is working — the flag is ON'
: 'LaunchDarkly is working — the flag is OFF'
});
});
Tell the user to test with: curl http://localhost:PORT/launchdarkly-demo
Backend demo example (Python/Flask)
@app.route('/launchdarkly-demo')
def launchdarkly_demo():
context = Context.builder("demo-user").build()
flag_value = ld_client.variation("my-first-flag", context, False)
return jsonify({
"flag": "my-first-flag",
"enabled": flag_value,
"message": "LaunchDarkly is working — the flag is ON" if flag_value
else "LaunchDarkly is working — the flag is OFF"
})
Full-stack demo
For apps with both server and client (e.g., Next.js, Remix, Rails with frontend):
- Add the API endpoint (backend example above)
- Add a UI component that either calls the endpoint or uses the client SDK directly
- The user can verify both paths work
Guidelines
- Match existing patterns -- use the same routing style, component conventions, and code style as the rest of the app
- Make it obvious -- use color, position, or text that clearly indicates this is the LaunchDarkly demo
- Keep it removable -- add a brief comment like
// LaunchDarkly demo - safe to removeso the user knows they can delete it later (or keep it as a template) - Don't over-engineer -- this is a demo, not a production feature; a few lines of code is ideal
Walk the user through it
After adding the demo element:
- Tell the user where you added it and how to see it (URL, page location, command)
- Have them verify it shows the current flag state
- Ask them to toggle the flag in the dashboard (provide the deep link:
https://app.launchdarkly.com/projects/{projectKey}/flags/my-first-flag) - Have them refresh/re-run to see the change
- Celebrate the successful integration
Congratulations
The user has successfully:
- Installed the LaunchDarkly SDK
- Connected it to LaunchDarkly
- Created a feature flag
- Evaluated it in code
- Toggled it and seen the result
- Added an interactive demo they can show others
This is the "proof point" moment -- the user has a working feature flag they can toggle in real-time. The demo element makes it tangible and shareable.
Encourage the next skill: Suggest they install or enable the launchdarkly-flag-create skill from github.com/launchdarkly/ai-tooling (npx skills add launchdarkly/ai-tooling --skill launchdarkly-flag-create -y --agent <agent>) so future work -- creating flags that match repo conventions, wrapping features, and verifying wiring -- has a dedicated playbook. Offer to help them add it if they are unsure how.
Error handling
Authorization errors
If any step returns a 401 or 403:
D9 -- BLOCKING: Call your structured question tool now.
- question: "I received an authorization error ([specific status code and message]). This requires your action to resolve -- I cannot retry automatically."
- options:
- "I'll re-authenticate -- run ldcli login or refresh my token"
- "Let me check my access token and try again"
- "I don't have an account -- help me sign up"
- "The project or environment doesn't exist -- help me create one"
- STOP. Do not write the question as text. Do not retry authorization errors automatically -- they always require user action. Do not continue until the user selects an option.
Other errors
For non-auth errors (flag creation failures, SDK key mismatches, flags returning fallback values, etc.), diagnose the issue using the error output, application logs, and your understanding of the project.
Next steps to suggest:
- Install
launchdarkly-flag-createfrom github.com/launchdarkly/ai-tooling if it is not already available -- this onboarding flow only covers a first boolean flag; that skill guides real-world flag creation aligned with existing code patterns (requires LaunchDarkly MCP per that skill's prerequisites). - Use
launchdarkly-flag-targetingfrom the same distribution to set up percentage rollouts and targeting rules - Read the LaunchDarkly docs for advanced topics like contexts, experimentation, and metrics
Upon completion, continue with: Onboarding summary and Editor rules and skills (default follow-through in the parent onboarding skill -- not MCP setup, which is Step 4). For MCP install or troubleshooting, use mcp-configure and MCP Config Templates.
FAQ
What does the first-flag skill do?
Create a boolean first flag, add evaluation, toggle on/off for end-to-end proof. Parent onboarding Step 6; uses MCP, API, or ldcli; optional flag-create skill.
How do I install first-flag?
Run npx skills add https://github.com/launchdarkly/ai-tooling --skill first-flag 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/first-flag/ (personal) or .claude/skills/first-flag/ (project).
Which AI agents can use first-flag?
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 first-flag safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains first-flag?
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 2,282 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-create
launchdarkly/ai-tooling
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.
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.
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.