From growthbook
Add an experiment-ref rule to a GrowthBook feature flag to run an A/B test through that flag. Use when the user says "run an experiment through this flag", "add an A/B test to flag X", "link experiment Y to this flag", "set up variations on this flag for an experiment", "add an experiment-ref rule", or "wire up this experiment to the flag". For launching a full new experiment end-to-end, use experiment-launch. For editing the targeting conditions or scope of an existing experiment rule, use flag-targeting. For stopping an experiment and cleaning up its rule, use experiment-stop then flag-rules.
How this skill is triggered — by the user, by Claude, or both
Slash command
/growthbook:flag-experimentThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Add an `experiment-ref` rule to a GrowthBook feature flag. This links a flag rule to a separately-managed GrowthBook experiment object — the experiment is the source of truth for variations, metrics, and analysis.
Add an experiment-ref rule to a GrowthBook feature flag. This links a flag rule to a separately-managed GrowthBook experiment object — the experiment is the source of truth for variations, metrics, and analysis.
All API calls go through the bundled helper: ${CLAUDE_PLUGIN_ROOT}/scripts/gb-call. It needs GB_API_KEY set in env or written to ~/.config/growthbook/.env by /growthbook:gb-setup.
Use this when the user has an existing GrowthBook experiment or wants to launch one through a flag.
1. Fetch the flag and confirm the experiment exists:
gb-call GET /api/v2/features/<flag-id>
Capture valueType — you'll need it to map variation values correctly.
gb-call GET /api/v1/experiments/<experiment-id>
Capture the experiment's variations array. Each variation has an id (e.g., var_abc123) and a name. You'll need these to wire up the rule.
If the user doesn't have an experiment yet, route to experiment-launch — it handles experiment creation AND flag wiring end-to-end. Importantly, if a flag already exists, experiment-launch will detect it (via a 409 on create, then the reuse path) and wire the experiment to the existing flag rather than creating a new one. Tell the user: "experiment-launch will pick up your existing flag — just give it the same flag key."
2. Map variation values:
For each experiment variation, confirm what flag value should be served. The flag's valueType determines the format:
boolean: typically "true" for treatment, "false" for controlstring / number / json: ask the user for each variation's value3. Build the payload:
{
"rule": {
"type": "experiment-ref",
"experimentId": "<exp-id>",
"variations": [
{ "variationId": "<var_control_id>", "value": "false" },
{ "variationId": "<var_treatment_id>", "value": "true" }
],
"description": "<optional>",
"enabled": true,
"allEnvironments": false,
"environments": ["<env-id>"]
}
}
Variation order in the variations array must match the experiment's variation order. If the user omits all variationId fields, the server auto-fills them from the experiment — but explicitly providing them is safer and avoids silent mismatches.
4. Post the rule:
echo '<payload>' | gb-call POST /api/v2/features/<flag-id>/revisions/new/rules -
Capture the returned version. Hand off to flag-publish.
The server allows patching enabled, condition, savedGroups, prerequisites, scope (allEnvironments/environments), and description on an experiment-ref rule. Use flag-targeting for this — it has the full conditions decision tree and the warn-and-confirm guardrails for the sensitive fields.
Do not edit experimentId or variations on an experiment-ref rule directly. The experiment is the source of truth. Changing these fields on the flag rule alone causes silent drift between the flag and the experiment. If the user needs to change the experiment, route to experiment-launch or the GrowthBook UI.
new. Fall back to new when starting fresh.variations order must match the experiment's variation order. If the order is wrong, variation assignments will be mismatched — the control users will see the treatment value and vice versa. Always confirm variation order by reading the experiment before building the payload.variationId is available but risky. If all variationId fields are omitted, the server fills them from the experiment. Use this only when the experiment has exactly the same number of variations as the values the user specified — otherwise the server may silently mismatch.experimentId or variations on an existing experiment-ref rule requires warn-and-confirm. These fields are API-allowed but cause flag/experiment drift. Always surface the risk and require explicit confirmation before patching.value, coverage, controlValue. These are attributes of the experiment, not the flag rule. Halt early if the user tries to set them.GET /api/v2/features/:id — fetch flag state, valueType, and current rulesGET /api/v1/experiments/:id — fetch experiment and its variationsPOST /api/v2/features/:id/revisions/new/rules — add the experiment-ref ruleflag-search — to find a flag ID when you only have a name or descriptionexperiment-launch — to create a new experiment and wire it to a flag end-to-endflag-targeting — to edit the targeting conditions, scope, or saved groups on an existing experiment-ref ruleflag-rules — to reorder or delete experiment rulesexperiment-stop — to stop the experiment; after stopping, use flag-rules to clean up the experiment-ref ruleflag-publish — to publish the draftnpx claudepluginhub growthbook/skills --plugin growthbookLaunch a GrowthBook A/B test end-to-end via the REST API — create the experiment, prep the feature flag, wire the experiment-ref rule, and start the experiment. Use when the user says "launch this experiment", "create the experiment", "wire up the A/B test", "kick off the test", "set up X as an experiment in GrowthBook", "start the experiment for flag Y", or "I already have a flag and want to run an experiment on it". Works for both experiment-first (creates the flag) and flag-first (detects the existing flag via the reuse path and wires the experiment to it). For designing the spec first, use experiment-design. For stopping a running experiment, use experiment-stop. For interpreting results, use experiment-analyze.
Guides you through designing, creating, and running A/B experiments in LaunchDarkly—configuring metrics, treatments, flag rules, starting iterations, swapping treatments, and declaring a winner.
Guides the 3-step experiment creation flow: hypothesis, rollout, and analytics. Delegates rollout and metric setup to specialized skills.