Command Palette

Search for a command to run...

Назад к скиллам
скилл № 28030

create-experiment

Set up, review, or retire an A/B experiment in Grafana Pathfinder end to end: MTFF flag, variant validation, enrollment seam, exposure analytics, QA…

БесплатноБез исполняемых скриптов
grafanaот grafana★ 24 звезды на GitHub

Установить create-experiment в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

create-experiment — Set up a Pathfinder A/B experiment

Experiments here are remote-configured, per-stack, and temporary. This skill covers the whole lifecycle so an experiment does not leak into the codebase permanently or ship with a broken readout.

Read this whole file before writing code. Several of the constraints below are silent when violated — the experiment still compiles, still renders, and produces numbers that mean nothing.

Before you start: is this actually an experiment?

You want to… Use
Compare two behaviours and measure which performs better An experiment (this skill)
Turn something on or off remotely, or ship a kill switch A boolean flag — see docs/developer/FEATURE_FLAGS.md
Let an operator configure per-instance behaviour Plugin jsonData admin settings in src/constants.ts

A boolean flag can never be an experiment. reportFeatureFlagExposure in src/utils/openfeature-tracking.ts drops any flag whose valueType is not 'object', so a boolean experiment flag silently produces zero enrollment events and no readout. This is the single most expensive mistake to make here.

Hard constraints of the platform

Confirm the experiment design survives all four before writing code. If it does not, say so to the user rather than building something that cannot measure what they asked for.

  1. Allocation is per-stack, not per-user. initializeOpenFeature sets targetingKey: config.namespace (src/utils/openfeature.ts). Every user on a Grafana stack lands in the same arm, so the readout compares stacks. There is no client-side bucketing in this repo and adding one is a much larger decision — raise it with the user rather than inventing it.
  2. Flags are read once per page load. The provider is created with disableVisibilityRefresh: true and cacheMode: 'disabled'. A mid-session flag flip reaches a tab only on its next load.
  3. The values array is documentation. Nothing validates a payload against it at runtime. Your validator is the only protection.
  4. MTFF is Cloud-only. With no config.namespace (OSS, local dev), initialization is skipped and every flag returns its default. Local testing goes through localStorage overrides.

Steps

1. Define the flag

Add to pathfinderFeatureFlags in src/utils/openfeature.ts. This is the one piece that must live outside your experiment directory — the registry is the typed source of FeatureFlagName.

'pathfinder.<experiment-name>-experiment': {
  valueType: 'object',
  values: EXPERIMENT_VARIANTS.map((variant) => ({ variant })),
  defaultValue: { variant: 'excluded' },
  trackingKey: '<experiment_name>_experiment',
},
  • Name in kebab-case under the pathfinder. prefix (compile-time enforced).
  • Default to excluded. A missing or broken flag must enroll nobody.
  • A trackingKey is required for exposure events to fire at all.
  • Keep defaultValue an inline literal so the registry does not import your experiment module — that import direction causes a cycle (see step 3).

Three arms, always: excluded (not in the experiment), control (in it, current behaviour), treatment (in it, new behaviour). excluded and control must render identically; the difference is only whether the user is counted.

EXPERIMENT_VARIANTS, defined in src/types/openfeature.types.ts and re-exported from src/utils/openfeature.ts, is the runtime vocabulary and derives the TypeScript union. Adding an arm also requires an explicit policy in both total projections: EXPERIMENT_VARIANT_EMITS_EXPOSURE in src/utils/openfeature-tracking.ts and EXPERIMENT_VARIANT_PRECEDENCE in src/lib/analytics.ts. The compiler should fail until both decisions are made.

The compiler does not cover runtime arm gates (variant === 'treatment' checks in the experiment modules under src/utils/experiments/ and anything they feed); review each explicitly when adding an arm.

2. Create the experiment module

Everything else goes in src/utils/experiments/<experiment-name>.ts so retirement is a directory delete.

The module owns: the config interface, the runtime default, the validator, the reader, and the enrollment memo.

Validate the whole payload, reject the whole payload. Reuse parseExperimentVariant and warnExperimentRejection from src/utils/openfeature.ts — do not hand-roll variant checking. On rejection fall back to excluded.

Two rejection sources behave differently, and this trips people up in QA:

Rejected payload from Result
MTFF (remote) The `exclude
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл create-experiment?

Set up, review, or retire an A/B experiment in Grafana Pathfinder end to end: MTFF flag, variant validation, enrollment seam, exposure analytics, QA overrides, tests, docs, and a retirement plan. Use for `/create-experiment` or any request to add an experiment, a variant, or an experiment-gated feature.

Как установить скилл create-experiment?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл create-experiment запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить create-experiment с