agentleFS
JayRHaJayRHa/agent-skills/ab-test-analyzer/SKILL.md

ab-test-analyzer

Skill12 starsChanged 5 months agoMITView on GitHub

Designs and analyzes A/B tests end-to-end — frames a sharp hypothesis, computes required sample size and test duration, runs significance tests (two-proportion z-test, Welch's t-test, chi-square), reports confidence intervals and lift, and flags common pitfalls like peeking, multiple comparisons, and Simpson's paradox. Use this skill when the user mentions A/B testing, split testing, experiment design, conversion-rate experiments, statistical significance, p-values, sample size or power calculations, "did this experiment win", minimum detectable effect (MDE), or asks to interpret experiment results honestly. Includes a runnable stats script (scripts/abtest.py).

We split this skill into the rules it gives an agent

12 rules. 0 are common, 8 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill whenever someone wants to plan an experiment, decide if a result is real, or sanity-check an analysis someone else did.

    line 14
  2. Distinctive:

    Follow these steps in order.

    line 23
  3. Very specific:

    Compute required sample size and duration: Run scripts/abtest.py size.

    line 37
  4. Distinctive:

    Check for logging bugs, bot traffic, and that randomization was at the right unit.

    line 43
  5. Very specific:

    Run the significance test: Use scripts/abtest.py prop (rates) or scripts/abtest.py ttest (means).

    line 45
  6. Very specific:

    Account for multiplicity: If you tested multiple metrics or variants, apply a correction (Bonferroni or Benjamini-Hochberg).

    line 49
  7. Very specific:

    Write it up: Use templates/experiment-report.md so decisions are reproducible and reviewable.

    line 51
  8. Distinctive:

    After the test, control 5,800/58,000 = 10.00%, treatment 6,150/58,000 = 10.60%:

    line 71
  9. Distinctive:

    Run for whole weeks; account for day-of-week and novelty effects.

    line 80
  10. Distinctive:

    Use one primary OEC; everything else is a guardrail or exploratory.

    line 82
  11. Distinctive:

    Always run an SRM check before trusting any result.

    line 83
  12. Distinctive:

    Prefer two-sided tests; one-sided needs strong justification.

    line 84

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

A/B Test Analyzer

Overview

This skill helps design and analyze controlled online experiments (A/B and A/B/n tests) with statistical rigor and honest interpretation. It covers the full lifecycle: hypothesis framing, sample-size and duration planning, choosing the right test, computing p-values and confidence intervals, and avoiding the traps that produce false wins.

Keywords: A/B test, split test, experiment, hypothesis, sample size, power, MDE, minimum detectable effect, statistical significance, p-value, confidence interval, conversion rate, lift, two-proportion z-test, t-test, chi-square, peeking, multiple comparisons, Simpson's paradox, SRM, novelty effect.

Use this skill whenever someone wants to plan an experiment, decide if a result is real, or sanity-check an analysis someone else did.

Core Mental Model

  • An A/B test estimates a causal effect by randomizing units (usually users) into control and treatment.
  • You are testing a null hypothesis (no difference) against an alternative (there is a difference). A p-value is P(data this extreme or more | null is true) — NOT the probability the null is true, and NOT the probability your variant is better.
  • Two error types: Type I (false positive, rate = alpha, typically 0.05) and Type II (false negative, rate = beta; power = 1 - beta, typically 0.80).
  • You must fix sample size and test duration BEFORE you start. Stopping when significant ("peeking") inflates the false-positive rate dramatically.

Workflow

Follow these steps in order. Do not skip planning steps even when only asked to "analyze results" — verify the plan was sound first.

  1. Frame the hypothesis. Turn the vague goal into a falsifiable statement: "Changing X will increase metric M from baseline b by at least the MDE, because [mechanism]." Identify ONE primary metric (the Overall Evaluation Criterion / OEC). Pre-register guardrail metrics. See references/methodology.md for OEC selection.
  2. Pick the metric type.
    • Binary / rate (conversion, click, signup) → two-proportion test.
    • Continuous (revenue per user, time on page, order value) → Welch's t-test (means).
    • More than 2 variants → chi-square (rates) or ANOVA-style + correction.
  3. Set the design parameters.
    • Baseline rate or baseline mean (b).
    • Minimum Detectable Effect (MDE): the smallest lift worth detecting. Express relative (e.g. +5%) and convert to absolute.
    • alpha (default 0.05), power (default 0.80), one- vs two-sided (almost always two-sided).
  4. Compute required sample size and duration. Run scripts/abtest.py size. Divide required N per arm by daily eligible traffic per arm to get duration in days. Round duration UP to full weeks to cover weekday/weekend seasonality (min 1 week, ideally 2).
  5. Run the test untouched for the full pre-planned duration. No peeking-with-action. (You may monitor guardrails for catastrophic harm only.)
  6. Validate data quality BEFORE looking at the result.
    • Sample Ratio Mismatch (SRM): is the actual split close to the planned split? Run scripts/abtest.py srm. If p < 0.001, the experiment is broken — do NOT trust the result.
    • Check for logging bugs, bot traffic, and that randomization was at the right unit.
  7. Run the significance test. Use scripts/abtest.py prop (rates) or scripts/abtest.py ttest (means). Report: effect size (absolute + relative lift), confidence interval, p-value, and whether it crossed alpha.
  8. Interpret honestly. A non-significant result is NOT proof of no effect — report the CI to show what effects are still plausible. A significant result with a CI that includes trivially small lifts may not be worth shipping. See references/interpretation-guide.md.
  9. Account for multiplicity. If you tested multiple metrics or variants, apply a correction (Bonferroni or Benjamini-Hochberg). See references/methodology.md.
  10. Write it up. Use templates/experiment-report.md so decisions are reproducible and reviewable.

Choosing the Test (decision table)

MetricVariantsTestScript command
Rate / proportion2Two-proportion z-testabtest.py prop
Rate / proportion>2Chi-square (then pairwise + correction)abtest.py chisq
Continuous mean2Welch's t-testabtest.py ttest
Continuous mean>2ANOVA + post-hoc (use a stats lib)external
Any—Sample size planningabtest.py size
Any—SRM / sanity checkabtest.py srm

Quick Worked Example

Baseline conversion 10%, want to detect a relative +5% (→ 10.5% absolute), alpha 0.05, power 0.80, two-sided:

python scripts/abtest.py size --baseline 0.10 --mde-rel 0.05 --alpha 0.05 --power 0.80

→ ~ 58,000 users per arm. At 4,000 eligible users/arm/day → ~15 days → round to 2 full weeks.

After the test, control 5,800/58,000 = 10.00%, treatment 6,150/58,000 = 10.60%:

python scripts/abtest.py prop --c-conv 5800 --c-n 58000 --t-conv 6150 --t-n 58000

→ absolute lift +0.60pp, relative +6.0%, 95% CI on absolute difference, and a p-value. Decide using the CI, not just the p-value. See examples/conversion-test.md for the full walkthrough.

Best Practices

  • Pre-register: hypothesis, primary metric, MDE, sample size, duration, and the decision rule BEFORE launch.
  • Randomize at the right unit (usually user, not session/pageview) and keep it consistent across the funnel.
  • Run for whole weeks; account for day-of-week and novelty effects.
  • Report effect size + confidence interval first; treat the p-value as secondary.
  • Use one primary OEC; everything else is a guardrail or exploratory.
  • Always run an SRM check before trusting any result.
  • Prefer two-sided tests; one-sided needs strong justification.

Common Pitfalls

  • Peeking / optional stopping: checking daily and stopping at first significance turns a 5% false-positive rate into 20-30%+. Fix sample size up front, or use a proper sequential/Bayesian method.
  • p-hacking / metric shopping: testing 20 metrics and reporting the one with p<0.05. Correct for multiplicity.
  • Simpson's paradox: an aggregate winner can lose in every segment if traffic mix differs. Check key segments; beware mixing pre/post populations.
  • Sample Ratio Mismatch: a broken split (e.g. 52/48 instead of 50/50) signals a bug that biases everything.
  • Confusing significance with importance: with huge N, trivially small lifts become "significant." Use the MDE and the CI.
  • Confusing non-significance with "no effect": underpowered tests fail to detect real effects. Report the CI.
  • Novelty/primacy effects: early behavior differs from steady state; don't conclude from day 1-2.
  • Multiple comparisons across variants: A/B/C/D testing without correction inflates false positives.

See references/pitfalls-checklist.md for a pre-launch and pre-decision checklist to run every time.

Bundled Files

  • scripts/abtest.py — runnable, stdlib-only calculator: sample size, two-proportion z-test, Welch's t-test, chi-square, SRM. Run python scripts/abtest.py --help.
  • references/methodology.md — deep dive on hypotheses, OEC, power, MDE, multiplicity corrections, sequential testing, Bayesian alternative.
  • references/interpretation-guide.md — how to read p-values, CIs, and what each outcome (sig/non-sig × big/small effect) actually means for a ship decision.
  • references/pitfalls-checklist.md — copy-paste checklist for design and analysis review.
  • templates/experiment-report.md — fill-in template for documenting an experiment.
  • examples/conversion-test.md — a complete end-to-end worked example.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.