Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Agent Skills are modular, text-based playbooks that teach an agent how to perfor
| `feature-flags/launchdarkly-flag-create` | Create new feature flags in a way that fits existing codebase patterns |
| `feature-flags/launchdarkly-flag-targeting` | Control targeting, rollouts, rules, and cross-environment config |
| `feature-flags/launchdarkly-flag-cleanup` | Safely remove flags from code using LaunchDarkly as the source of truth |
| `feature-flags/launchdarkly-flag-recreate` | Recreate a misconfigured flag when the key or variation type was set incorrectly |

### AI Configs

Expand Down
49 changes: 35 additions & 14 deletions skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,51 @@
"skills": [
{
"name": "aiconfig-create",
"description": "Guide for setting up AI configuration in your application. Helps you choose between agent vs completion mode, select the right approach for your stack, and create AI Configs that make sense for your use case.",
"description": "Create and configure AI Configs in LaunchDarkly. Helps you choose between agent vs completion mode, create the config, add variations with models and prompts, and verify the setup.",
"path": "skills/ai-configs/aiconfig-create",
"version": "0.2.0",
"compatibility": "Requires LaunchDarkly API access token with ai-configs:write permission or LaunchDarkly MCP server."
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "aiconfig-projects",
"description": "Guide for setting up LaunchDarkly projects in your codebase. Helps you assess your stack, choose the right approach, and integrate project management that makes sense for your architecture.",
"description": "Set up LaunchDarkly projects for your application. Helps you create projects, retrieve SDK keys, and understand how projects organize your AI Configs and feature flags.",
"path": "skills/ai-configs/aiconfig-projects",
"version": "0.4.0",
"compatibility": "Requires LaunchDarkly API access token with projects:write permission or LaunchDarkly MCP server."
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "aiconfig-tools",
"description": "Guide for giving your AI agents capabilities through tools. Helps you identify what your AI needs to do, create tool definitions, and attach them in a way that makes sense for your framework.",
"description": "Give your AI agents capabilities through tools (function calling). Helps you identify what your AI needs to do, create tool definitions, and attach them to AI Config variations.",
"path": "skills/ai-configs/aiconfig-tools",
"version": "0.2.0",
"compatibility": "Requires LaunchDarkly API token with ai-tool permissions."
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "aiconfig-update",
"description": "Update, archive, and delete LaunchDarkly AI Configs and their variations. Use when you need to modify config properties, change model parameters, update instructions or messages, archive unused configs, or permanently remove them.",
"path": "skills/ai-configs/aiconfig-update",
"version": "0.2.0",
"compatibility": "Requires LaunchDarkly project with AI Configs enabled and API access token."
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "aiconfig-variations",
"description": "Guide for experimenting with AI configurations. Helps you test different models, prompts, and parameters to find what works best through systematic experimentation.",
"description": "Experiment with AI configurations by creating and managing variations. Helps you test different models, prompts, and parameters to find what works best through systematic experimentation.",
"path": "skills/ai-configs/aiconfig-variations",
"version": "0.2.0",
"compatibility": "Requires LaunchDarkly API access token with ai-configs:write permission."
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "build-mcp-tools",
"description": "Guide for designing and building MCP tools using Gram Functions. Covers philosophy, codebase architecture, tool complexity patterns, and a step-by-step workflow for creating tools that return the most meaningful information to agents.",
"path": "skills/tooling/build-mcp-tools",
"version": "1.0.0-experimental",
"license": "Apache-2.0",
"compatibility": "This codebase uses @gram-ai/functions with TypeScript"
},
{
"name": "create-skill",
Expand Down Expand Up @@ -100,6 +113,14 @@
"mcp"
]
},
{
"name": "launchdarkly-flag-recreate",
"description": "Recreate a misconfigured LaunchDarkly feature flag when the key or variation type was set wrong. Use when a flag has a typo in its key, the wrong kind (boolean vs multivariate), or incorrect variation values that cannot be changed after creation.",
"path": "skills/feature-flags/launchdarkly-flag-recreate",
"version": "0.1.0",
"license": "Apache-2.0",
"compatibility": "Requires the remotely hosted LaunchDarkly MCP server"
},
{
"name": "launchdarkly-flag-targeting",
"description": "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.",
Expand Down
13 changes: 5 additions & 8 deletions skills/ai-configs/aiconfig-create/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ An Agent Skill for creating AI Configs in LaunchDarkly. Guides choosing agent vs

This skill teaches agents how to:
- Understand the use case and choose agent vs completion mode
- Create AI Configs via the two-step API process (config then variations)
- Set up model configuration with the correct modelConfigKey
- Verify creation via API fetch
- Create AI Configs using MCP tools (`setup-ai-config` for one-step, or `create-ai-config` + `create-ai-config-variation` for more control)
- Set up model configuration with the correct `modelConfigKey` format
- Verify creation via the tool response or `get-ai-config`

## Installation (Local)

Copy `skills/ai-configs/aiconfig-create/` into your agent client's skills path.

## Prerequisites

- LaunchDarkly API access token with `ai-configs:write` permission or MCP server
- LaunchDarkly project (use `aiconfig-projects` skill if needed)
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.

## Usage

Expand All @@ -34,9 +33,7 @@ Set up an AI config for content generation using Claude
```
aiconfig-create/
├── SKILL.md
├── README.md
└── references/
└── api-quickstart.md
└── README.md
```

## Related
Expand Down
132 changes: 75 additions & 57 deletions skills/ai-configs/aiconfig-create/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
---
name: aiconfig-create
description: Guide for setting up AI configuration in your application. Helps you choose between agent vs completion mode, select the right approach for your stack, and create AI Configs that make sense for your use case.
compatibility: Requires LaunchDarkly API access token with ai-configs:write permission or LaunchDarkly MCP server.
description: "Create and configure AI Configs in LaunchDarkly. Helps you choose between agent vs completion mode, create the config, add variations with models and prompts, and verify the setup."
license: Apache-2.0
compatibility: Requires the remotely hosted LaunchDarkly MCP server
metadata:
author: launchdarkly
version: "0.2.0"
version: "1.0.0-experimental"
---

# Create AI Config

You're using a skill that will guide you through setting up AI configuration in your application. Your job is to explore the codebase to understand the use case and stack, choose agent vs completion mode, create the config following the right path, and verify it works.
You're using a skill that will guide you through creating an AI Config in LaunchDarkly. Your job is to understand the use case, choose the right mode, create the config and its variations, and verify everything is set up correctly.

## Prerequisites

- LaunchDarkly API access token with `ai-configs:write` permission or MCP server
- LaunchDarkly project (use `aiconfig-projects` skill if needed)
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.

## Core Principles
**Primary MCP tool:**
- `setup-ai-config` -- create a config with its first variation in one step (recommended)

1. **Understand the Use Case First**: Know what you're building before choosing a mode
2. **Choose the Right Mode**: Agent mode vs completion mode depends on your framework and needs
3. **Two-Step Creation**: Create config first, then create variations (model, prompts, parameters)
4. **Verify via API**: The agent fetches the config to confirm it was created correctly
**Alternative MCP tools (for more control):**
- `create-ai-config` -- create just the config shell (key, name, mode)
- `create-ai-config-variation` -- add a variation with model, prompts, and parameters
- `get-ai-config` -- verify the config was created correctly

## API Key Detection

1. **Check environment variables** — `LAUNCHDARKLY_API_KEY`, `LAUNCHDARKLY_API_TOKEN`, `LD_API_KEY`
2. **Check MCP config** — Claude: `~/.claude/config.json` → `mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY`
3. **Prompt user** — Only if detection fails
**Optional MCP tools (enhance workflow):**
- `list-ai-configs` -- browse existing configs to understand naming conventions
- `create-project` -- create a project if one doesn't exist yet

## Workflow

### Step 1: Understand Your Use Case
### Step 1: Understand the Use Case

Before creating, identify what you're building:

- **What framework?** LangGraph, LangChain, CrewAI, OpenAI SDK, Anthropic SDK, custom
- **What does the AI need?** Just text, or tools/function calling?
- **Agent or completion?** See decision below
- **What does the AI need?** Just text generation, or tools/function calling?
- **Agent or completion?** See the decision matrix below

### Step 2: Choose Agent vs Completion Mode

Expand All @@ -49,66 +48,85 @@ Before creating, identify what you're building:
| Full control of message structure | **Completion** |
| One-off text generation | **Completion** |

**Both modes support tools.** Agent mode: single `instructions` string. Completion mode: full `messages` array.
**Both modes support tools.** Agent mode uses a single `instructions` string. Completion mode uses a full `messages` array with roles.

### Step 3: Create the Config (Recommended: One Step)

Use `setup-ai-config` to create the config and its first variation in one call. This is the recommended approach — it handles creation, variation setup, and verification automatically.

**Config fields:**
- `key` -- unique identifier (lowercase, hyphens)
- `name` -- human-readable name
- `mode` -- `"agent"` or `"completion"`
- Optional: `description`, `tags`

**Variation fields:**
- `variationKey`, `variationName` -- identifiers for the first variation
- `modelConfigKey` -- must be `Provider.model-id` format (e.g., `OpenAI.gpt-4o`, `Anthropic.claude-sonnet-4-5`)
- `modelName` -- the model identifier (e.g., `gpt-4o`)

**For agent mode**, provide:
- `instructions` -- a string with the agent's system instructions

### Step 3: Create the Config
**For completion mode**, provide:
- `messages` -- an array of `{role, content}` objects (system, user, assistant)

Follow [API Quick Start](references/api-quickstart.md) for curl examples:
**Optional:**
- `parameters` -- model parameters like `{temperature: 0.7, maxTokens: 2000}`

1. **Create config** — `POST /projects/{projectKey}/ai-configs` (key, name, mode)
2. **Create variation** — `POST /projects/{projectKey}/ai-configs/{configKey}/variations` (instructions or messages, modelConfigKey, model.parameters)
3. **Attach tools** — After creation, PATCH variation to add tools (see `aiconfig-tools` skill)
The tool returns the full verified config detail with the variation attached.

### Step 3 (Alternative): Two-Step Creation

If you need more control (e.g., custom headers, conditional logic), use the individual tools:

1. `create-ai-config` -- create the config shell
2. `create-ai-config-variation` -- add the variation
3. `get-ai-config` -- verify the result

### Step 4: Verify

After creation, verify the config:
If you used `setup-ai-config`, verification is automatic — the response includes the full config with variations. Check:

1. **Fetch via API:**
```bash
curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}" \
-H "Authorization: {api_token}" -H "LD-API-Version: beta"
```
1. Config exists with the correct mode
2. Variation has a model assigned (not "NO MODEL")
3. Instructions or messages are present
4. Parameters are set

2. **Confirm:**
- Config exists with correct mode
- Variations have model names (not "NO MODEL")
- modelConfigKey is set
- Parameters are present
**Report results:**
- Config created with correct structure
- Variation has model assigned
- Flag any missing model or parameters
- Provide config URL: `https://app.launchdarkly.com/projects/{projectKey}/ai-configs/{configKey}`

3. **Report results:**
- ✓ Config created with correct structure
- ✓ Variations have models assigned
- ⚠️ Flag any missing model or parameters
- Provide config URL: `https://app.launchdarkly.com/projects/{projectKey}/ai-configs/{configKey}`
## modelConfigKey Format

## Important Notes
Required for models to display in the UI. Format: `{Provider}.{model-id}`

- **modelConfigKey** must be `{Provider}.{model-id}` (e.g., `OpenAI.gpt-4o`) for models to show in UI
- **Tools** must be created first (`aiconfig-tools` skill), then attached via PATCH
- **Tools endpoint** is `/ai-tools`, NOT `/ai-configs/tools`
- `OpenAI.gpt-4o`
- `OpenAI.gpt-4o-mini`
- `Anthropic.claude-sonnet-4-5`
- `Anthropic.claude-3-5-sonnet`

The `create-ai-config-variation` tool validates this format and rejects invalid values.

## Edge Cases

| Situation | Action |
|-----------|--------|
| Config already exists | Ask if user wants to update instead |
| Variation shows "NO MODEL" | PATCH variation with modelConfigKey and model |
| Invalid modelConfigKey | Use values from model-configs API |
| Variation shows "NO MODEL" | Use `update-ai-config-variation` to set modelConfigKey |
| Need to attach tools | Create tools first (`aiconfig-tools` skill), then update the variation |

## What NOT to Do

- Don't create configs without understanding the use case
- Don't skip the two-step process (config then variation)
- Don't try to attach tools during initial creation
- Don't forget modelConfigKey (models won't show)
- Don't try to attach tools during initial creation -- update the variation afterward
- Don't forget modelConfigKey (models won't show in the UI)

## Related Skills

- `aiconfig-tools` — Create tools before attaching
- `aiconfig-variations` — Add more variations for experimentation
- `aiconfig-update` — Modify configs based on learnings

## References

- [API Quick Start](references/api-quickstart.md)
- [LaunchDarkly AI Configs Docs](https://docs.launchdarkly.com/home/ai-configs)
- `aiconfig-tools` -- Create tools before attaching
- `aiconfig-variations` -- Add more variations for experimentation
- `aiconfig-update` -- Modify configs based on learnings
Loading
Loading