Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
A/B testing and experimentation workflow: hypothesis design, metric selection, sample size calculation, statistical significance, common pitfalls (peeking, SRM, novelty effect), and experiment lifecycle. Complements feature-flags (implementation) with statistical rigor.
Experiment Design
Scope: The what and why of experiments — statistical methodology, hypothesis design, and result analysis.
For how to implement the flag that powers the experiment, see feature-flags.
When to Activate
Designing an A/B test for a product change
Choosing the right success metric for an experiment
Calculating required sample size before launching
Analyzing experiment results and deciding ship/kill
Spotting and fixing a flawed experiment (SRM, peeking, novelty)
Setting up an experimentation platform
The Experiment Lifecycle
1. Hypothesis → What change, what metric, what direction?
2. Metric choice → Primary metric + guardrail metrics
3. Sample size → How many users, how long?
4. Launch → Random assignment via feature flag
5. Monitor → SRM check, guardrail watch (don't peek at results)
6. Analyze → Statistical significance, practical significance
7. Decision → Ship, iterate, or kill
8. Document → Record results for future reference
Step 1: Hypothesis
A good hypothesis has three parts:
IF we [change],
THEN [metric] will [increase/decrease],
BECAUSE [mechanism].
Good:
If we reduce checkout steps from 5 to 3, then checkout completion rate will increase, because fewer steps means less friction for users who abandon mid-flow.
Bad:
If we redesign checkout, then users will like it more.
(No specific metric, no mechanism, "like" is unmeasurable)
Step 2: Metric Selection
Primary metric (one only)
The single number that determines ship/kill. Choose the metric closest to the behavior you're changing:
Change type
Good primary metric
Checkout flow
Checkout completion rate
Email subject line
Open rate
Onboarding
Day-7 retention
Search relevance
Click-through rate
Pricing page
Plan upgrade rate
Guardrail metrics (2-5)
Metrics that must not degrade significantly:
Revenue per user (always)
Error rate / p99 latency (always)
Support ticket rate
Churn rate
A significant guardrail regression = kill the experiment, even if primary metric wins.
from statsmodels.stats.proportion import proportion_confint
lo, hi = proportion_confint(
treatment_conversions, treatment_n, alpha=0.05, method='wilson'
)
print(f"95% CI for treatment rate: [{lo:.3%}, {hi:.3%}]")
Common Pitfalls
Pitfall
Description
Fix
Peeking
Stopping early when you see p < 0.05
Pre-commit to end date; use sequential testing if you need early stopping
SRM
Assignment split doesn't match expectation
Always run SRM check before analysis
Novelty effect
Users behave differently just because it's new
Run for at least 2 weeks; analyze long-term cohort
Multiple testing
Testing 5 metrics, one will be p < 0.05 by chance
Pre-register one primary metric; apply Bonferroni for secondary
Network effects
User A's treatment affects user B (social features)
Use cluster randomization (by household, team, etc.)
Carryover
User saw control, now in treatment and remembers
Washout period; exclude switchers
Simpson's paradox
Aggregate shows win, but loses in every segment
Segment by platform/country/plan before reporting
Decision Framework
Result
Action
Significant positive primary, no guardrail regressions