kayforkind/skill-slice/ab-testing-design-and-analysis

Claude Code and agent skill by kayforkind/skill-slice

Trust tier 1
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Design, power, run, and analyze statistically valid A/B/N product experiments (sample size, duration, SRM, sequential monitoring, multiple comparisons). Use when pre-registering a test or reading out a controlled split. Not for event instrumentation, funnel diagnosis, wandb ML tracking (weights-and-biases), MVP smoke tests (mvp-scoping-and-risk-test), or RICE scoring (feature-prioritization-frameworks).

Install

npx vskill@latest install kayforkind/skill-slice/ab-testing-design-and-analysis

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as kayforkind/skill-slice/ab-testing-design-and-analysis.

A/B Testing Design and Analysis

This skill governs how the agent designs, powers, runs, and reads out controlled product experiments so that a shipped decision is caused by the change — not by noise, peeking, or a broken split. Treat every experiment as a falsifiable bet placed in advance: commit to a hypothesis, a metric, a sample size, and a decision rule before data arrives, and honor that commitment when the data is inconvenient. The entire value of an experiment is destroyed the moment you let the result you want rewrite the rules you set.

Prime Directive: Power it before you peek at it. Fix the sample size, the metric, and the decision rule in advance, check the split is honest before you trust the readout, and never let a number you wanted change the rule you set. An experiment without a pre-registered stopping rule is not an experiment — it is a search for a flattering snapshot.

When to Use

Design triggers (planning an experiment):

  • "Set up an A/B test / A/B/N test / split test for [feature]."
  • "How big does my sample need to be?" / "calculate sample size / power."
  • "How long do we need to run this?" / "when can we call it?"
  • "What's the MDE I can catch with our traffic?"
  • "Design a multivariate / factorial test for [these elements]."
  • "Help me write the hypothesis / pick the primary metric / set the alpha."
  • "Should this be one-sided or two-sided?" / "what power should I use?"

Execution triggers (monitoring a running test):

  • "Is the split healthy?" / "check for sample ratio mismatch / SRM."
  • "Can I stop the test early?" / "it looks significant already, can we ship?"
  • "The two arms have uneven traffic — is something broken?"

Analysis triggers (reading out a result):

  • "Is this result statistically significant?" / "interpret this p-value / CI."
  • "Did the variant win?" / "is this lift real or noise?"
  • "Run a t-test / z-test / chi-square on these numbers."
  • "Compute the Bayesian probability that B beats A."
  • "We tested 12 metrics and 3 are significant — which do I trust?" (multiple comparisons)
  • "The overall result reversed when I segmented it." (Simpson's paradox)

Do NOT use this skill when:

  • The request is about instrumenting events (event naming, tracking plans, SDK setup, identity stitching). Route to telemetry-and-event-instrumentation. This skill consumes clean metrics; if events are wrong, no statistic can save you.
  • The request is about diagnosing where users drop off and forming a UX hypothesis (funnel analysis, session replay, heuristic friction audit). Route to conversion-funnel-optimization, which produces the hypothesis this skill then tests. Boundary: funnel work decides what and why; this skill decides how to test validly and whether it worked.
  • The request is pure exploratory / observational with no controlled assignment ("did revenue go up after we shipped X to everyone?"). A before/after with no concurrent control is a quasi-experiment; it cannot separate your change from seasonality. Say so and recommend a holdout or switchback design.
  • The request is about bandits / dynamic traffic allocation for pure optimization (maximize clicks now, don't care why). Multi-armed bandits optimize regret, not inference. (Caveat: this skill covers when to choose a bandit over an A/B test — see Core Principle 8.)
  • The request is about ML model offline evaluation (train/test splits, cross-validation, AUC). That is model validation, not product experimentation.
  • The request is about qualitative usability testing (5-user think-alouds). That informs hypotheses but yields no statistic.

When a request straddles a boundary (e.g., "the events don't exist and I want to test a fix"), diagnose under the funnel skill, instrument missing events under the telemetry skill, then design and analyze the experiment here. State the handoff explicitly.


Prerequisites

  1. Clean, trustworthy metrics already instrumented. If the events are wrong, no statistic can save you — fix instrumentation first (route to telemetry-and-event-instrumentation).
  2. A defined randomization unit with a stable, persisted identifier (user/account ID). If you cannot assign users to arms deterministically and stickily, you cannot run a valid A/B test.
  3. Knowledge of baseline metric value and variability. For proportions: the current rate. For means: the current mean and standard deviation. Without a baseline, sample size cannot be computed.
  4. A pre-registered decision rule. The ship/no-ship/iterate threshold must be set before data arrives. If the user has not committed to one, help them write one before proceeding.

Procedure

Follow the three phases in order — Design → Execute → Analyze — and do not advance until each phase's gate is met. The single most common cause of a wasted experiment is starting execution before the design is fully pre-registered.

Phase 0 — Establish Ground Truth (Before Any Math)

Resolve these before designing. If unknown, ask the user once, in a batch:

  1. The change and the mechanism: What exactly is being changed, and through what causal mechanism is it expected to move the metric? ("Bigger CTA → more clicks → more signups.")
  2. The primary metric: The single number that decides ship/no-ship. Is it a proportion (conversion rate), a mean (revenue per user, session length), a ratio (clicks per session), or a count? The metric type determines the test.
  3. The baseline: The current value of the primary metric and its variability (for means, the standard deviation; for proportions, the rate itself fixes the variance).
  4. The MDE worth caring about: The smallest effect that would change the decision — set by business value, not by what's easy to detect. This is a judgment made before seeing data.
  5. Traffic: Eligible users/day entering the experiment surface. This caps what is detectable in a sane duration.
  6. Constraints & risks: Interference/network effects (SUTVA), seasonality, concurrent experiments on the same surface, legal/consent limits, and what cannot be changed.
Phase 1 — DESIGN (Pre-Register Everything)
Step 1.1 — Write the Hypothesis in Standard Form
Because [evidence], we believe that [specific change] will [increase/decrease] [primary metric] for [population] by at least [MDE]. We will ship if the observed effect is ≥ [MDE-relevant threshold] and statistically significant at α=[value] with no guardrail regression.
Step 1.2 — Fix α, Power, and Tails
QuantitySymbolMeaningDefaultEffect of making it stricter
SignificanceαP(declare effect \none exists) — false positive0.05Lower α → larger N
Power1−βP(declare effect \effect exists) — sensitivity0.80Higher power → larger N
Type II rateβP(miss a real effect) — false negative0.20—
MDEδSmallest effect worth detectingbusiness-setSmaller MDE → quadratically larger N
Tails—One- vs two-sidedTwo-sidedTwo-sided → slightly larger N
  • α: default 0.05. Lower to 0.01 when a false ship is expensive or irreversible; this raises the sample size.
  • Power: default 0.80; use 0.90 for high-stakes decisions. Higher power needs more sample.
  • Tails: use two-sided by default — you must be able to detect a harmful effect, not just a beneficial one. Use one-sided only with a strong, pre-committed directional rationale. Never switch to one-sided after seeing data to scrape under 0.05.
Step 1.3 — Compute the Sample Size from First Principles

For a two-proportion primary metric (e.g., conversion rate), per-variant sample size for a two-sided test:

( z_{1−α/2} · √[2·p̄·(1−p̄)] + z_{1−β} · √[p₁·(1−p₁) + p₂(1−p₂)] )²
n = ─────────────────────────────────────────────────────────────────────
(p₂ − p₁)²
where p₁ = baseline rate, p₂ = p₁ + δ (target), p̄ = (p₁ + p₂)/2,
z_{1−α/2} = 1.959964 (α=0.05, two-sided), z_{1−β} = 0.841621 (power=0.80).

Conservative simplification (pooled variance, equal arms):

n ≈ (z_{1−α/2} + z_{1−β})² · [p₁(1−p₁) + p₂(1−p₂)] / (p₂ − p₁)²

Worked example (proportion): baseline p₁ = 0.20, want to detect a relative +5% lift → p₂ = 0.21, so δ = 0.01.

(z_{1−α/2} + z_{1−β})² = (1.95996 + 0.84162)² = (2.80158)² = 7.8489
p₁(1−p₁) = 0.20·0.80 = 0.16
p₂(1−p₂) = 0.21·0.79 = 0.1659
sum = 0.3259
n ≈ 7.8489 · 0.3259 / (0.01)² = 2.5580 / 0.0001 = 25,580 per variant
→ ~51,160 total for a 2-arm test.

Note: a relative 5% lift on a 20% base (absolute δ = 0.01) demands ~25.6k per arm; halving the MDE to 2.5% relative (δ=0.005) quadruples it to ~102k per arm, because N scales with 1/δ².

For a continuous / mean primary metric (e.g., revenue per user), use the standardized effect size (Cohen's d = δ/σ):

n = 2 · (z_{1−α/2} + z_{1−β})² · σ² / δ² (per variant, equal arms, two-sided)

Worked example (mean): σ = 40 (revenue SD), want to detect δ = $2.00.

n = 2 · 7.8489 · (40²) / (2²) = 2 · 7.8489 · 1600 / 4 = 2 · 7.8489 · 400 = 6,279 per variant.

For A/B/N (k variants): split traffic across all arms and apply a multiplicity correction to α (Step 1.5), which raises per-arm N; total traffic need grows faster than linearly in k.

For multivariate/factorial designs: estimate main effects efficiently by sharing samples across factors, but interaction effects need substantially more data — only run MVT when you have the traffic to power the interactions you care about.

Step 1.4 — Apply Variance Reduction to Shrink N (If a Pre-Period Exists)

If users have a pre-experiment value of the metric, apply CUPED (Controlled-experiment Using Pre-Experiment Data). Estimate θ = Cov(Y,X)/Var(X) on pooled data, replace Y with:

Y_cuped = Y − θ · (X − E[X])

where Y is the in-experiment metric, X is the pre-experiment covariate (same user, prior period). The mean of Y_cuped is an unbiased estimate of the mean of Y (because E[X − E[X]] = 0), but with lower variance. Effective sample-size savings ≈ 1 − ρ² where ρ = corr(pre, post). A ρ of 0.7 cuts variance ~50%, which halves the required sample size or doubles sensitivity. Re-derive N (or achievable MDE) with the reduced variance; document the covariate and measured ρ.

Step 1.5 — Correct for Multiplicity (If Multiple Variants or Metrics Gate Decisions)
  • k variants vs. one control: use Dunnett's correction, or Bonferroni α' = α/(k−1) as a simple bound.
  • m secondary metrics: apply Benjamini-Hochberg FDR to that family; keep the primary metric uncorrected and decision-gating.
  • State which family each metric belongs to before launch so corrections aren't gamed afterward.
Step 1.6 — Compute the Duration and Check Feasibility
duration_days = ceil( total_N_required / daily_eligible_users )
→ round UP to whole weeks to absorb day-of-week seasonality.
→ enforce a minimum of one full business cycle (≥7 days, usually ≥14)
even if N is reached sooner, so novelty effects and weekly cycles don't bias the readout.

If the required duration exceeds a sane window (typically >4 weeks), you are underpowered. Options:

  1. Raise the MDE (accept detecting only bigger effects).
  2. Reduce variance harder (CUPED, stratification, a less noisy metric).
  3. Move the test to a higher-traffic surface.
  4. Ship as a reasoned, explicitly un-tested decision.

Never run an underpowered test and interpret its noise.

Step 1.7 — Specify Randomization Unit, Analysis Unit, Bucketing, and Decision Rule

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kayforkind/skill-slice/ab-testing-design-and-analysis/badge)](https://verified-skill.com/skills/kayforkind/skill-slice/ab-testing-design-and-analysis)

Something wrong with this skill or its page? Tell us.