/product-skills:ab-test-setupfrom product-skills
Designs statistically valid A/B tests: formulates hypotheses, calculates sample size and duration, and analyzes CSV results with data-quality checks like sample ratio mismatch and small counts.
Ships in product-skills. 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.
Category: Product Team Tags: A/B testing, experiments, statistical significance, sample size, feature flags, hypothesis testing
A/B Test Setup provides the complete framework for designing experiments that produce statistically valid, actionable results. Most A/B tests fail not because the variant was wrong, but because the test was poorly designed: wrong sample size, wrong metric, or someone peeked at results and stopped early. This skill prevents those mistakes.
Before designing the experiment, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
1. HYPOTHESIZE → 2. DESIGN → 3. CALCULATE → 4. IMPLEMENT
↑ │
│ ▼
7. ITERATE ← 6. DOCUMENT ← 5. ANALYZE ← [Run to completion]
Because [observation or data point],
we believe [specific change]
will cause [measurable outcome]
for [defined audience segment].
We'll know this is true when [primary metric] changes by [minimum detectable effect].
We'll watch [guardrail metrics] to ensure no negative impact.
| Quality | Hypothesis | Problem |
|---|---|---|
| Bad | "Changing the button color might increase clicks" | No data basis, no target, no measurement plan |
| Mediocre | "A green button will get more clicks than blue" | No "why", no target size, no guardrails |
| Good | "Because heatmaps show 40% of users don't notice our CTA, making the button 2x larger with contrasting color will increase CTA clicks by 15%+ for new visitors. Guardrail: page load time stays under 2s." | Data-backed, specific change, measurable outcome, defined audience, guardrail |
| Source | What to Look For | Example |
|---|---|---|
| Analytics data | Drop-off points, low-performing pages | "80% of users drop off at step 3 of onboarding" |
| User research | Confusion, frustration, unmet needs | "Users don't understand what the product does from the homepage" |
| Heatmaps/session recordings | Ignored elements, rage clicks | "Nobody scrolls past the fold on pricing page" |
| Support tickets | Recurring complaints, feature confusion | "Users constantly ask how to invite team members" |
| Competitor analysis | Different approaches to same problem | "Competitor uses a wizard; we use a form" |
| Sales objections | Common reasons prospects don't convert | "Prospects want to see pricing before signing up" |
| Type | Variants | Traffic Need | Best For |
|---|---|---|---|
| A/B | 2 (control + 1 variant) | Moderate | Single change validation |
| A/B/n | 3+ variants | High | Comparing multiple approaches |
| Multivariate (MVT) | Combinations of changes | Very high | Optimizing multiple elements |
| Split URL | Different pages | Moderate | Major redesigns |
| Bandit | Dynamic allocation | Low-moderate | Revenue optimization |
Default recommendation: Standard A/B test. Only use A/B/n or MVT when you have enough traffic and a specific need.
| Category | High Impact | Medium Impact | Low Impact |
|---|---|---|---|
| Copy | Headline/value prop, CTA text | Body copy, social proof | Microcopy, labels |
| Design | Page layout, above-fold content | Visual hierarchy, imagery | Color, font size |
| UX | Number of steps, form fields | Button placement, navigation | Animations, transitions |
| Pricing | Price point, plan names | Feature packaging, anchoring | Billing frequency display |
| Social Proof | Testimonials vs none, logos | Testimonial format, placement | Testimonial count |
Every test needs three types of metrics:
Primary Metric (1 only)
Secondary Metrics (2-3)
Guardrail Metrics (1-3)
Minimum visitors PER VARIANT needed (95% confidence, 80% power):
| Baseline Rate | 5% Lift | 10% Lift | 15% Lift | 20% Lift | 50% Lift |
|---|---|---|---|---|---|
| 1% | 637,010 | 163,095 | 74,193 | 42,693 | 7,750 |
| 2% | 315,206 | 80,682 | 36,693 | 21,109 | 3,826 |
| 3% | 207,938 | 53,211 | 24,193 | 13,914 | 2,518 |
| 5% | 122,124 | 31,234 | 14,193 | 8,158 | 1,471 |
| 10% | 57,763 | 14,751 | 6,693 | 3,841 | 686 |
| 20% | 25,583 | 6,510 | 2,943 | 1,683 | 294 |
| 50% | 6,275 | 1,565 | 693 | 388 | 58 |
Computed by scripts/sample_size_calculator.py (two-sided, relative lift); rerun it for your own numbers.
Duration (days) = (Sample size per variant * Number of variants) / Daily traffic to test page
Minimum duration: 14 days (heuristic: two full weekly cycles) Maximum recommended: 6 weeks (heuristic: beyond this, external factors contaminate results)
| Situation | Solution |
|---|---|
| Need 100K visitors, get 5K/week | Increase minimum detectable effect (test bolder changes) |
| Very low traffic (<1K/week) | Use qualitative testing (user testing, surveys) instead |
| Medium traffic (5-20K/week) | Run for 4-6 weeks, test big changes only |
| High traffic (50K+/week) | You can test subtle changes, run multiple tests |
JavaScript modifies the page after initial render.
Pros: Quick to implement, no deploy needed Cons: Can cause flicker (flash of original content), blocked by ad blockers Tools: PostHog, Optimizely, VWO, Google Optimize
Anti-flicker pattern:
// Add to <head> before any rendering
<style>.ab-test-hide { opacity: 0 !important; }</style>
<script>document.documentElement.classList.add('ab-test-hide');</script>
// In your test script (runs after variant assignment):
document.documentElement.classList.remove('ab-test-hide');
Variant determined before page renders. No flicker, no client-side dependency.
Pros: No flicker, not blocked by ad blockers, works for logged-in features Cons: Requires engineering work, deploy needed Tools: PostHog, LaunchDarkly, Split, Unleash, custom feature flags
Basic feature flag pattern:
# Server-side variant assignment
def get_variant(user_id: str, experiment: str) -> str:
# Deterministic hash ensures same user always sees same variant
hash_input = f"{user_id}:{experiment}"
hash_value = hashlib.md5(hash_input.encode()).hexdigest()
bucket = int(hash_value[:8], 16) % 100
if bucket < 50:
return "control"
else:
return "variant"
| Strategy | Split | When to Use |
|---|---|---|
| Standard | 50/50 | Default. Maximum statistical power. |
| Conservative | 90/10 or 80/20 | Risky changes, revenue-impacting tests |
| Ramped | Start 95/5, increase to 50/50 | New infrastructure, technical risk |
Critical rules:
DO:
DO NOT:
Looking at results before reaching the planned sample size and stopping because one variant looks better leads to a 25-40% false positive rate (vs the intended 5%).
Why: Statistical significance fluctuates wildly with small samples. A variant can show p < 0.05 at 20% of planned sample size and p > 0.30 at full sample.
Solutions:
| Result | Primary Metric | Confidence | Action |
|---|---|---|---|
| Clear winner | Variant +15%, p < 0.01 | High | Implement variant |
| Modest winner | Variant +5%, p < 0.05 | Medium | Implement if easy, else run longer |
| Flat | < 2% difference, p > 0.20 | High (no effect) | Keep control, test something bolder |
| Loser | Variant -10%, p < 0.05 | High | Keep control, investigate why |
| Inconclusive | 5% difference, p = 0.08 | Low | Need more traffic or bolder test |
| Mixed signals | Primary up, guardrail down | Investigate | Dig into segments, do not ship blindly |
| Mistake | Consequence | Prevention |
|---|---|---|
| Stopping at first significance | 25-40% false positive rate | Commit to sample size |
| Cherry-picking segments | Finding "winners" that don't replicate | Pre-register segments of interest |
| Ignoring confidence intervals | Overestimating effect size | Always report CI alongside p-value |
| Multiple comparisons | Inflated Type I error | Bonferroni correction for A/B/n |
| Survivorship bias | Only analyzing users who completed flow | Include all users from assignment point |
| Simpson's paradox | Aggregate hides segment reversal | Always check key segments |
Every test must be documented, regardless of outcome.
EXPERIMENT: [Name]
DATE: [Start] to [End]
OWNER: [Name]
HYPOTHESIS:
Because [observation], we believed [change] would cause [outcome] for [audience].
VARIANTS:
- Control: [description]
- Variant: [description + screenshot]
METRICS:
- Primary: [metric] (baseline: [X]%, MDE: [Y]%)
- Secondary: [metrics]
- Guardrails: [metrics]
RESULTS:
- Sample size: [actual] / [planned]
- Duration: [X] days
- Primary metric: Control [X]% vs Variant [Y]% (p = [Z], CI: [range])
- Secondary metrics: [results]
- Guardrails: [all clear / violation noted]
DECISION: [Ship variant / Keep control / Iterate]
LEARNINGS:
- [What we learned about our users]
- [What we'd do differently next time]
| Factor | Score (1-10) | Question |
|---|---|---|
| Impact | How much will this move the metric? | Big change to primary KPI = 10 |
| Confidence | How sure are we it will work? | Strong data supporting hypothesis = 10 |
| Ease | How easy is it to implement and measure? | Can ship in a day = 10 |
ICE Score = (Impact + Confidence + Ease) / 3
Rank all test ideas by ICE score. Run highest first.
| # | Hypothesis | Primary Metric | ICE | Est. Duration | Status |
|---|---|---|---|---|---|
| 1 | Larger CTA increases signups | Signup rate | 8.3 | 2 weeks | Ready |
| 2 | Social proof on pricing increases conversion | Plan selection rate | 7.0 | 3 weeks | Needs design |
| 3 | Shorter onboarding increases activation | Feature activation | 6.7 | 4 weeks | In backlog |
| Skill | Use When |
|---|---|
| analytics-tracking | Setting up event tracking that feeds experiment metrics |
| campaign-analytics | Folding experiment results into broader attribution |
| launch-strategy | Testing within a product launch sequence |
| prompt-engineer-toolkit | A/B testing AI prompts in production |
Run from the skill folder. Samples are in assets/; replace them with your own data.
Every tool: --format text|json (--json is an alias), --help, no network, standard library only.
| Code | Meaning |
|---|---|
| 0 | Clean: plan feasible / results analysed with no data-quality findings |
| 1 | Findings to act on (each quotes the input and gives a fix) |
| 2 | Unusable input (missing file, bad CSV, rate outside 0-1): one-line ERROR: on stderr |
Visitors per variant (two-proportion z-test, Bonferroni-adjusted alpha for more than 2 variants) and run time.
Flags: --baseline/-b, --mde/-m (relative lift), both required; --alpha, --power, --variants, --daily-traffic, --one-tailed, --table.
Findings: run longer than 42 days (heuristic; the fix names an MDE that fits), power below 0.80.
python3 scripts/sample_size_calculator.py --baseline 0.03 --mde 0.05 --daily-traffic 300
Sample size: baseline 3.00% -> 3.15% (5% relative lift, 0.0015 absolute)
PER VARIANT: 207,938 visitors TOTAL: 415,876
Duration at 300/day: 1387 days needed, run at least 1387 (min 14 / max 42 are heuristics)
FINDING [duration] --daily-traffic 300 --baseline 0.03 --mde 0.05: needs 1387 days; limit is 42 days (heuristic: contamination and seasonality risk)
Fix: Rerun with --mde 0.31 (6,070/variant, about 41 days), or test a bolder change.
FIX 1 issue(s)
Reads a CSV variant,visitors,conversions[,segment]. Per segment: z-test, CI at your alpha, verdict
(WINNER / LOSER / FLAT / INCONCLUSIVE). Alpha is split across variants (Bonferroni). Findings:
sample ratio mismatch (2-arm), fewer than 10 successes or failures. Segments are labelled exploratory.
The control is the variant named control*, else the first row (stated in a NOTE); override with --control.
python3 scripts/experiment_analyzer.py assets/sample_results.csv
python3 scripts/experiment_analyzer.py assets/flawed_results.csv --format json # exit 1
SEGMENT all
control vs variant_a: WINNER
control 5.00% (250/5,000) variant 6.20% (310/5,000)
lift +24.00% p=0.0091 (needs < 0.0500) 95.0% CI of difference [+0.0030, +0.0210]
Checks the hypothesis (rationale, direction, metric, audience, agreement between a quoted percentage and --mde,
bundled changes) and emits sample size, timeline, guardrails and a paste-ready experiment doc.
--hypothesis, --baseline, --mde are required (no invented defaults); optional --daily-traffic, --variants, --start-date.
python3 scripts/experiment_planner.py --hypothesis "Because 40% of mobile users drop at the form, a 3-field form will raise mobile signup rate by 15%" --baseline 0.08 --mde 0.15 --daily-traffic 3000
python3 scripts/experiment_planner.py --hypothesis "make the button nicer" --baseline 0.05 --mde 0.1 # exit 1
ICE scoring stays a manual step (see Experiment Prioritization Framework); the planner no longer guesses scores from keywords.
| Problem | Cause | Solution |
|---|---|---|
| Sample size is unrealistically large | MDE too small or baseline too low | Increase MDE (test bolder changes) or target a higher-traffic page |
| Test duration exceeds 6 weeks | Insufficient daily traffic | Consider qualitative methods, test bigger changes, or combine traffic from multiple pages |
| p-value hovers around 0.05 | Borderline significance | Do not stop early; run to planned sample size or extend 20% |
| Results significant but lift is tiny (<1%) | Overpowered test | Check practical significance alongside statistical significance |
| Segment results contradict overall | Simpson's paradox | Investigate segment composition; report both overall and segment results |
| Variant performs differently on mobile vs desktop | Device-specific UX issues | Design device-specific variants; increase per-segment sample size |
| Calculator produces negative CI | Very small samples or extreme rates | Ensure sufficient sample size; check data integrity |
| Criterion | Target | How to Measure |
|---|---|---|
| Tests reach planned sample size | 100% of tests | Compare actual vs planned sample at conclusion |
| False positive rate | <5% | Track post-implementation lift vs test prediction |
| Test velocity | 2+ tests per team per month | Count experiments documented per sprint |
| Documentation completeness | 100% of tests documented | Audit experiment records quarterly |
| Average test duration | <4 weeks | Measure start-to-conclusion calendar days |
| Decision quality | >80% of shipped variants hold gains at 90 days | Post-ship metric tracking |
In scope:
Out of scope:
| Tool / Platform | Integration Method | Use Case |
|---|---|---|
| PostHog / Amplitude | JSON export from experiment_analyzer | Feed results into product analytics |
| Jira / Linear | experiment_planner JSON output | Create experiment tickets with metadata |
| Google Sheets | CSV export from experiment_analyzer | Share results with non-technical stakeholders |
| LaunchDarkly / Unleash | experiment_planner checklist | Pre-launch validation before feature flag rollout |
| Slack / Notion | Copy human-readable output | Async experiment status updates |
| CI/CD pipelines | --json flag on all scripts | Automated experiment health checks |
assets/contract.json (opens in a new tab)assets/flawed_results.csv (opens in a new tab)assets/malformed_results.csv (opens in a new tab)assets/sample_results.csv (opens in a new tab)evals/README.md (opens in a new tab)evals/grader.py (opens in a new tab)evals/runner.py (opens in a new tab)evals/test_cases.json (opens in a new tab)scripts/experiment_analyzer.py (opens in a new tab)scripts/experiment_planner.py (opens in a new tab)scripts/sample_size_calculator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
15 skills in this plugin
/agile-product-ownerAgile product ownership for backlog management and sprint execution. Use when you have an epic to turn into INVEST-checked user stories with acceptance criteria, oversized stories to split, a sprint to load to capacity, or a backlog to prioritize.
/apple-hig-expertApple Human Interface Guidelines expert across iOS, iPadOS, macOS, watchOS, tvOS, and visionOS. Use when designing or reviewing an Apple-platform app, auditing for HIG compliance, picking native components, or validating accessibility. Use when you have a screen inventory (JSON of true/false flags per screen) to audit, or a UX goal to map to a native pattern.
/design-directionTurns a product brief into a design-system spec: style direction, contrast-checked palette, type pairing, tokens, UX rules and chart choices. Use when starting a new product's UI, picking a palette or fonts, or auditing a token file.
/design-system-leadDesign systems leadership across component libraries, design tokens, and design-dev collaboration. Use when you need to generate design tokens from a brand color (with a WCAG contrast check), scaffold a component spec, or audit design system adoption from a per-product CSV.
/product-analyticsProduct analytics checks for metric trees, event taxonomies and retention cohorts. Use when reviewing a North Star and its input metrics, auditing an event inventory for naming, PII and gaps, or reading cohort retention tables for curve shape and trend. Reads your JSON, exits 0/1/2.
/product-designerTurns user research into design decisions: journey maps with gap checks, SUS and task scoring, design critique and flow critique. Use when mapping a journey, scoring a usability test, or critiquing a flow before it ships.
npx claudepluginhub borghei/claude-skills --plugin product-skillsOther plugins' skills for the same job