
Creating Experiments
FreeStreamline your A/B test creation process.
Free · Opens the source repo
What Creating Experiments does
The Creating Experiments skill simplifies the process of setting up A/B tests by guiding users through a structured three-step flow. This skill is designed for developers and data analysts who need to create experiments quickly and efficiently. It allows users to draft their experiments, define hypotheses, configure rollout strategies, and set up analytics without the need for extensive manual input or prior experience with the PostHog platform.
In the first step, users are prompted to define key elements of their experiment, including the experiment name, hypothesis, feature flag key, and type. This initial draft is created rapidly, enabling users to iterate on the details later. The skill intelligently infers information when sufficient context is provided, reducing the need for repetitive questions and streamlining the setup process.
The second step focuses on configuring the rollout of the experiment. Users can specify how many variants to test and the percentage of users that will be included in the experiment. This skill delegates rollout decisions to the configuring-experiment-rollout component, ensuring that users receive tailored guidance based on their specific needs. The defaults are set to a 50/50 split between control and test variants, making it easy for users to get started without diving into complex configurations.
Finally, the skill assists in setting up the analytics required to measure the impact of the experiment. It leverages the configuring-experiment-analytics skill to ensure that metrics are not duplicated and that the setup remains lightweight. After the experiment is created, users are provided with a direct link to view and further configure their experiment in the PostHog UI, along with reminders to implement the feature flag in their code. This comprehensive approach ensures that users can launch effective experiments with minimal friction.
When to use it
Use this skill when you need to create a new A/B test or experiment from scratch in PostHog.
When not to use it
Avoid this skill when updating existing experiments or managing their lifecycle, as it is specifically designed for new experiment creation.
What you can build with it
Setting Up a New Experiment
Quickly create a new A/B test by defining the hypothesis and configuring rollout options.
Iterating on Experiment Details
Draft an experiment and refine its configuration and metrics based on initial feedback.
Integrating with PostHog UI
Easily access the PostHog UI to further configure and analyze your newly created experiment.
How to install Creating Experiments
View source1. Install with the skills CLI
npx skills add posthog/posthog/creating-experiments --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by posthogCreating experiments
This skill walks through the 3-step flow for creating a new A/B test experiment.
Core principle: draft first, iterate on details
Create the experiment as a draft quickly, then iterate on metrics and configuration. The user gets a tangible draft immediately and can refine it.
The 3-step creation flow
Step 1: What are we testing?
Gather these before calling experiment-create:
- Experiment name — descriptive, inferred from context when possible
- Hypothesis — what you expect to happen (goes in
description) - Feature flag key — kebab-case. Ask if they want a new flag or to reuse an existing one. The flag is auto-created — do NOT create one separately.
- Type — leave empty (will internally default to
"product". The"web"value is reserved for no-code experiments configured visually with the PostHog toolbar in a browser; it cannot be meaningfully driven via MCP. If a user asks for a no-code/toolbar experiment, point them to the PostHog UI instead of creating one here.)
If the user gives enough context to infer these, don't ask — just proceed.
Step 2: Who sees what variant?
This is about rollout configuration.
Before asking any rollout question, load configuring-experiment-rollout. The disambiguation wording, recommendations, and post-answer branches live there — do not formulate rollout questions yourself, and do not assume an example you remember covers the user's path.
Key decision points (covered in detail by configuring-experiment-rollout):
- Variant split (how many variants, what percentage each)
- Overall rollout percentage (what % of all users enter the experiment)
- Whether to persist the flag across authentication steps
If the user doesn't mention rollout specifics, use defaults: 50/50 control/test, 100% rollout.
Step 3: How to measure impact?
This is about analytics and metrics. Load the configuring-experiment-analytics skill for guidance.
That skill's first step checks for an existing shared metric to reuse before building a new one —
don't duplicate a metric the project already has set up.
Do NOT configure metrics on creation. Metrics are not passed to experiment-create — they are added
afterwards via experiment-update. This keeps the creation call lightweight.
When the user specifies metrics upfront, acknowledge them and add them immediately after creation. When they don't, create the draft and then guide them through metric setup as a follow-up.
How to create
Call experiment-create with:
{
"name": "Descriptive experiment name",
"feature_flag_key": "kebab-case-key",
"description": "Hypothesis: [what you expect to happen]",
"feature_flag": {
"filters": {
"multivariate": {
"variants": [
{ "key": "control", "name": "Control", "rollout_percentage": 50 },
{ "key": "test", "name": "Test", "rollout_percentage": 50 }
]
},
"groups": [{ "properties": [], "rollout_percentage": 100 }]
},
"ensure_experience_continuity": false
}
}
Flag config goes in the feature_flag object, in the flag's own filters shape (not the deprecated parameters keys).
Two different percentages live in there, do NOT mix them up:
filters.multivariate.variants[].rollout_percentageis how users inside the experiment are split across variants (must sum to 100, recommended to have an even split).filters.groups[0].rollout_percentageis the overall gate: what fraction of all users enter the experiment at all (0-100, defaults to 100).
Key details:
- Minimum 2, maximum 20 variants. No specific variant key is required — the analysis baseline defaults to the variant keyed
"control"when present, else the first variant (override withstats_config.baseline_variant_key). Convention: key the baseline"control"unless the user asks for specific keys. filters.groups[0].rollout_percentagedefaults to 100 if omitted.ensure_experience_continuitypersists a user's variant across authentication steps; leave itfalseunless the flag is shown to both logged-out and logged-in users (seeconfiguring-experiment-rollout).- Stats default to Bayesian. Only set
stats_configif the user requests Frequentist.
After creation
-
Always show the experiment URL. The
experiment-createresponse includes_posthogUrl— always display this link so the user can view and configure the experiment in the UI. -
Remind the user to implement the feature flag in code. Link to the experiment page and say "implement the flag as shown here" — the experiment detail page shows implementation snippets for the user's SDK.
-
Guide through metrics if not yet configured — load the
configuring-experiment-analyticsskill. -
Launch when ready — use the
experiment-launchtool.
Frequently asked questions about Creating Experiments
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
