$npx -y skills add launchdarkly/ai-tooling --skill sdk-installInstall and initialize the correct LaunchDarkly SDK during onboarding by running nested skills in order: detect, plan, apply. Parent onboarding Step 6 is first flag.
| 1 | # LaunchDarkly SDK Install (onboarding) |
| 2 | |
| 3 | Installs and initializes the right LaunchDarkly SDK for the user’s project by following **three nested skills in order**. **Do not** skip ahead to feature flags here—the parent [LaunchDarkly onboarding](../SKILL.md) continues with **Step 6: First feature flag** using [Create first feature flag](../first-flag/SKILL.md). |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - Project context from parent **Step 1: Explore the Project** (reuse it; only re-run deep detection if something is unclear) |
| 8 | - **SDK key / client-side ID / mobile key:** Needed when you reach [Apply code changes](apply/SKILL.md) (env wiring). **Do not** ask the user for these during detect or plan solely because you opened this skill—follow parent onboarding: account status is inferred via MCP OAuth (Step 4) or surfaced at D7 in apply; key material is collected at apply (see parent [Prerequisites](../SKILL.md#prerequisites)). |
| 9 | |
| 10 | ## Key types (summary) |
| 11 | |
| 12 | | SDK Type | Variable (logical) | Source in LaunchDarkly | |
| 13 | |-------------|---------------------------|-------------------------------| |
| 14 | | Server-side | `LAUNCHDARKLY_SDK_KEY` | Environments → SDK key | |
| 15 | | Client-side | Client-side ID (bundler-prefixed env names) | Environments → Client-side ID | |
| 16 | | Mobile | `LAUNCHDARKLY_MOBILE_KEY` | Environments → Mobile key | |
| 17 | |
| 18 | **Never hardcode keys.** Full env rules, consent, and bundler tables: [Apply code changes](apply/SKILL.md) Step 2. |
| 19 | |
| 20 | ## Workflow — run these nested skills in order |
| 21 | |
| 22 | Execute **all three** unless the [detect decision tree](detect/SKILL.md#decision-tree) short-circuits (e.g. skip to apply only). Each nested skill may contain decision points — some **blocking** (marked `D<N> -- BLOCKING`, where you must call your structured question tool and wait for the user's response before continuing) and some **non-blocking** (where you present information and continue unless the user objects). Do NOT batch tool calls across blocking boundaries. |
| 23 | |
| 24 | | Order | Nested skill | Role | |
| 25 | |-------|----------------|------| |
| 26 | | 1 | [Detect repository stack](detect/SKILL.md) | Language, package manager, monorepo target, entrypoint, existing LD usage | |
| 27 | | 2 | [Generate integration plan](plan/SKILL.md) | SDK choice, files to change, env plan -- presented to user (non-blocking; see plan SKILL.md D6) | |
| 28 | | 3 | [Apply code changes](apply/SKILL.md) | Install package(s), `.env` / secrets with consent, init code, compile check (**both** tracks when [dual-SDK plan](plan/SKILL.md#dual-sdk-integrations)) | |
| 29 | |
| 30 | Shared references for all steps: [SDK recipes](../references/sdk/recipes.md), [SDK snippets](../references/sdk/snippets/). |
| 31 | |
| 32 | ### After Step 3 completes |
| 33 | |
| 34 | Continue with the parent skill: |
| 35 | |
| 36 | - **Step 6:** [Create first feature flag](../first-flag/SKILL.md) |
| 37 | |
| 38 | Do not add standalone “sample flag” evaluation in this skill unless the user explicitly needs a throwaway check; the parent flow creates the first flag in order. |
| 39 | |
| 40 | ## Guidelines |
| 41 | |
| 42 | - Match existing codebase conventions for imports, config, and style. |
| 43 | - Prefer TypeScript in TypeScript projects. |
| 44 | - If the project uses a shared config layer, initialize LaunchDarkly there. |
| 45 | - Add `.env.example` entries when the project uses dotenv. |
| 46 | - **Dependency scope:** Add only LaunchDarkly SDK package(s) from the recipe unless the user **explicitly approves** upgrading or adding other packages ([Apply — Permission before changing other dependencies](apply/SKILL.md#permission-before-changing-other-dependencies)). |
| 47 | |
| 48 | ## Edge cases |
| 49 | |
| 50 | - **Multiple environments (e.g. Next.js server + client) or user asked for frontend + backend:** Use a **dual-SDK** [plan](plan/SKILL.md#dual-sdk-integrations) and [apply](apply/SKILL.md) **both** packages and **both** inits—never summarize the second SDK as done without lockfile + entrypoint evidence. |
| 51 | - **Monorepo:** Integrate the package the user chose in parent onboarding; stay within that subtree. |
| 52 | - **SDK already installed and initialized:** Parent may skip this handoff—see parent **Edge Cases** and [detect decision tree](detect/SKILL.md#decision-tree). |
| 53 | - **Unsupported or uncommon stack:** Use [SDK recipes](../references/sdk/recipes.md) and the [full SDK catalog](https://launchdarkly.com/docs/sdk). |
| 54 | |
| 55 | ## References |
| 56 | |
| 57 | - [Detect repository stack](detect/SKILL.md) |
| 58 | - [Generate integration plan](plan/SKILL.md) |
| 59 | - [Apply code changes](apply/SKILL.md) |
| 60 | - [SDK recipes](../references/sdk/recipes.md) |
| 61 | - [SDK snippets](../references/sdk/snippets/) |
| 62 | - [LaunchDarkly onboarding (parent)](../SKILL.md) |