| name | launchdarkly-sdk-onboarding | ||||
|---|---|---|---|---|---|
| description | Onboard a project to LaunchDarkly by detecting the tech stack, installing the right SDK, initializing it, validating the connection, and creating a first feature flag. Use when the user wants to add LaunchDarkly to their project, integrate an SDK, or says 'onboard me'. | ||||
| license | Apache-2.0 | ||||
| compatibility | Requires LaunchDarkly API access token. Optionally uses the LaunchDarkly MCP server for flag creation and validation. | ||||
| metadata |
|
You're using a skill that will guide you through adding LaunchDarkly to a project. Your job is to detect the tech stack, choose the right SDK, install and initialize it, validate the connection, and help the user create their first feature flag.
Before starting the SDK integration, ensure the user has access to LaunchDarkly:
- Check for existing credentials: Ask the user if they have a LaunchDarkly access token or SDK key.
- If the user has an account: Use the LaunchDarkly API (
GET /api/v2/projects/PROJECT_KEY) orldclito retrieve the project, environment, and SDK key automatically. Ask the user for permission before reading the SDK key. - If the user does NOT have an account: Prompt them to sign up at https://launchdarkly.com or log in via
ldcli login. Guide them through creating their first project and environment if needed. - SDK key types: The project response will contain the keys you need. Use the correct key type for the SDK:
- SDK Key for server-side SDKs
- Client-side ID for client-side/browser SDKs
- Mobile Key for mobile SDKs
- Detect, don't guess: Always inspect the repo to determine the language, framework, and package manager. Never assume.
- Minimal changes: Add SDK code alongside existing code. Don't restructure or refactor the user's project.
- Match existing patterns: If the project already has conventions (env vars, config files, initialization patterns), follow them.
- Validate end-to-end: Don't stop at installation. Confirm the SDK is actually connected to LaunchDarkly.
Follow these steps in order. If any step fails, go to Step 10: Recover.
Before doing anything, understand the project.
- Inspect the repo for language, framework, and package manager
- Check for existing LaunchDarkly SDK usage
- Identify the application entrypoint
See Detect Repository Stack for detailed instructions.
Based on what you found, choose the correct SDK and plan the integration.
- Match the detected stack to an SDK using the SDK Recipes
- Identify which files need to change
- Determine if this is a server-side, client-side, or mobile integration
See Generate Integration Plan for detailed instructions.
Install the SDK and add initialization code to the project.
- Install the SDK package using the project's package manager
- Add SDK initialization code to the application entrypoint
- Configure the SDK key via environment variables
See Apply Code Changes for detailed instructions.
Verify the application runs with the SDK integrated.
- Start the application using its standard run command
- Confirm there are no import or initialization errors
- Look for SDK initialization success in logs
See Start the Application for detailed instructions.
Confirm that LaunchDarkly sees the SDK connection.
- Check the SDK is active using the LaunchDarkly API or MCP
- Verify the connection in the LaunchDarkly dashboard
See Validate SDK Connection for detailed instructions.
Help the user create and evaluate a feature flag.
- Create a boolean feature flag
- Add flag evaluation code to the project
- Toggle the flag and observe the change
See Create First Feature Flag for detailed instructions.
After the SDK is working and the first flag is toggled, check if the LaunchDarkly MCP server is installed in the user's environment.
- Check if
@launchdarkly/mcp-serveris configured in the user's MCP settings - If not installed, ask the user if they want to set it up
- If yes, guide them through installation and configuration
The MCP server enables richer agent-driven workflows like flag management, targeting rules, and experimentation — all without leaving the editor.
See MCP Server Setup for detailed instructions.
Generate a LAUNCHDARKLY.md document in the user's repository with:
- How LaunchDarkly was set up (SDK, package, init file, key configuration)
- Links to the project's flags dashboard, environments, and SDK docs
- Suggested next steps: percentage rollouts, targeting rules, experimentation, AI configs, guarded rollouts, observability
- Useful
ldclicommands for flag management
This gives the user and their team a permanent reference. Ask the user for permission before committing it.
See Onboarding Summary for the template and detailed instructions.
Leave behind editor-specific rules so the user's AI agent knows how to work with LaunchDarkly going forward.
- Detect which editor the user is using (Cursor, Claude Code, GitHub Copilot, etc.)
- Create the appropriate rules file with LaunchDarkly best practices and flag management skills
- Ask the user for permission before committing
The rules cover: when to use flags, how to evaluate them, SDK key safety, flag hygiene, and links to documentation.
See Editor Rules and Skills for editor-specific templates.
If any step fails, diagnose the issue and resume.
- Identify the failed step and error
- Choose a recovery action
- Resume the workflow
See Recovery Procedures for detailed instructions.
| Situation | Action |
|---|---|
| SDK already installed | Skip to Step 4 (Run) or Step 5 (Validate) |
| Multiple languages in repo | Ask the user which target to integrate first (frontend vs backend vs mobile) |
| Monorepo | Identify the specific package/service to integrate and work within that subtree |
| No package manager detected | Ask the user which SDK they want to install and provide manual install instructions |
| Application won't start | Use the recover step to diagnose; don't block on run if the user confirms the app runs separately |
- Don't install an SDK without detecting the stack first
- Don't hardcode SDK keys in source code — always use environment variables
- Don't restructure the user's project or refactor existing code
- Don't skip validation — always confirm the SDK is connected
- Don't create flags before the SDK connection is validated
- Detect Repository Stack — How to identify language, framework, and existing SDK usage
- Generate Integration Plan — How to choose the right SDK and plan changes
- Apply Code Changes — How to install dependencies and add initialization code
- Start the Application — How to run the app and confirm SDK initialization
- Validate SDK Connection — How to verify LaunchDarkly sees the SDK
- Create First Feature Flag — How to create, evaluate, and toggle a flag
- Recovery Procedures — How to diagnose failures and resume
- MCP Server Setup — How to install the LaunchDarkly MCP server
- Onboarding Summary — Template for the setup reference document
- Editor Rules and Skills — Editor-specific rules for ongoing flag management
- SDK Recipes — Detection patterns, install commands, and init snippets for all SDKs