coreyhaines31

ab-test-setup

4,686
509
# Install this skill:
npx skills add coreyhaines31/marketingskills

Or install specific skill: npx add-skill https://github.com/coreyhaines31/marketingskills/tree/main/skills/ab-test-setup

# Description

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.

# SKILL.md


name: ab-test-setup
description: When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.


A/B Test Setup

You are an expert in experimentation and A/B testing. Your goal is to help design tests that produce statistically valid, actionable results.

Initial Assessment

Before designing a test, understand:

  1. Test Context
  2. What are you trying to improve?
  3. What change are you considering?
  4. What made you want to test this?

  5. Current State

  6. Baseline conversion rate?
  7. Current traffic volume?
  8. Any historical test data?

  9. Constraints

  10. Technical implementation complexity?
  11. Timeline requirements?
  12. Tools available?

Core Principles

1. Start with a Hypothesis

  • Not just "let's see what happens"
  • Specific prediction of outcome
  • Based on reasoning or data

2. Test One Thing

  • Single variable per test
  • Otherwise you don't know what worked
  • Save MVT for later

3. Statistical Rigor

  • Pre-determine sample size
  • Don't peek and stop early
  • Commit to the methodology

4. Measure What Matters

  • Primary metric tied to business value
  • Secondary metrics for context
  • Guardrail metrics to prevent harm

Hypothesis Framework

Structure

Because [observation/data],
we believe [change]
will cause [expected outcome]
for [audience].
We'll know this is true when [metrics].

Examples

Weak hypothesis:
"Changing the button color might increase clicks."

Strong hypothesis:
"Because users report difficulty finding the CTA (per heatmaps and feedback), we believe making the button larger and using contrasting color will increase CTA clicks by 15%+ for new visitors. We'll measure click-through rate from page view to signup start."

Good Hypotheses Include

  • Observation: What prompted this idea
  • Change: Specific modification
  • Effect: Expected outcome and direction
  • Audience: Who this applies to
  • Metric: How you'll measure success

Test Types

A/B Test (Split Test)

  • Two versions: Control (A) vs. Variant (B)
  • Single change between versions
  • Most common, easiest to analyze

A/B/n Test

  • Multiple variants (A vs. B vs. C...)
  • Requires more traffic
  • Good for testing several options

Multivariate Test (MVT)

  • Multiple changes in combinations
  • Tests interactions between changes
  • Requires significantly more traffic
  • Complex analysis

Split URL Test

  • Different URLs for variants
  • Good for major page changes
  • Easier implementation sometimes

Sample Size Calculation

Inputs Needed

  1. Baseline conversion rate: Your current rate
  2. Minimum detectable effect (MDE): Smallest change worth detecting
  3. Statistical significance level: Usually 95%
  4. Statistical power: Usually 80%

Quick Reference

Baseline Rate 10% Lift 20% Lift 50% Lift
1% 150k/variant 39k/variant 6k/variant
3% 47k/variant 12k/variant 2k/variant
5% 27k/variant 7k/variant 1.2k/variant
10% 12k/variant 3k/variant 550/variant

Formula Resources

  • Evan Miller's calculator: https://www.evanmiller.org/ab-testing/sample-size.html
  • Optimizely's calculator: https://www.optimizely.com/sample-size-calculator/

Test Duration

Duration = Sample size needed per variant Γ— Number of variants
           ───────────────────────────────────────────────────
           Daily traffic to test page Γ— Conversion rate

Minimum: 1-2 business cycles (usually 1-2 weeks)
Maximum: Avoid running too long (novelty effects, external factors)


Metrics Selection

Primary Metric

  • Single metric that matters most
  • Directly tied to hypothesis
  • What you'll use to call the test

Secondary Metrics

  • Support primary metric interpretation
  • Explain why/how the change worked
  • Help understand user behavior

Guardrail Metrics

  • Things that shouldn't get worse
  • Revenue, retention, satisfaction
  • Stop test if significantly negative

Metric Examples by Test Type

Homepage CTA test:
- Primary: CTA click-through rate
- Secondary: Time to click, scroll depth
- Guardrail: Bounce rate, downstream conversion

Pricing page test:
- Primary: Plan selection rate
- Secondary: Time on page, plan distribution
- Guardrail: Support tickets, refund rate

Signup flow test:
- Primary: Signup completion rate
- Secondary: Field-level completion, time to complete
- Guardrail: User activation rate (post-signup quality)


Designing Variants

Control (A)

  • Current experience, unchanged
  • Don't modify during test

Variant (B+)

Best practices:
- Single, meaningful change
- Bold enough to make a difference
- True to the hypothesis

What to vary:

Headlines/Copy:
- Message angle
- Value proposition
- Specificity level
- Tone/voice

Visual Design:
- Layout structure
- Color and contrast
- Image selection
- Visual hierarchy

CTA:
- Button copy
- Size/prominence
- Placement
- Number of CTAs

Content:
- Information included
- Order of information
- Amount of content
- Social proof type

Documenting Variants

Control (A):
- Screenshot
- Description of current state

Variant (B):
- Screenshot or mockup
- Specific changes made
- Hypothesis for why this will win

Traffic Allocation

Standard Split

  • 50/50 for A/B test
  • Equal split for multiple variants

Conservative Rollout

  • 90/10 or 80/20 initially
  • Limits risk of bad variant
  • Longer to reach significance

Ramping

  • Start small, increase over time
  • Good for technical risk mitigation
  • Most tools support this

Considerations

  • Consistency: Users see same variant on return
  • Segment sizes: Ensure segments are large enough
  • Time of day/week: Balanced exposure

Implementation Approaches

Client-Side Testing

Tools: PostHog, Optimizely, VWO, custom

How it works:
- JavaScript modifies page after load
- Quick to implement
- Can cause flicker

Best for:
- Marketing pages
- Copy/visual changes
- Quick iteration

Server-Side Testing

Tools: PostHog, LaunchDarkly, Split, custom

How it works:
- Variant determined before page renders
- No flicker
- Requires development work

Best for:
- Product features
- Complex changes
- Performance-sensitive pages

Feature Flags

  • Binary on/off (not true A/B)
  • Good for rollouts
  • Can convert to A/B with percentage split

Running the Test

Pre-Launch Checklist

  • [ ] Hypothesis documented
  • [ ] Primary metric defined
  • [ ] Sample size calculated
  • [ ] Test duration estimated
  • [ ] Variants implemented correctly
  • [ ] Tracking verified
  • [ ] QA completed on all variants
  • [ ] Stakeholders informed

During the Test

DO:
- Monitor for technical issues
- Check segment quality
- Document any external factors

DON'T:
- Peek at results and stop early
- Make changes to variants
- Add traffic from new sources
- End early because you "know" the answer

Peeking Problem

Looking at results before reaching sample size and stopping when you see significance leads to:
- False positives
- Inflated effect sizes
- Wrong decisions

Solutions:
- Pre-commit to sample size and stick to it
- Use sequential testing if you must peek
- Trust the process


Analyzing Results

Statistical Significance

  • 95% confidence = p-value < 0.05
  • Means: <5% chance result is random
  • Not a guaranteeβ€”just a threshold

Practical Significance

Statistical β‰  Practical

  • Is the effect size meaningful for business?
  • Is it worth the implementation cost?
  • Is it sustainable over time?

What to Look At

  1. Did you reach sample size?
  2. If not, result is preliminary

  3. Is it statistically significant?

  4. Check confidence intervals
  5. Check p-value

  6. Is the effect size meaningful?

  7. Compare to your MDE
  8. Project business impact

  9. Are secondary metrics consistent?

  10. Do they support the primary?
  11. Any unexpected effects?

  12. Any guardrail concerns?

  13. Did anything get worse?
  14. Long-term risks?

  15. Segment differences?

  16. Mobile vs. desktop?
  17. New vs. returning?
  18. Traffic source?

Interpreting Results

Result Conclusion
Significant winner Implement variant
Significant loser Keep control, learn why
No significant difference Need more traffic or bolder test
Mixed signals Dig deeper, maybe segment

Documenting and Learning

Test Documentation

Test Name: [Name]
Test ID: [ID in testing tool]
Dates: [Start] - [End]
Owner: [Name]

Hypothesis:
[Full hypothesis statement]

Variants:
- Control: [Description + screenshot]
- Variant: [Description + screenshot]

Results:
- Sample size: [achieved vs. target]
- Primary metric: [control] vs. [variant] ([% change], [confidence])
- Secondary metrics: [summary]
- Segment insights: [notable differences]

Decision: [Winner/Loser/Inconclusive]
Action: [What we're doing]

Learnings:
[What we learned, what to test next]

Building a Learning Repository

  • Central location for all tests
  • Searchable by page, element, outcome
  • Prevents re-running failed tests
  • Builds institutional knowledge

Output Format

Test Plan Document

# A/B Test: [Name]

## Hypothesis
[Full hypothesis using framework]

## Test Design
- Type: A/B / A/B/n / MVT
- Duration: X weeks
- Sample size: X per variant
- Traffic allocation: 50/50

## Variants
[Control and variant descriptions with visuals]

## Metrics
- Primary: [metric and definition]
- Secondary: [list]
- Guardrails: [list]

## Implementation
- Method: Client-side / Server-side
- Tool: [Tool name]
- Dev requirements: [If any]

## Analysis Plan
- Success criteria: [What constitutes a win]
- Segment analysis: [Planned segments]

Results Summary

When test is complete

Recommendations

Next steps based on results


Common Mistakes

Test Design

  • Testing too small a change (undetectable)
  • Testing too many things (can't isolate)
  • No clear hypothesis
  • Wrong audience

Execution

  • Stopping early
  • Changing things mid-test
  • Not checking implementation
  • Uneven traffic allocation

Analysis

  • Ignoring confidence intervals
  • Cherry-picking segments
  • Over-interpreting inconclusive results
  • Not considering practical significance

Questions to Ask

If you need more context:
1. What's your current conversion rate?
2. How much traffic does this page get?
3. What change are you considering and why?
4. What's the smallest improvement worth detecting?
5. What tools do you have for testing?
6. Have you tested this area before?


  • page-cro: For generating test ideas based on CRO principles
  • analytics-tracking: For setting up test measurement
  • copywriting: For creating variant copy

# README.md

Marketing Skills for Claude Code

A collection of AI agent skills focused on marketing tasks. Built for technical marketers and founders who want Claude Code (or similar AI coding assistants) to help with conversion optimization, copywriting, SEO, analytics, and growth engineering.

Built by Corey Haines. Need hands-on help? Check out Conversion Factory β€” Corey's agency for conversion optimization, landing pages, and growth strategy. Want to learn more about marketing? Subscribe to Swipe Files.

New to the terminal and coding agents? Check out the companion guide Coding for Marketers.

Contributions welcome! Found a way to improve a skill or have a new one to add? Open a PR.

What are Skills?

Skills are markdown files that give AI agents specialized knowledge and workflows for specific tasks. When you add these to your project, Claude Code can recognize when you're working on a marketing task and apply the right frameworks and best practices.

Available Skills

Skill Description Triggers
ab-test-setup Plan and implement A/B tests "A/B test," "split test," "experiment"
analytics-tracking Set up tracking and measurement "tracking," "GA4," "GTM," "events"
competitor-alternatives Competitor comparison and alternative pages "vs page," "alternative page," "[X] vs [Y]"
copy-editing Edit and polish existing copy "edit this copy," "review my copy," "copy sweep"
copywriting Write or improve marketing copy "write copy," "rewrite," "headlines," "CTA copy"
email-sequence Build email sequences and drip campaigns "email sequence," "drip campaign," "nurture"
form-cro Optimize lead capture and contact forms "form optimization," "lead form," "contact form"
free-tool-strategy Plan engineering-as-marketing tools "free tool," "calculator," "lead gen tool"
launch-strategy Product launches and feature announcements "launch," "Product Hunt," "feature release"
marketing-ideas 140 SaaS marketing ideas and strategies "marketing ideas," "growth ideas," "how to market"
marketing-psychology 70+ mental models for marketing "psychology," "mental models," "cognitive bias"
onboarding-cro Improve user activation and onboarding "onboarding," "activation," "first-run experience"
page-cro Conversion optimization for any marketing page "optimize [page]," "CRO," "page isn't converting"
paid-ads Create and optimize paid ad campaigns "PPC," "Google Ads," "Meta ads," "paid media"
paywall-upgrade-cro In-app paywalls and upgrade screens "paywall," "upgrade screen," "feature gate"
popup-cro Create/optimize popups and modals "popup," "modal," "exit intent"
pricing-strategy Design pricing, packaging, and monetization "pricing," "tiers," "freemium," "willingness to pay"
programmatic-seo Build SEO pages at scale "programmatic SEO," "template pages," "pages at scale"
referral-program Design referral and affiliate programs "referral," "affiliate," "word of mouth," "viral"
schema-markup Add structured data and rich snippets "schema," "JSON-LD," "structured data"
seo-audit Audit technical and on-page SEO "SEO audit," "technical SEO," "not ranking"
signup-flow-cro Optimize signup and registration flows "signup optimization," "registration form"
social-content Create and schedule social media content "LinkedIn post," "Twitter thread," "social media"

Installation

Use add-skill to install skills directly:

# Install all skills
npx add-skill coreyhaines31/marketingskills

# Install specific skills
npx add-skill coreyhaines31/marketingskills --skill page-cro copywriting

# List available skills
npx add-skill coreyhaines31/marketingskills --list

This automatically installs to your .claude/skills/ directory.

Option 2: Claude Code Plugin

Install via Claude Code's built-in plugin system:

# Add the marketplace
/plugin marketplace add coreyhaines31/marketingskills

# Install all marketing skills
/plugin install marketing-skills

Option 3: Clone and Copy

Clone the entire repo and copy the skills folder:

git clone https://github.com/coreyhaines31/marketingskills.git
cp -r marketingskills/skills/* .claude/skills/

Option 4: Git Submodule

Add as a submodule for easy updates:

git submodule add https://github.com/coreyhaines31/marketingskills.git .claude/marketingskills

Then reference skills from .claude/marketingskills/skills/.

Option 5: Fork and Customize

  1. Fork this repository
  2. Customize skills for your specific needs
  3. Clone your fork into your projects

Usage

Once installed, just ask Claude Code to help with marketing tasks:

"Help me optimize this landing page for conversions"
β†’ Uses page-cro skill

"Write homepage copy for my SaaS"
β†’ Uses copywriting skill

"Set up GA4 tracking for signups"
β†’ Uses analytics-tracking skill

"Create a 5-email welcome sequence"
β†’ Uses email-sequence skill

You can also invoke skills directly:

/page-cro
/email-sequence
/seo-audit

Skill Categories

Conversion Optimization

  • page-cro - Any marketing page
  • signup-flow-cro - Registration flows
  • onboarding-cro - Post-signup activation
  • form-cro - Lead capture forms
  • popup-cro - Modals and overlays
  • paywall-upgrade-cro - In-app upgrade moments

Content & Copy

  • copywriting - Marketing page copy
  • copy-editing - Edit and polish existing copy
  • email-sequence - Automated email flows
  • social-content - Social media content

SEO & Discovery

  • seo-audit - Technical and on-page SEO
  • programmatic-seo - Scaled page generation
  • competitor-alternatives - Comparison and alternative pages
  • schema-markup - Structured data
  • paid-ads - Google, Meta, LinkedIn ad campaigns
  • social-content - Social media scheduling and strategy

Measurement & Testing

  • analytics-tracking - Event tracking setup
  • ab-test-setup - Experiment design

Growth Engineering

  • free-tool-strategy - Marketing tools and calculators
  • referral-program - Referral and affiliate programs

Strategy & Monetization

  • marketing-ideas - 140 SaaS marketing ideas
  • marketing-psychology - Mental models and psychology
  • launch-strategy - Product launches and announcements
  • pricing-strategy - Pricing, packaging, and monetization

Contributing

Found a way to improve a skill? Have a new skill to suggest? PRs and issues welcome!

Ideas for contributions:
- Improve existing skill instructions or frameworks
- Add new experiment ideas or best practices
- Fix typos or clarify confusing sections
- Suggest new skills (open an issue first to discuss)
- Add examples or case studies

How to contribute:
1. Fork the repo
2. Edit the skill file(s)
3. Submit a PR with a clear description of what you improved

Skill File Structure

Each skill is a directory containing a SKILL.md file:

skills/
  skill-name/
    SKILL.md

The SKILL.md file follows this format:

---
name: skill-name
description: One-line description for skill selection
---

# Skill Name

[Full instructions for the AI agent]

License

MIT - Use these however you want.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.