PluginWorks in Claude CodeCurrent
Growthbook
A suite of agent skills for the full GrowthBook feature flag and experimentation lifecycle.
0
Try it
See what this would do for you. No sign-up needed.
Install in Claude Code
Run these in Claude Code, in order. The first adds the marketplace, the second installs the plugin.
Step 1
/plugin marketplace add anthropics/claude-plugins-official
Step 2
/plugin install growthbook@claude-plugins-official
Review commands before running them. Promptu never runs code on your machine or pushes changes to your repo.
What's inside
4 skills
- analytics
- experiments
- feature-flags
- gb-setup
Security scan
Passed
Promptu's text scan of the files it could read didn't match any known risky patterns. It doesn't run the plugin, and a clean scan doesn't mean the plugin is safe.
Automated pattern check of 8 file(s) found nothing risky. Not a full audit.
Details
# GrowthBook Agent Skills
[GrowthBook](https://www.growthbook.io) is an open source Feature Flagging and Experimentation platform.
Agent skills for GrowthBook — feature flagging and experimentation playbooks for Claude Code, Cursor, and other agent tools that follow the [Agent Skills](https://agentskills.io) standard.
The skills call the [GrowthBook REST API](https://docs.growthbook.io/api) directly through a small bundled helper. No MCP server required.
## What's included
Four skills, one per domain. Each one is a router: it loads a short index, then reads only the workflow that matches what you asked for. The 27 workflows live as reference files inside their skill and stay out of context until they're needed.
### `feature-flags`
The full flag lifecycle. Flag changes go through a draft revision before going live, so the draft → review → publish workflows sit alongside the ones that make the change.
| Workflow | What it does |
| --- | --- |
| `flag-create` | Create a new feature flag — collision check, value type, environments, defaultValue. Ships disabled everywhere. |
| `flag-search` | Search, list, and audit flags by project, tag, owner, environment state, or staleness. Read-only. |
| `flag-graph` | Trace a flag's dependency graph: prerequisites, dependents, linked experiments and holdouts. Read-only. |
| `flag-toggle` | Enable or disable a flag in a specific environment (the kill switch). Review-gated. |
| `flag-targeting` | Add, edit, or remove force / rollout rules — with conditions, saved groups, and rule-level prerequisites. Full operator reference for MongoDB-style conditions. |
| `flag-rules` | List rules, delete a rule, reorder, or route to the right rule workflow. |
| `flag-experiment` | Add an experiment-ref rule to a flag to run an A/B test through it. |
| `flag-schedule` | Time-gate a rule: set a start and/or end datetime for automatic activation. |
| `flag-ramp` | Multi-step ramp schedule: progressively increase coverage over time with per-step intervals or manual approval gates. Includes live ramp management (advance, pause, rollback, approve-step). |
| `flag-monitoring` | Monitored progressive rollout ("safe rollout"): ramp schedule with guardrail metric monitoring and optional auto-rollback. |
| `flag-prerequisites` | Gate an entire flag on another boolean flag being on. |
| `flag-default-value` | Change the fallback value served when no rules match. |
| `flag-metadata` | Update a flag's description, owner, project, tags, custom fields, or JSON schema. |
| `flag-revisions` | List and inspect open drafts, check who owns them, see approval status, create or discard drafts. The "what's in flight?" workflow. |
| `flag-review` | Request an approval review on a draft, or submit one (approve / request-changes / comment). |
| `flag-publish` | Publish a draft live, resolve merge conflicts (rebase), discard, or revert to a prior revision. |
| `flag-cleanup` | Archive or delete a stale flag, walking through code-site inlining first. Two-step safety gate (archive → verify → delete). |
### `experiments`
| Workflow | What it does |
| --- | --- |
| `experiment-brainstorm` | Propose new experiment ideas grounded in your team's past stopped-experiment history. |
| `experiment-design` | Walk through hypothesis, variations, primary metric, guardrails, and sample size to produce a launchable spec. Reads only. |
| `experiment-launch` | End-to-end launch: create the experiment, prep or reuse the feature flag, wire the experiment-ref rule, and call `/start`. Handles approval and pre-launch checklist failure paths. |
| `experiment-analyze` | Trigger a fresh snapshot, poll until ready, then interpret results (SRM check, lifts, CIs, guardrails). |
| `experiment-stop` | Stop a running experiment, optionally declaring a winner and enabling a temporary rollout. Full post-stop flag disposition guidance. |
| `learnings` | Search, read, and record Learnings — durable conclusions drawn across multiple experiments. Check before designing a test; record after one generalizes. |
### `analytics`
Turn the metrics and fact tables you already use for experimentation into ad-hoc charts and saved dashboards with GrowthBook's [Product Analytics](https://docs.growthbook.io/app/product-analytics) Explorer.
| Workflow | What it does |
| --- | --- |
| `metric-search` | Search, list, and audit fact metrics and fact tables — definitions, columns, and what's chartable. Read-only. |
| `metric-create` | Create a fact metric, and the fact table underneath it when one doesn't exist yet. Covers all seven metric types; analysis settings inherit the org defaults. |
| `analytics-explore` | Build and run a chart: a metric over time, a fact-table aggregation, or a raw warehouse table. Returns the numbers plus a deep link to the rendered chart. |
| `dashboard-create` | Build a dashboard from a goal or a set of metrics. Chart blocks carry a config and the create call runs every one of them, so it's one write for the whole page. |
| `dashboard-edit` | Change a dashboard that exists: add or remove a chart, swap a metric, change the timeframe, rename or re-scope it. Reads the dashboard, then writes the full block list back. |
### `gb-setup`
Walks you through your API key and, for self-hosted installations, the API and app origins. Validates against the live API and writes `~/.config/growthbook/.env` with `chmod 600`. Re-run anytime to update.
## Install
### 1. Install the plugin
**Claude Code:**
```text
/plugin marketplace add growthbook/skills
/plugin install growthbook@growthbook-skills
```
**Cursor, Codex, Warp, Zed, and other [agentskills.io](https://agentskills.io)-compatible agents:**
```bash
npx skills add growthbook/skills
```
This installs the skills at project scope. Restart your agent if the skills don't appear immediately. Node 18+ is required (which is what most agents already run on).
### 2. Configure credentials
The quickest path is to run the setup skill:
```text
/growthbook:gb-setup
```
It walks you through your API key and (for self-hosted) your API and app origins — then validates against the live API and writes `~/.config/growthbook/.env` with `chmod 600`. Every other skill reads that file automatically.
**Prefer shell-rc?** You can export the variables instead. The skills read environment variables first; the file is only consulted when an env var is unset.
```bash
export GB_API_KEY=<your-key> # required: PAT or Secret Key
export GB_API_URL=https://api.your-host # self-hosted only
export GB_APP_URL=https://growthbook.your-host # self-hosted only; trusted UI origin
```
Get a Personal Access Token from [`app.growthbook.io/account/personal-access-tokens`](https://app.growthbook.io/account/personal-access-tokens). The token is tied to your GrowthBook user, so flags and experiments the write skills create are attributed to you automatically — no separate owner setting needed.
### 3. Verify
```text
/growthbook:feature-flags
```
Ask it to list your flags. If anything's wrong with the config, the error points back at `/growthbook:gb-setup`.
## How to invoke
Skills can activate automatically or through the client's explicit skill-invocation UI:
- **Automatically** when the agent detects an intent matching the skill's description ("create a feature flag for the new pricing page" → `feature-flags`, which then reads its `flag-create` workflow; "what should we test next" → `experiments` → `experiment-brainstorm`).
- **Claude Code plugin:** type `/growthbook:feature-flags`, `/growthbook:experiments`, `/growthbook:analytics`, or `/growthbook:gb-setup`. These domain slash commands remain registered; reference workflows are not separate commands.
- **Other Agent Skills clients:** explicitly select or invoke `feature-flags`, `experiments`, `analytics`, or `gb-setup` using that client's skill UI or syntax.
You don't invoke workflows directly — the domain skill picks one from your request. Workflows hand off to each other, so multi-step jobs compose cleanly:
- **Experiment-first:** `learnings` (what do we already know?) → `experiment-design` → `experiment-launch` → `experiment-analyze` → `experiment-stop` → `flag-cleanup`, recording back to `learnings` when a result generalizes
- **Flag-first:** `flag-create` → `flag-toggle` → `flag-targeting` → `flag-ramp` / `flag-monitoring` → `flag-cleanup`
- **Experiment on an existing flag:** `flag-experiment` → `experiment-launch` (reuses the existing flag) → `experiment-stop` → `flag-cleanup`
- **Analytics:** `metric-search` → `analytics-explore` → `experiment-design` (when a chart surfaces something worth testing)
- **Metric setup:** `metric-search` (does it exist?) → `metric-create` → `analytics-explore` (sanity-check the numbers) → `experiment-design`
- **Dashboards:** `metric-search` → `analytics-explore` (check one chart reads right) → `dashboard-create` → `dashboard-edit` (as the questions change)
## What these skills do not do
- **No datasource creation.** Connect datasources in the GrowthBook UI and reference them by ID; `metric-create` covers fact tables and fact metrics, but not the warehouse connection underneath them.
- **No metric analysis tuning.** `metric-create` defines what a metric measures; conversion windows, capping, priors, and risk thresholds inherit the org defaults and are tuned in the GrowthBook UI.
- **No experiment dashboards.** `dashboard-create` and `dashboard-edit` cover general Analytics dashboards. A dashboard attached to an experiment is edited on that experiment's page, and the per-experiment result blocks only render there.
- **No SDK code generation.** Follow GrowthBook's SDK docs; these skills manage flags and experiments via the REST API, not the SDK.
- **No bandit workflows yet.** GrowthBook's REST API supports multi-armed bandit experiments and separate Enterprise beta Contextual Bandits, but these skills currently target standard A/B tests. They identify either bandit type and halt rather than apply fixed-allocation experiment guidance to an adaptive experiment.
- **No silent retries or rate-limit backoff in the helper.** GrowthBook is rate-limited at 60 rpm. The skills that fan out cap their call counts; multi-tenant orgs hitting concurrent requests may still see `429`s, which `gb-call` surfaces explicitly rather than retrying.
## How it works
The plugin bundles a small Node helper (`scripts/gb-call`) that handles auth, API base URL, trusted app-origin resolution, and error reporting. Each of the four skill directories also contains a `scripts/gb-call` symlink so agents installed via `npx skills install` (Cursor, Codex, etc.) can resolve it relative to the skill directory. Skills call it via Bash:
```bash
gb-call GET /api/v2/features
echo '<payload>' | gb-call POST /api/v2/features -
gb-call app-origin
```
`gb-call` is shorthand in workflow examples. The domain router resolves it to `${CLAUDE_PLUGIN_ROOT}/scripts/gb-call` for the Claude Code plugin or `scripts/gb-call` relative to a standalone skill install; it does not need to be globally available on `PATH`. External agents call `app-origin` once per conversation when they first need a UI link and reuse that trusted origin across workflows.
See [`scripts/README.md`](scripts/README.md) for the full usage reference.
## Repository layout
```
.claude-plugin/
marketplace.json
plugin.json
scripts/
gb-call # Node REST helper (zero deps, Node 18+)
README.md # gb-call usage, config sources, error catalog
skills/
<domain>/
SKILL.md # router: description, workflow index, shared conventions
scripts/gb-call # symlink → ../../../scripts/gb-call (for npx-installed agents)
references/<workflow>.md # one workflow: steps, guardrails, endpoints, handoffs
feature-flags/
SKILL.md
references/
flag-create.md flag-search.md flag-graph.md
flag-toggle.md flag-targeting.md flag-rules.md flag-experiment.md
flag-schedule.md flag-ramp.md flag-monitoring.md flag-prerequisites.md
flag-default-value.md flag-metadata.md
flag-revisions.md flag-review.md flag-publish.md
flag-cleanup.md
experiments/
SKILL.md
references/
experiment-brainstorm.md experiment-design.md experiment-launch.md
experiment-analyze.md experiment-stop.md learnings.md
analytics/
SKILL.md
references/
metric-search.md metric-create.md analytics-explore.md
dashboard-create.md dashboard-edit.md
gb-setup/
SKILL.md # one-time onboarding; no references/
CLAUDE.md # authoring conventions for contributors
.gitignore
README.md
LICENSE
CHANGELOG.md
```
## Security & secrets
- **Where the key lives.** `gb-setup` writes `~/.config/growthbook/.env` inside a `0700` directory at file mode `0600` — owner-read/write only. Environment variables take precedence over the file, so CI and one-off overrides keep working.
- **Pasting a key into chat.** The value you give `gb-setup` lands in your local transcript and is sent to your configured model provider as part of the conversation; it cannot be retroactively masked. Generate a fresh PAT for the plugin rather than reusing your personal admin token — that way you can revoke it independently if anything goes wrong.
- **Revoking a leaked key.** Visit [`app.growthbook.io/account/personal-access-tokens`](https://app.growthbook.io/account/personal-access-tokens) (or your self-hosted equivalent) and revoke. Then re-run `/growthbook:gb-setup` with the replacement.
- **What the helper rejects.** `gb-call` refuses values containing whitespace or control characters (CRLF in `GB_API_KEY` would inject headers) and rejects malformed `GB_APP_URL` origins. `gb-setup` refuses `http://` URLs and URLs with a path, query, hash, or credentials.
## Contributing
Issues and PRs welcome at [github.com/growthbook/skills](https://github.com/growthbook/skills). For larger proposals (new skills, changes to skill scope), open an issue first.
Before changing a skill: read [`CLAUDE.md`](CLAUDE.md). It documents the skill structure, the `allowed-tools` security model, the "verify every payload shape against the GrowthBook back-end source before shipping" rule, and a doc cross-reference map for finding the canonical answer on any GrowthBook concept.
## License
MIT — see [LICENSE](LICENSE).
## skills/analytics/SKILL.md
---
name: analytics
description: Chart GrowthBook product data, build Analytics dashboards, manage the metric catalog, or query the warehouse directly — run Product Analytics explorations, save charts together on a dashboard, search metrics and fact tables, create fact metrics and their fact tables, or fall back to ad-hoc SQL. Use for "show me signups by country", "chart daily active users", "how many orders last week", "build me a dashboard", "put these metrics on a dashboard", "add a chart to this dashboard", "set up reporting for X", "find our revenue metric", "what fact tables exist", "create a metric", "define a metric on the orders table", "what tables contain user data", "run a SQL query", or any "show me / chart / plot / how many" question about product data. For an A/B test's results or choosing experiment metrics, use experiments. For feature flags, use feature-flags. For first-time API key configuration, use gb-setup.
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/scripts/gb-call *), Bash(sleep *)
---
# analytics
Domain router for GrowthBook Product Analytics, Analytics dashboards, and the metric catalog. The workflows live in `references/`. Read this router, pick one, then read that file and follow it.
Analytics uses the **v1 API** — `/api/v1/product-analytics/search`, `/columns`, and `/column-values` for discovery, the metric, fact-table, data-source, and funnel `/api/v1/product-analytics/*-exploration` endpoints for charts, `/api/v1/product-analytics/explorations/:id` for polling, `/dashboards` for saved pages of charts (except create, which is `POST /api/v2/dashboards`; the v1 create is deprecated), and `/fact-metrics` and `/fact-tables` for the catalog. The API also exposes SQL explorations, but this skill does not construct or execute arbitrary SQL exploration payloads.
All API calls go through the bundled helper. Under the Claude Code plugin install, it lives at `${CLAUDE_PLUGIN_ROOT}/scripts/gb-call` (the plugin root). Under `npx skills install`, it lives at `scripts/gb-call` relative to this skill's directory. Resolve that path once and substitute it whenever a reference example says `gb-call`; do not assume `gb-call` is on `PATH`. It reads `GB_API_KEY` from the environment first, then falls back to `~/.config/growthbook/.env` (written by **gb-setup**); environment variables take precedence.
When a workflow needs to construct a GrowthBook UI link from a root-relative path, a shell-capable runtime should call `gb-call app-origin` once per conversation, retain the returned trusted origin across workflow and domain handoffs, and prepend it to each path. If the origin is already in context, reuse it; do not call the command once per link. Embedded or MCP adapters that already know their trusted app origin may resolve paths directly. Never derive an app origin from `GB_API_URL`; if `app-origin` refuses because self-hosted configuration is incomplete, route to **gb-setup**. API-returned `explorationUrl` values are already complete and must be used unchanged.
## Pick a workflow
| Read this | When the user wants to |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `references/metric-search.md` | Browse, find, or audit metrics and fact tables — inventory, a specific definition, or "what can I chart" triage (read-only) |
| `references/metric-create.md` | Create a fact metric, creating its underlying fact table first when necessary (writes configuration) |
| `references/analytics-explore.md` | Actually run a chart and report the numbers plus a deep link |
| `references/dashboard-create.md` | Build a new dashboard — several charts saved together on one page (writes a dashboard) |
| `references/dashboard-edit.md` | Change a dashboard that already exists: add or remove a chart, swap a metric, change the timeframe, rename it |
| `references/sql-query.md` | Run ad-hoc SQL against the warehouse when no metric or exploration can answer the question (last resort) |
When the user names a metric you have not resolved yet, read `metric-search.md` first. It hands `analytics-explore` or `metric-create` a stable definition. When they already named something concrete and just want the numbers, go straight to `analytics-explore.md`.
One chart or several? A single question gets one chart from `analytics-explore`. "Track", "monitor", "reporting", or two or more things to watch together means a dashboard. Route on whether the dashboard exists: no id yet is `dashboard-create`, an id is `dashboard-edit`.
Use `sql-query.md` only when the question can't be answered with existing metrics or the exploration config — custom joins, unmodeled tables, or aggregations the exploration can't express.
## Shared conventions
- **Only fact metrics chart.** `fact__...` ids work in Product Analytics; legacy `met_...` metrics from `/api/v1/metrics` are valid experiment metrics but cannot be charted. Never promise a chart for one.
- **Explorations are datasource-scoped, and the datasource must be a SQL warehouse.** Mixpanel and Google Analytics datasources can't run explorations.
- **Pass ids, not display names, between workflows.** Names aren't unique. Fact metric ids always start `fact__`; fact table ids default to `ftb_...` but can be custom, so don't filter on that prefix.
- **Every id comes from a lookup or from the user's `@` mention — never construct one.** Some are readable (`fact__demo-d7-purchase-retention`) and invite a guess like `fact__AverageOrderValue`; those resolve to nothing, and the failure surfaces late and obscurely.
- **Discover before constructing.** Use Product Analytics search and columns, and call column-values before using any concrete filter or breakdown value. Never guess a value.
- **Check before creating.** Prefer an existing `official: true` metric over adding a duplicate with the same meaning.
- **A `200` from an exploration POST is not necessarily success.** Branch on `exploration.status`; poll `running` explorations by id, surface `error`, and note that `cache=required` can return `exploration: null`.
- **Handle workflow-endpoint 404s conservatively.** A 404 from `/product-analytics/search` means the server predates these endpoints. On `/columns`, `/column-values`, or `/explorations/:id`, it can also mean the resource is missing or inaccessible. Surface the failure and stop; never probe around access checks, substitute an undocumented endpoint, or re-POST a running exploration.
- **Use the returned full result rows for numeric insights.** Do not infer values from a chart preview, truncated summary, or config.
- **Run at most one successful chart per user turn.** Discovery, polling, and one empty-result retry are allowed; once one non-empty exploration succeeds, answer from it unless the user explicitly asks for another chart in a later turn.
- **Always set `unit` explicitly** on every `dataset.values[]` entry — that is the only level that takes one; a `unit` on the config itself is rejected. For metrics, follow `/columns` exactly: when `metrics[].needsUnit` is true, choose a returned `userIdTypes` entry; when it is false, default to `null`. A unit is an **identifier type**, never a value format such as `currency`. The server does not backfill a missing unit.
- **A date range's `predefined` is a closed list**, everywhere one appears: `today`, `yesterday`, `last7Days`, `last30Days`, `last90Days`, `last12Months`, `lastCalendarYear`, `customLookback`, `customDateRange`. Any other name is rejected, so every window outside the list is `customLookback` with `lookbackValue` and `lookbackUnit` (`hour`, `day`, `week`, `month`).
- **`dimensionType` is a closed set**, and `"dimension"` is not in it: `date`, `dynamic`, `static`, `slice`. Only the first two are supported — a date axis is `{ "dimensionType": "date", "column": null, "dateGranularity": "auto" }` and a breakdown by column is `{ "dimensionType": "dynamic", "column": "browser", "maxValues": 5 }`. Naming the field after what you want to group by is the guess the validator rejects.
- **Never re-send a rejected call unchanged.** A 400 is deterministic: the same body gets the same error, so a retry that has not changed the field the message names only spends the user's turn. Read `body.message`, fix exactly what it names, and send it once more. If the message does not say what a valid value would be, or the same field is rejected twice, stop there — say which field failed and what you tried, and ask the user rather than guessing a third time. Ask about **that field**: a validation error names the field it rejected, and a question about a different one (a column name, a metric choice) cannot resolve it, so the answer arrives and the same call fails again.
- **Restyling a chart is free.** Cache matching ignores `chartType`, so a different chart type on the same query is a cache hit. Never re-query just to restyle.
- **A dashboard's chart blocks carry a `config`, not a result.** The create and update calls run every chart server-side, so never POST an exploration first just to get an id for a tile.
- **An update replaces a dashboard's whole block list.** Read the dashboard in the same turn you write it, and list every tile being kept — but carry an unchanged one as `{ "id": "dshblk_…" }` rather than copying it back in full, and list each id at most once.
- **A dashboard's `owner` changes only when the user asks.** Create on `POST /api/v2/dashboards` without `owner`, which defaults to the API key's user, unless the user names someone else. Never put `owner` or `ownerEmail` in an update body unless the user asked to reassign the dashboard. For an admin, a stray `owner` silently hands the dashboard to someone else.
- **Dashboards are not scoped to a datasource** the way metrics and explorations are, but every chart on one is.
## Read-only vs. write
`metric-search` is strictly read-only. `analytics-explore` runs warehouse queries but changes no GrowthBook configuration — it does not create metrics, fact tables, or dashboards. `sql-query` is similar: it never mutates warehouse data, but it executes potentially costly queries and persists a GrowthBook exploration object from the results. `metric-create` writes organization-visible fact-table and fact-metric definitions, and `dashboard-create` / `dashboard-edit` write dashboards; all three must summarize the change in plain language and get confirmation before each write.
Note that explorations execute real warehouse queries, so they cost the user money and time even though they write nothing — and a dashboard write runs one per chart block. Scope them the way the reference files describe rather than fanning out speculatively.
## Handoffs
- The **experiments** skill — when the question is an A/B test readout, or when a chart surfaces something worth testing.
- The **feature-flags** skill — when the user pivots to shipping or gating the thing the data is about.
- **gb-setup** — when `gb-call` reports a missing or invalid `GB_API_KEY`.
## skills/experiments/SKILL.md
---
name: experiments
description: Design, launch, analyze, and stop GrowthBook A/B tests, and search or record durable Learnings across experiments. Use for experiments, split tests, variations, hypotheses, sample size, guardrail metrics, SRM, chance to win, lift, declaring a winner, "what have we learned", "have we tested this before", or "record this learning". For bandits, identify them and direct the user to GrowthBook UI. For feature flags and rollouts, use feature-flags. For product analytics or metric catalog work, use analytics. For API key configuration, use gb-setup.
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/scripts/gb-call *), Bash(sleep *)
---
# experiments
Domain router for GrowthBook experiments and the durable Learnings distilled from them. Each workflow lives in a reference file under `references/`. Read this router, pick the workflow that matches where the user is, then read that one file and follow it.
Experiments use the **v1 API** (`/api/v1/experiments`). When a workflow also touches a feature flag, the flag calls are v2 — the reference file spells out which is which.
All API calls go through the bundled helper. Under the Claude Code plugin install, it lives at `${CLAUDE_PLUGIN_ROOT}/scripts/gb-call` (the plugin root). Under `npx skills install`, it lives at `scripts/gb-call` relative to this skill's directory. Resolve that path once and substitute it whenever a reference example says `gb-call`; do not assume `gb-call` is on `PATH`. It reads `GB_API_KEY` from the environment first, then falls back to `~/.config/growthbook/.env` (written by **gb-setup**); environment variables take precedence.
When a workflow needs to present a GrowthBook UI link, a shell-capable runtime should call `gb-call app-origin` once per conversation, retain the returned trusted origin across workflow and domain handoffs, and prepend it to the root-relative UI paths in the reference file. If the origin is already in context, reuse it; do not call the command once per link. Embedded or MCP adapters that already know their trusted app origin may resolve the same paths directly. Never derive an app origin from `GB_API_URL`; if `app-origin` refuses because self-hosted configuration is incomplete, route to **gb-setup**.
## Pick a workflow
The experiment lifecycle runs brainstorm → design → launch → analyze → stop. `learnings` sits before design when checking prior knowledge and after analysis when evidence supports a durable conclusion.
These workflows target `type: "standard"` experiments. GrowthBook's REST API also supports multi-armed bandit experiments and separate Enterprise beta Contextual Bandit resources, but neither lifecycle is implemented here. If the request is about either kind of bandit, identify it accurately and direct the user to GrowthBook UI; do not apply the standard-experiment workflows to it.
| Read this | When the user wants to |
| --- | --- |
| `references/experiment-brainstorm.md` | Get ideas for what to test, grounded in past stopped experiments (proposes only) |
| `references/experiment-design.md` | Turn an idea into a launchable spec — hypothesis, variations, metrics, sample size (writes nothing) |
| `references/experiment-launch.md` | Create the experiment, prep or reuse the flag, wire the experiment-ref rule, and start it |
| `references/experiment-analyze.md` | Read results — refresh the snapshot if stale, then interpret (read-only) |
| `references/experiment-stop.md` | Stop a running experiment, optionally declare a winner and roll it out |
| `references/learnings.md` | Search and read prior conclusions, or create, update, and delete curated Learnings across experiments |
If the user has an idea but no hypothesis, start at `experiment-design`; it routes back to `experiment-brainstorm` when the idea needs grounding. If they hand you a name rather than an ID, `experiment-analyze` and `experiment-stop` both open with a resolve-by-name step.
## Methodology authority
`references/experiment-launch.md` was authored directly by GrowthBook's head of data science and is the **canonical voice** on statistical framing, hypothesis discipline, goal-metric counts, and guardrail requirements. When another reference file appears to disagree with it on methodology, follow `experiment-launch` and flag the drift. Do not resolve such a conflict by reasoning from general A/B testing intuition — GrowthBook's defaults are its own (Bayesian by default, no multiple-comparison correction on guardrails, sequential testing widens intervals).
This router deliberately carries no statistical guidance of its own. Interpretation rules live in the reference files.
## Shared conventions
- **Metrics must already exist.** No workflow here creates a metric. When one is missing, the user creates it in the GrowthBook UI first; the reference file says where.
- **Metrics must live on the experiment's datasource** or the experiment POST fails.
- **Don't mix `templateId` with `datasourceId` / `assignmentQueryId`** on create.
- **`winnerVariationId` is a variation ID string** (e.g. `var_abc123`) — not an integer index, not a variation name.
- **Resolve-by-name uses `q`,** which matches name, tracking key, description, and hypothesis. It rejects `!`, `~`, `^`, `>`, `<`, `=` with a 400 — send plain `field:value` tokens and free text. Filter bandits with `bandits`, never `type` (`type` is not a list param; `implementationType` is a different axis).
- **`result` is the recorded result and survives a restart,** so `result=won` can return a running experiment. Pair it with `status=stopped`.
- **`limit` caps at 100** on the experiments list.
- **Show users the experiment name and link the UI path `/experiment/<id>`,** not raw ids alone.
- **UI links are root-relative paths.** Never infer the GrowthBook UI origin from `GB_API_URL`; API and UI origins need not share a hostname. A runtime with a trusted app origin may resolve the path; otherwise surface the root-relative path without guessing.
- **An empty Learning corpus is not an empty experiment record.** Fall back to stopped-experiment history before concluding the team has no prior evidence.
## Read-only vs. write
`experiment-brainstorm`, `experiment-design`, and `experiment-analyze` never write — brainstorm and design are proposal-only and must not POST an experiment into existence, and analyze must not stop or modify one. `experiment-launch` and `experiment-stop` write experiment state. The `learnings` search/list paths are read-only; its create, update, and delete paths require explicit confirmation immediately before the write.
## Budget
GrowthBook rate-limits at 60 rpm. `experiment-brainstorm` fans out across paginated history and `experiment-analyze` polls for snapshot completion behind an explicit iteration cap with `sleep` between polls. Keep both caps — they're what stops a busy org from pinning the limit.
## Handoffs
- The **feature-flags** skill — anything about the flag itself: creating it, its targeting rules, its rollout, publishing its draft, cleaning it up after a test ships.
- The **analytics** skill — picking metrics out of the catalog before designing, or charting product data that isn't an experiment readout.
- **gb-setup** — when `gb-call` reports a missing or invalid `GB_API_KEY`.
## skills/feature-flags/SKILL.md
---
name: feature-flags
description: Read and modify GrowthBook feature flags — create, search, toggle, target, schedule, ramp, monitor, publish drafts, and archive. Use when the user mentions a feature flag, feature toggle, kill switch, rollout, targeting rule, percentage release, saved group, prerequisite, draft revision, flag approval, or flag cleanup. Triggers include "create a flag for X", "release this to 10% of users", "turn on flag X in production", "gradually roll this out", "publish this draft", "what flags do we have", "who needs to approve this", and "delete this stale flag". For designing, launching, analyzing, or stopping an A/B test, use the experiments skill. For charting product data or browsing the metric catalog, use the analytics skill. For first-time API key configuration, use gb-setup.
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/scripts/gb-call *)
---
# feature-flags
Domain router for GrowthBook feature flags. Every flag workflow lives in a reference file under `references/`. Read this router, pick the workflow that matches the user's intent, then read that one file and follow it.
Flags use the **v2 API** (`/api/v2/features`). Environments, projects, and saved groups are v1.
All API calls go through the bundled helper. Under the Claude Code plugin install, it lives at `${CLAUDE_PLUGIN_ROOT}/scripts/gb-call` (the plugin root). Under `npx skills install`, it lives at `scripts/gb-call` relative to this skill's directory. Resolve that path once and substitute it whenever a reference example says `gb-call`; do not assume `gb-call` is on `PATH`. It reads `GB_API_KEY` from the environment first, then falls back to `~/.config/growthbook/.env` (written by **gb-setup**); environment variables take precedence.
When a workflow needs to present a GrowthBook UI link, a shell-capable runtime should call `gb-call app-origin` once per conversation, retain the returned trusted origin across workflow and domain handoffs, and prepend it to the root-relative UI paths in the reference file. If the origin is already in context, reuse it; do not call the command once per link. Embedded or MCP adapters that already know their trusted app origin may resolve the same paths directly. Never derive an app origin from `GB_API_URL`; if `app-origin` refuses because self-hosted configuration is incomplete, route to **gb-setup**.
## Pick a workflow
Read exactly one of these, based on what the user is doing. If two look plausible, read the more specific one.
| Read this | When the user wants to |
| --- | --- |
| `references/flag-create.md` | Create a new flag |
| `references/flag-search.md` | Find, list, or audit flags — by project, tag, owner, environment state, or staleness (read-only) |
| `references/flag-graph.md` | Trace what a flag depends on, what depends on it, and its linked experiments or holdouts (read-only) |
| `references/flag-toggle.md` | Enable or disable a flag in an environment — the kill switch |
| `references/flag-targeting.md` | Add, edit, or remove force / rollout rules, conditions, saved groups, rule-level prerequisites |
| `references/flag-rules.md` | List, reorder, or delete rules, or route to the right rule-type workflow |
| `references/flag-experiment.md` | Add an experiment-ref rule so an A/B test runs through the flag |
| `references/flag-schedule.md` | Time-gate a rule with a start and/or end datetime |
| `references/flag-ramp.md` | Build or drive a multi-step ramp schedule (progressive coverage over time) |
| `references/flag-monitoring.md` | Set up a monitored / safe rollout — a ramp plus guardrail metrics and optional auto-rollback |
| `references/flag-prerequisites.md` | Gate the whole flag on another boolean flag |
| `references/flag-default-value.md` | Change the value served when no rules match |
| `references/flag-metadata.md` | Change description, owner, project, tags, custom fields, or JSON schema |
| `references/flag-revisions.md` | See what drafts are open, who owns them, start or discard a draft |
| `references/flag-review.md` | Request a review, or approve / request changes / comment on a draft |
| `references/flag-publish.md` | Publish a draft, resolve a merge conflict, revert, or discard |
| `references/flag-cleanup.md` | Archive or delete a stale flag, inlining its value at code sites first |
Ambiguity worth resolving before you read: "turn off the flag" is `flag-toggle` if they mean the whole environment, `flag-rules` if they mean one rule. "Roll this out" is `flag-targeting` for a one-shot percentage, `flag-ramp` for a schedule, `flag-monitoring` if guardrail metrics should gate it.
## Shared conventions
These hold across every flag workflow. The reference files assume them.
- **Everything writes through a draft revision.** Rules, metadata, default value, and toggles all create or update a draft, which then has to be published. `flag-publish` owns the publish step; the write workflows hand off to it.
- **Thread the draft version through a chain.** When several write workflows run in sequence in one session, carry the `version` returned by the previous step instead of re-sending `new`. `new` auto-creates or reuses a draft, which can silently pick up a teammate's concurrent draft mid-chain. Only fall back to `new` (or `/revisions/latest?mine=true`) on a fresh start.
- **POSTing `rules` replaces the entire array.** The v2 rules array is top-level and scoped by `environments` or `allEnvironments`. GET the current rules first for any partial edit.
- **`defaultValue` is always a string,** whatever the flag's value type.
- **Show users the flag key** (the `id`), never an internal Mongo id. Link to the UI path `/features/<key>`.
- **UI links are root-relative paths.** Never infer the GrowthBook UI origin from `GB_API_URL`; API and UI origins need not share a hostname. A runtime with a trusted app origin may resolve the path; otherwise surface the root-relative path without guessing.
- **Print deep links, don't open them.** This skill has no browser grant on purpose — surface the path and let the user click when its runtime can resolve it.
### Failure modes
Verified against the back-end handlers; don't collapse these into one another.
- **400 on the publish endpoint** means approval is required (`This revision requires approval before publishing`). The policy gate is working as intended — hand to `references/flag-review.md`.
- **403 on a path that publishes as a side effect** means the same thing, from a different code path: the environment toggle and `POST /v2/features/<id>` with `{archived}` both go through `createAndPublishRevision`, which raises a permission error rather than a bad-request error. Read the body — if it doesn't mention review, the token lacks permission outright and the problem is `GB_API_KEY`.
- **409 on publish** me

