/polymath-data:run-experimentfrom polymath-data
Plan an A/B (or A/B/n) experiment — hypothesis, primary + guardrail metrics, MDE + sample size + duration, randomization, stop conditions.
Ships in polymath-data. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Pin an experiment's design before launching. Output: a doc the on-call analyst can read in 90 seconds and the launch reviewer can approve without re-asking.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
experimentToGA workflow.[TBD: …] and the plan is not launch-ready — never invent a baseline.[VERIFY: MDE]).Hypothesis — write it as: "Changing X will move primary-metric by ≥ MDE without regressing guardrails by > tolerance."
Primary metric. One metric. If you need two, you have two experiments. Make it:
metrics-tree).Guardrails — 2-3 max. Latency, error rate, key downstream conversions. State the regression tolerance per guardrail.
MDE + sample size + duration — run the bundled script, never compute by hand. Defaults: power 0.8, α = 0.05 two-sided; with more than two variants it applies Bonferroni (α / (k − 1) per comparison vs control):
python3 "${POLYMATH_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/skills/run-experiment/scripts/sample-size.py" \
--metric mean --sigma 2000 --mde 100 --daily-eligible 80000 --allocation 1.0
# proportion: --metric proportion --baseline 0.12 --mde 0.01 (or --mde-relative 5)
It uses the exact normal-approximation formulas (Lehr's 16σ²/MDE² is the α = 0.05 / power 0.8 shortcut of the mean case), converts to days of traffic, rounds the run up to whole weeks with a 7-day floor (weekday vs weekend behavior), and marks the plan UNDERPOWERED past the 4-week cap — printing the MDE that is detectable in 28 days so the owner can pick a bigger MDE or a larger allocation. Paste its block verbatim.
Do not launch an UNDERPOWERED plan without the owner explicitly accepting the longer run or the larger MDE in writing (in the plan file).
Randomization unit. User-level for product changes; session-level for content / UX experiments where multi-device matters; cluster-level (org / org-pair) for B2B to avoid contamination.
Allocation. 50/50 once tooling supports it; 90/10 (ramp) only when risk is high and you accept lower power. Document.
Stop conditions.
python3 "${POLYMATH_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/skills/run-experiment/scripts/sample-size.py" --srm 50421,49579 --split 50,50. p < 0.001 means the assignment is broken and the results are void.Pre-registration. Write the plan before launch and freeze. Post-hoc metric switching ("oh, let's check this other one") inflates false-positive rate.
run-experiment: refund-async-writes
Hypothesis
Changing the refund pipeline to async writes will reduce refund p99
latency by ≥ 100ms without regressing refund-completion-rate by > 0.3%.
Variants
A (control) — current sync write path
B (treatment) — async write to refund-worker
Allocation
50/50, user-level randomization.
Primary metric
mean refund latency per user, ms (lower-is-better). Baseline 1,200 ms;
σ = 2,000 ms (heavy tail); MDE 100 ms.
(p99 latency is tracked as a guardrail, analyzed by bootstrap.)
Guardrails
refund_completion_rate tolerance: > -0.3 percentage points
refund_5xx_rate tolerance: < +0.2 percentage points
Sample size + duration (sample-size.py, verbatim)
Experiment sizing (two-sided, α = 0.05, power = 0.8, 2 variants)
Metric: mean, σ = 2,000, MDE = 100 (absolute)
z: z(1−α/2) = 1.960, z(power) = 0.842
n per variant: 6,280 (total 12,560)
Traffic: 80,000 eligible/day × 100% in experiment
Duration: 0.16 days of traffic → run 7 days (whole weeks, 7-day floor)
Verdict: OK — within the 28-day cap
SRM check: sample-size.py --srm <A>,<B> before reading any metric.
Stop conditions (evaluated once, at day 7 — no early stop on significance)
Success: treatment mean lower than control, p < 0.05, guardrails clean.
Failure: significant regression on primary OR any guardrail breach.
Inconclusive: not significant at day 7.
Emergency: incident or guardrail breach → halt immediately.
Pre-registration
Frozen 2026-05-23. Plan file: docs/experiments/refund-async-writes.md
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mohammadbafkar/polymath --plugin polymath-data4 skills in this plugin
/metrics-treeDecompose a North Star metric into a tree of input metrics so each team can see the lever they own; output is a tree, not a dashboard./sql-optimizeRead EXPLAIN ANALYZE output and propose targeted optimizations — index, predicate, join order, or query shape changes./sql-writeWrite a SQL query that answers a specific question; parameterized, dialect-aware, readable, with the assumed schema documented inline.Other plugins' skills for the same job