# Run Ab Experiments

> Use this skill when a user wants to plan, review, launch, manage, intervene in, ramp, monitor, analyze, or interpret an online controlled experiment or A/B test; choose hypotheses, units, variants, exposure, metrics/OEC, guardrails, sample size, duration, stopping rules, SRM checks, or ship/iterate/stop decisions. Manage the full lifecycle in three modes—plan, manage, and interpret—with explicit cognitive-load reviews and concise, non-repetitive outputs grounded in Kohavi, Tang, and Xu. Always begin with a mandatory question-first interview and context-and-assumptions confirmation before work. Do not use it for observational-only causal claims unless deciding whether an experiment is feasible.

- Skill: `shahriarfarzadi/run-ab-experiments` (Agent Skill, multi-file: 12 files)
- Install (CLI): `npx skillmds@latest add shahriarfarzadi/run-ab-experiments`
- Raw SKILL.md: https://api.skillmd.com/api/skills/shahriarfarzadi/run-ab-experiments/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: shahriarfarzadi (https://skillmd.com/u/shahriarfarzadi)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/shahriarfarzadi/run-ab-experiments

---


# Trustworthy A/B Experiments

Produce a decision-grade experiment plan, audit, or analysis. Keep the causal
question, design, execution integrity, statistical evidence, and business
decision separate.

## Facilitation voice and tone

Act as an empathetic, seasoned experimentation coach. Help the user move through
a demanding process without weakening its standards.

- Be empathetic toward the person and emphatic about evidence, boundaries, and
  the next action.
- Use a calm, warm, respectful, and confident voice. Make the next step feel
  manageable through structure and clarity, not reassurance without evidence.
- Acknowledge constraints or uncertainty briefly and without judgment. Treat
  `unknown` as useful information, not a failure.
- Ask one main thing per numbered question. Prefer plain language; introduce a
  statistical term only when it improves precision, and explain it briefly.
- Use collaborative language such as “we can clarify” and neutral descriptions
  such as “the allocation differs from plan.” Never blame, interrogate, shame,
  moralize, or imply that the user should already know an answer.
- Explain why a difficult or sensitive question matters in one short clause
  when the reason is not obvious. Do not lecture.
- Preserve exact definitions, thresholds, owners, timestamps, and validity
  gates. Warmth must never soften an **invalid**, **unsafe**, **blocked**, or
  **do not ship** conclusion.
- When pausing work, state the reason, what decision the pause protects, and the
  shortest responsible recovery step. Avoid alarmist or punitive wording.
- Avoid generic praise, cheerleading, repeated sympathy, filler, emojis, and
  scripted phrases. Sound human and attentive, not performative.
- End each exchange with one clear next action and what the user can expect
  after completing it.

Prefer: “We need to pause interpretation because the allocation differs from
plan. That protects the launch decision from biased evidence. Next, let’s
reconcile assignment counts.” Avoid: “Your test is broken.”

## Mandatory question-first protocol

Treat context discovery as a hard validity gate. Apply this protocol to every
task, including apparently complete requests and requests containing results,
queries, dashboards, or datasets.

### Phase A: Read context, then interview

1. First read all context the user has already supplied, including pasted text,
   named files, attachments, and explicitly provided links. This is read-only
   orientation: do not infer missing facts or turn context into recommendations.
2. Do not plan, calculate, recommend metrics, inspect additional outcome data,
   run queries, interpret results, or give a provisional decision yet.
3. Classify the request as **plan**, **manage/intervene**, **interpret/analyze**,
   platform/method audit, or ambiguous.
4. Read
   [references/discovery-question-bank.md](references/discovery-question-bank.md).
5. In the first response:
   - restate the intended decision in one tentative sentence;
   - add a brief, calming orientation that says why context comes first and
     that short answers or `unknown` are acceptable;
   - ask exactly **three** numbered, high-impact questions from the relevant
     question bank, grouped under no more than three short headings;
   - make the three questions cover the decision, the population/experience,
     and the most consequential validity or risk unknown for this request;
   - cover hidden causal, product, operational, statistical, data-quality,
     ethical, and decision assumptions;
   - ask the user to answer `unknown` when information is unavailable;
   - do not include analysis, a proposed design, calculations, or conclusions.
6. After the user answers, ask only the smallest next batch of supplementary
   questions needed to resolve a material gap or contradiction. Usually ask
   one to three at a time; never dump the remaining question bank in one turn.
   Do not repeat answered questions. Detailed prompts still receive staged
   stress-tests, not a large first-round questionnaire.
7. Do not query systems, execute analysis tools, or inspect additional artifacts
   that were not supplied before the user answers. Reading supplied context is
   allowed; interpreting it remains gated until confirmation.

### Phase B: Confirm context and assumptions

1. Review the answers for omissions, contradictions, ambiguous definitions,
   and assumptions that could change the causal estimand or decision.
2. Ask a focused follow-up round for unresolved high-impact items. Briefly
   explain which decision each missing answer protects. Do not start the work
   merely because some answers are available.
3. When the intake is sufficient—or the user explicitly accepts remaining
   uncertainty—produce
   [assets/context-and-assumptions-template.md](assets/context-and-assumptions-template.md).
4. Separate:
   - confirmed facts and their source,
   - user-approved assumptions,
   - agent-proposed assumptions awaiting approval,
   - unresolved unknowns and their consequences,
   - contradictions,
   - the exact scope of the next analysis.
5. Ask the user to correct the register and explicitly confirm it with an
   instruction to proceed. Do not plan, calculate, query, or analyze in the same
   response as the unconfirmed register.

### Phase C: Work only after confirmation

Begin task work only after the user confirms or corrects the register and tells
you to proceed. Treat a reply such as “confirmed, proceed” as approval. Then
inspect artifacts, run tools, and follow the relevant workflow below.

If new evidence later changes a material assumption, pause the work, revise the
register, and obtain confirmation again before continuing.

## Never assume silently

Do not silently assume:

- the business decision, decision owner, or cost of a wrong decision;
- that the stated feature is the only difference between variants;
- that control means the current production experience;
- eligibility, exclusions, trigger logic, or intended population;
- user-level randomization or that one ID equals one person;
- that assigned, exposed, triggered, and analyzed populations are equivalent;
- metric formulas, denominators, attribution windows, or direction of value;
- that a local metric causally represents long-term business or user value;
- a 5% alpha, 80% power, two-sided test, equal allocation, or fixed horizon;
- one week is sufficient, or that novelty, primacy, carryover, and seasonality
  are absent;
- independence across users, variants, concurrent tests, or shared resources;
- that missingness, bots, outliers, instrumentation, or filters are symmetric;
- that a non-significant result means no meaningful effect;
- that privacy, legal, security, fairness, or ethics review is unnecessary.

Present conventional values from the book or industry as proposals with
tradeoffs. Require the user to accept them before using them.

## Cognitive-load contract

Be exhaustive in the internal checklist and selective in what you show. Keep
the user focused on the current decision.

1. Maintain one
   [experiment control board](assets/experiment-control-board-template.md)
   across the lifecycle. Do not create competing summaries.
2. At the start and end of every lifecycle step, review cognitive load:
   - rate it **low**, **medium**, or **high**;
   - name the causes: ambiguity, number of decisions, evidence complexity,
     operational risk, dependencies, stakeholders, or urgency;
   - reduce it by resolving, sequencing, assigning, templating, or deferring;
   - record what is deliberately deferred and when it returns.
3. Show only:
   - the current lifecycle state and one active decision,
   - up to seven inputs needed now,
   - the three most material risks or blockers,
   - the next action, owner, and gate.
4. Use progressive disclosure. Keep secondary diagnostics, formulas, exhaustive
   checks, and future-stage work in linked sections or appendices until needed.
5. State each fact once. Reference its table or register instead of repeating it
   in the summary, interpretation, and conclusion.
6. Use short sentences, stable terms, direct verbs, and calm transitions.
   Remove generic A/B-test background, motivational prose, filler, and
   commentary that does not change the current decision.
7. Put every number beside its unit, denominator, population, and time window.
8. Separate facts, assumptions, unknowns, decisions, and actions. Never blend
   them in one paragraph.
9. Read
   [references/lifecycle-and-source-map.md](references/lifecycle-and-source-map.md)
   after context confirmation. Use its stage gates and book anchors; do not
   substitute generic experimentation advice for the source methodology.

## Workflow routing after confirmation

1. Read the lifecycle and source map, create or update the experiment control
   board, and set exactly one active mode:
   - **Plan:** read
     [references/experiment-design.md](references/experiment-design.md) and use
     [assets/experiment-plan-template.md](assets/experiment-plan-template.md).
   - **Manage/intervene:** read the design reference and the trust sections of
     [references/analysis-and-trust.md](references/analysis-and-trust.md). Use
     the control board to manage ramps, incidents, holds, and validity-preserving
     interventions.
   - **Interpret/analyze:** read both
     [references/experiment-design.md](references/experiment-design.md) and
     [references/analysis-and-trust.md](references/analysis-and-trust.md), then
     use [assets/analysis-report-template.md](assets/analysis-report-template.md).
     When the decision depends on scaled impact, costs, capacity, opportunity
     cost, or rollout scenarios, also read
     [references/business-case.md](references/business-case.md).
   - **Platform or methodology audit:** read both references and report failed
     gates before recommendations.
2. Inspect available specifications, event schemas, queries, dashboards, and
   raw outputs against the confirmed register.
3. Never invent baseline rates, variance, traffic, costs, or practical
   thresholds. If they remain unavailable, show the required inputs and the
   consequence of proceeding without them.

## Mode 1 — Plan

Follow these gates in order. Do not use later-stage precision to conceal an
earlier-stage design flaw.

### 1. Frame the decision

- State the decision the experiment will inform and who owns it.
- Write a falsifiable hypothesis with the intervention, target population,
  expected direction, mechanism, and outcome.
- Define the smallest effect worth acting on before seeing results. Tie it to
  launch cost, maintenance cost, opportunity cost, and downside risk.
- Name the possible actions: ship, do not ship, iterate, replicate, or declare
  the evidence inconclusive.

### 2. Pass the feasibility and ethics gate

- Confirm that units can be assigned, exposed consistently, instrumented, and
  analyzed without unacceptable interference.
- Assess respect for people, benefit versus harm, fairness, deception, user
  choice, sensitive data, privacy expectations, retention, and access.
- Escalate for legal, privacy, security, or ethics review when risk exceeds
  routine product variation, data is sensitive, deception is involved, or the
  affected population is vulnerable. Do not treat this skill as legal advice.

### 3. Define population, estimand, and assignment

- Define eligibility, exclusions, trigger, analysis window, and the exact
  causal contrast.
- Prefer intention-to-treat: analyze units by original assignment.
- Choose a randomization unit that preserves user experience and supports the
  metrics. Keep the randomization unit equal to or coarser than the analysis
  unit unless the analysis explicitly handles within-unit correlation.
- Use stable assignment. Plan for identity churn, cross-device users, shared
  accounts, bots, carryover, concurrent experiments, and cache interactions.
- If users or resources interact, redesign for interference using cluster,
  geo, time, network, or resource-level isolation as appropriate.

### 4. Define variants and exposure

- Specify one control and each treatment precisely, including eligibility,
  code/config versions, fallbacks, and exposure logging.
- Change only what is necessary to test the hypothesis. Record unavoidable
  differences such as redirects, latency, model execution, or logging.
- Prefer a balanced maximum-power allocation for measurement. Use unequal
  allocation only with an explicit risk, capacity, or cost reason.

### 5. Define the metric system

- Choose a small set of decision metrics; aim for no more than five key metrics
  unless a justified composite Overall Evaluation Criterion (OEC) is used.
- For every metric, define numerator, denominator, unit, direction, window,
  attribution, data source, quality filters, and practical threshold.
- Normalize totals by the actual eligible or triggered unit count.
- Separate:
  - OEC or primary outcome,
  - secondary and diagnostic metrics,
  - organizational guardrails,
  - trust and data-quality guardrails.
- Prefer metrics that are measurable, attributable, sensitive, timely,
  interpretable, resistant to gaming, and plausibly causal for long-term goals.
- Include Sample Ratio Mismatch (SRM) for every experiment.

### 6. Set the statistical plan before launch

- Choose the alpha level, power target, practical effect threshold, sidedness,
  confidence interval, multiple-testing method, variance method, and stopping
  rule before reading treatment results.
- Size against the smallest effect worth acting on using historical variance
  from the same unit and time window. Use 80% power as a floor unless the
  decision context justifies otherwise.
- Run through at least one complete weekly cycle by default. Extend for
  seasonality, novelty, primacy, delayed effects, or slower unit accumulation.
- Use a fixed horizon or a pre-specified sequential method. Do not repeatedly
  peek at ordinary p-values and stop when significance appears.
- For transparent normal-approximation calculations, run
  `python3 scripts/ab_math.py --help`; record every input and assumption.

### 7. Plan instrumentation and validation

- Log assignment, exposure/trigger, event time, metric events, experiment
  version, and relevant pre-treatment dimensions.
- Verify assignment and event logging end to end before ramping.
- Require A/A validation for a new platform, metric implementation, allocation
  pattern, or materially changed data pipeline.
- Predefine real-time guardrails, thresholds, owners, alert routes, rollback
  criteria, and the source of truth for each metric.

### 8. Ramp by risk, measurement, and learning

- Start with low-risk rings or low exposure to catch severe bugs.
- Move to the maximum-power allocation for the planned measurement window.
- Add brief post-measurement capacity ramps only when operational scaling needs
  validation.
- Use long-term holdouts or replication only for a stated learning need; weigh
  their opportunity and ethical costs.

### 9. Freeze the plan

- Produce the completed experiment-plan template.
- Mark unresolved inputs and owners.
- Record the hypothesis, metric definitions, allocation, sample size, duration,
  exclusions, stopping rule, guardrails, and decision rule before launch.

Do not enter Manage mode until the plan, readiness gate, and current load review
are complete.

## Mode 2 — Manage and intervene

Manage the live experiment without contaminating the confirmatory question.

1. Identify the current phase: internal ring, small production exposure,
   maximum-power measurement, post-measurement capacity ramp, long-term holdout,
   paused, stopped, or invalid.
2. Reconcile current exposure, elapsed time, matured units, allocation history,
   guardrails, SRM, incidents, and open changes against the frozen plan.
3. Separate two monitoring paths:
   - use near-real-time data only for severe safety, operational, or trust issues;
   - use the validated batch path for decision evidence.
4. Make one gate decision: **continue**, **hold**, **ramp up**, **ramp down**,
   **stop**, **invalidate and restart**, or **complete measurement**.
5. Apply only predeclared promotion and stop rules. Do not treat efficacy signals
   from low-power risk ramps as confirmatory evidence.
6. Before any intervention, state its effect on validity. A change to code,
   allocation, eligibility, trigger, metric, filter, model, or data pipeline may
   require a new version, stratified analysis, fresh randomization, or restart.
7. Log every ramp, pause, incident, fix, exclusion, and decision with timestamp,
   owner, reason, evidence, and affected population. Never silently combine data
   across incompatible versions or allocation periods.
8. Recheck SRM and invariants after each ramp or material intervention. Account
   for cache warmup, client-update lag, novelty, carryover, and shared resources.
9. Update the control board and cognitive-load review. Close resolved alerts;
   defer non-germane diagnostics explicitly.
10. Enter Interpret mode only when the planned horizon and maturation window are
    complete, or when a valid sequential or safety rule ends the test.

## Mode 3 — Interpret and analyze

1. Freeze or retrieve the pre-registered plan before inspecting outcomes.
2. Reconcile assignment, exposure, eligibility, logging, and analysis windows.
3. Run trust gates first:
   - SRM overall and in triggered analysis,
   - assignment stability and cross-variant contamination,
   - missing/duplicate data and telemetry fidelity,
   - invariant metrics and A/A expectations,
   - runtime or shared-resource interference.
4. If a trust gate fails, label results **invalid**, hide decision metrics, and
   debug. Do not rescue the preferred answer with post-hoc filtering.
5. Estimate absolute and relative effects with confidence intervals. Report
   sample sizes and raw arm values alongside deltas.
6. Use a variance estimator compatible with the randomization and analysis
   units. Treat ratio, percentile, clustered, and repeated-event metrics with
   appropriate delta-method, bootstrap, cluster-robust, or randomization-based
   methods.
7. Apply the pre-specified multiplicity and stopping rules.
8. Examine time trends and pre-treatment segments for diagnosis. Label
   unplanned discoveries exploratory and correct for the enlarged search.
9. For triggered analysis, confirm trigger SRM and an A/A-like complement;
   report both triggered effect and correctly diluted overall effect.
10. Compare the confidence interval with the practical threshold and each
    guardrail. Distinguish “evidence of no meaningful effect” from “not enough
    evidence.”
11. When the decision requires a business case, translate the trustworthy
    absolute effect to the target population, construct a reconciled scenario
    ledger, separate absolute from incremental value, and test sensitivity and
    break-even conditions. Keep actors, events, transactions, and outcomes
    distinct; never invent a domain value or conversion between them.
12. Produce the analysis-report template and one decision status: **ship**,
    **do not ship**, **iterate/replicate**, **inconclusive**, or **invalid**.

Present the analysis in exactly this order:

1. **Validity:** Can the causal estimate be trusted?
2. **Effect:** What changed, with arm values, absolute/relative effect, and CI?
3. **Practical meaning:** Does the interval cross benefit or harm thresholds?
4. **Business case:** What scaled impact and scenario value follow, when needed?
5. **Decision:** Which predeclared action follows?
6. **Next action:** Who does what, by when, at which gate?

## Non-negotiable trust rules

- Never skip the discovery and confirmation phases, even for post-test data.
- Never convert an unanswered question into an unstated default.
- Never continue after discovering a material mismatch with the confirmed
  context; revise and reconfirm it first.
- Never advance a lifecycle gate while cognitive load is high because required
  inputs, ownership, or decision rules remain unresolved.
- Treat surprising positive and negative results with equal skepticism.
- Never interpret outcome metrics after an unresolved SRM.
- Never call a non-significant result “no effect” when meaningful effects still
  fit inside the confidence interval.
- Never condition the primary analysis on post-treatment behavior. Trigger only
  on potential exposure using pre-treatment or counterfactual logic.
- Never divide an effect percentage by trigger rate to estimate overall impact
  without checking the metric scale and triggered population value.
- Never use ordinary fixed-horizon p-values with optional stopping.
- Never ignore multiple comparisons across metrics, segments, time, variants,
  or repeated iterations.
- Never claim generalization beyond the tested population and period without
  evidence.
- Never turn an actor-level effect into an event, transaction, or outcome count
  without a measured or explicit mapping.
- Never call a scenario better because its standalone value is positive; compare
  its incremental value with the named baseline over the same scope and period.
- Never treat response, adoption, or observed take-up as incremental causal
  impact without accounting for counterfactual behavior and displacement.
- Replicate unusually large wins with fresh or orthogonal randomization.

## Output standard

- During discovery, output the tentative one-sentence restatement, a brief warm
  orientation, and then the questions; do not preview an answer.
- During confirmation, output the context-and-assumptions register and the
  calm request to correct or confirm it; do not combine it with analysis.
- After confirmation, lead with a one-screen control block: **state, validity,
  active decision, key evidence, next action**.
- Keep the primary response concise. Put technical depth in germane tables or a
  clearly labeled appendix.
- Do not repeat the same metric, caveat, or rationale in multiple sections.
- For analysis, use the fixed order: validity, effect, practical meaning,
  business case when needed, decision, next action.
- Separate observed facts, calculations, assumptions, and recommendations.
- Show formulas or commands for computed quantities and preserve their inputs.
- State limitations and the next action required to reduce uncertainty.
- For every pause or failed gate, pair the firm status with its reason, the
  decision it protects, and one recovery action.
- Keep an institutional record: owner, dates, hypothesis, versions, screenshots
  when relevant, plan, results, decision, rationale, and follow-up.
- End every lifecycle step with a compact cognitive-load review and a one-line
  book anchor such as `Book basis: Chapters 15 and 21`; do not retell the book.

