kayforkind/skill-slice/ab-testing-design-and-analysis
Claude Code and agent skill by kayforkind/skill-slice
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
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-analysisSemi-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
- Clean, trustworthy metrics already instrumented. If the events are wrong, no statistic can save you — fix instrumentation first (route to telemetry-and-event-instrumentation).
- 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.
- 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.
- 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:
- 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.")
- 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.
- 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).
- 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.
- Traffic: Eligible users/day entering the experiment surface. This caps what is detectable in a sane duration.
- 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
| Quantity | Symbol | Meaning | Default | Effect of making it stricter | ||
|---|---|---|---|---|---|---|
| Significance | α | P(declare effect \ | none exists) — false positive | 0.05 | Lower α → larger N | |
| Power | 1−β | P(declare effect \ | effect exists) — sensitivity | 0.80 | Higher power → larger N | |
| Type II rate | β | P(miss a real effect) — false negative | 0.20 | — | ||
| MDE | δ | Smallest effect worth detecting | business-set | Smaller MDE → quadratically larger N | ||
| Tails | — | One- vs two-sided | Two-sided | Two-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:
Conservative simplification (pooled variance, equal arms):
Worked example (proportion): baseline p₁ = 0.20, want to detect a relative +5% lift → p₂ = 0.21, so δ = 0.01.
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 = δ/σ):
Worked example (mean): σ = 40 (revenue SD), want to detect δ = $2.00.
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:
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
If the required duration exceeds a sane window (typically >4 weeks), you are underpowered. Options:
- Raise the MDE (accept detecting only bigger effects).
- Reduce variance harder (CUPED, stratification, a less noisy metric).
- Move the test to a higher-traffic surface.
- 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
- SKILL.md in the repositoryCheckingskills/ab-testing-design-and-analysis/SKILL.md
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
[](https://verified-skill.com/skills/kayforkind/skill-slice/ab-testing-design-and-analysis)