---
name: sdk-install
description: "Install and initialize the correct LaunchDarkly SDK during onboarding by running nested skills in order: detect, plan, apply. Parent onboarding Step 4 is first flag."
license: Apache-2.0
compatibility: Requires a supported language/framework in the project. SDK credentials are required by [Apply](apply/SKILL.md), not for [Detect](detect/SKILL.md) / [Plan](plan/SKILL.md) alone (see parent onboarding **Prerequisites**).
metadata:
  author: launchdarkly
  version: "0.3.0"
title: sdk-install
canonical_url: https://skilld.dev/gh/launchdarkly/ai-tooling/sdk-install
last_updated: 2026-10-27T20:05:31.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [apply/SKILL.md](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md), [detect/SKILL.md](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/detect/SKILL.md), [plan/SKILL.md](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/plan/SKILL.md).
>
> If the user asked to install this Skill, run `npx skilld install launchdarkly/ai-tooling/sdk-install`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/sdk-install`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/launchdarkly/ai-tooling/sdk-install) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/sdk-install`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/sdk-install --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/sdk-install --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# LaunchDarkly SDK Install (onboarding)

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 4: First flag**.

## Prerequisites

- Project context from parent **Step 1: Explore the Project** (reuse it; only re-run deep detection if something is unclear)
- **SDK key / client-side ID / mobile key:** Needed when you reach [Apply code changes](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/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 when MCP is already configured, or surfaced at D7 in apply; key material is collected at apply (see parent [Prerequisites](../SKILL.md#prerequisites)).

## Key types (summary)

| SDK Type    | Variable (logical)        | Source in LaunchDarkly        |
|-------------|---------------------------|-------------------------------|
| Server-side | `LAUNCHDARKLY_SDK_KEY`    | Environments → SDK key        |
| Client-side | Client-side ID (bundler-prefixed env names) | Environments → Client-side ID |
| Mobile      | `LAUNCHDARKLY_MOBILE_KEY` | Environments → Mobile key     |

**Never hardcode keys.** Full env rules, consent, and bundler tables: [Apply code changes](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md) Step 2.

## Workflow — run these nested skills in order

Execute **all three** unless the [detect decision tree](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/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.

| Order | Nested skill | Role |
|-------|----------------|------|
| 1 | [Detect repository stack](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/detect/SKILL.md) | Language, package manager, monorepo target, entrypoint, existing LD usage |
| 2 | [Generate integration plan](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/plan/SKILL.md) | SDK choice, files to change, env plan -- presented to user (non-blocking; see plan SKILL.md D6) |
| 3 | [Apply code changes](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md) | Install package(s), `.env` / secrets with consent, init code, compile check (**both** tracks when [dual-SDK plan](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/plan/SKILL.md#dual-sdk-integrations)) |

Shared references for all steps: [SDK recipes](../references/sdk/recipes.md), [SDK snippets](../references/sdk/snippets/).

**Observability plugin:** When the user mentions observability, session replay, error monitoring, logs, or tracing (in the first message or later), carry that into plan and apply: the plugin package(s) and the `plugins` entry on the client from [Observability plugin](../references/sdk/observability-plugin.md). Same client, same key. If the client is already initialized, skip detect and plan and add the plugin to the existing init, then return to the parent flow (first flag during onboarding; nothing further for a follow-up after onboarding finished).

### After Step 3 completes

Continue with the parent skill:

- **Step 4:** [First flag](../SKILL.md#step-4-first-flag)

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.

## Guidelines

- Match existing codebase conventions for imports, config, and style.
- Prefer TypeScript in TypeScript projects.
- If the project uses a shared config layer, initialize LaunchDarkly there.
- Add `.env.example` entries when the project uses dotenv.
- **Dependency scope:** Add only LaunchDarkly SDK package(s) from the recipe (plus the observability plugin package(s) when the user asked for them) unless the user **explicitly approves** upgrading or adding other packages ([Apply — Permission before changing other dependencies](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md#permission-before-changing-other-dependencies)).

## Edge cases

- **Multiple environments (e.g. Next.js server + client) or user asked for frontend + backend:** Use a **dual-SDK** [plan](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/plan/SKILL.md#dual-sdk-integrations) and [apply](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md) **both** packages and **both** inits—never summarize the second SDK as done without lockfile + entrypoint evidence.
- **Monorepo:** Integrate the package the user chose in parent onboarding; stay within that subtree.
- **SDK already installed and initialized:** Parent may skip this handoff—see parent **Edge Cases** and [detect decision tree](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/detect/SKILL.md#decision-tree).
- **Unsupported or uncommon stack:** Use [SDK recipes](../references/sdk/recipes.md) and the [full SDK catalog](https://launchdarkly.com/docs/sdk).

## References

- [Detect repository stack](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/detect/SKILL.md)
- [Generate integration plan](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/plan/SKILL.md)
- [Apply code changes](https://skilld.dev/api/skills-raw/launchdarkly/ai-tooling/sdk-install/apply/SKILL.md)
- [SDK recipes](../references/sdk/recipes.md)
- [SDK snippets](../references/sdk/snippets/)
- [Observability plugin](../references/sdk/observability-plugin.md)
- [LaunchDarkly onboarding (parent)](../SKILL.md)
