creating-experiments
What it does
This skill walks through creating a new A/B test, from reading your project to setting up the metric and running time. It is for product teams who want to test a change quickly.
When to use it
- ✓When you want to create a new A/B test for a page or feature.
- ✓When you want to set up the metrics and running time for a test.
- ✓When you want a draft experiment that you can refine later.
Skill link
https://github.com/PostHog/posthog/blob/master/products/experiments/skills/creating-experiments/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Create an A/B test for my pricing page to see whether a new headline gets more signups.”
5 new skills a week. 1 minute to read.
How it works
It reads your project first to pick a sensible target event and metric, creates a draft experiment, then refines the rollout and analysis. It notes which choices are guesses and asks you only about bucketing.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Creating experiments
This skill walks through creating a new A/B test experiment: read the project, then the 3-step flow, then report the draft.
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. Choose settings from the project's facts rather than asking, and say which choices are guesses. Bucketing is the exception: the facts cannot decide it, so ask before you create the experiment.
Step 0: Read the project
The right bucketing, metric and running time depend on the project: who sees the page, which SDKs evaluate the flag, how often the metric event happens. Read that before configuring anything.
From the request, infer the target (the event that marks someone reaching the change, usually
$pageviewfor a page) and a candidate metric event. Confirm both exist withread-data-schema. Don't ask the user for event names you can find. For a page, readevent_property_valuesfor$hostand$pathnameon the target event as well. The response samples the values rather than listing them all, so read it for the shape the project records (a trailing slash, awww.prefix, the casing) rather than as proof that a value is absent. An exact filter has to carry that shape:/pricingmatches nothing where every pageview says/pricing/, andexample.commatches nothing where the host iswww.example.com.If the
experiment-setup-contexttool is available, call it once withtarget_eventandmetric_event. For a web surface, addtarget_propertieswith an exact$host. Add an exact$pathnameas well when the surface is one page.target_url_containsis a substring match on$current_url. A bare domain matches any host that contains it,notexample.comincluded, and a homepage path matches every page under it. Both overstate the traffic and the exposure rate. For a surface that spans several pages, keep the exact$hostand put only the path fragment intarget_url_contains. Addmetric_propertiesin the same call when the candidate metric counts only some occurrences of its event. Passprevious_experiments_limit: 5. Five experiments are enough to read a precedent, and the default of 10 roughly doubles the response for no more signal. If the tool is not available, continue without it and treat every choice below as a best guess. Never call a tool you can't see.Each filter needs a
typeofeventorperson, akey, anoperatorand avalue. The call rejects theflag_evaluates_tooperator with a 400 that names it. For the homepage of one domain:{ "target_event": "$pageview", "target_properties": [ { "key": "$host", "type": "event", "operator": "exact", "value": ["www.example.com"] }, { "key": "$pathname", "type": "event", "operator": "exact", "value": ["/"] } ], "metric_event": "your_conversion_event", "previous_experiments_limit": 5 }Apply references/setup-decisions.md to the result. It maps each fact to a choice (bucketing, where the flag is evaluated, exposure, primary metric, running time, precedent) and to a tier for the summary.
Carry those choices into steps 1 to 3.
Ask the user only when a choice is "not decided" and the user is in the conversation. If the user said they are away, or asked for a draft without questions, decide with the defaults and list the open points in the report.
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. Infer a new key unless the user names an existing flag.
The flag is auto-created — do NOT create one separately. The one exception is device-id bucketing, which
experiment-createcannot set (see the recipe inconfiguring-experiment-rollout). - 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 c
FAQ
Will it start the test right away?
It creates the experiment as a draft first, so you can review and refine the details before it runs.
What does it ask me?
It asks only about how users are bucketed, since the facts about your project cannot decide that.
How does it choose the metric?
It looks at the events in your project to find a target and a candidate metric event, and confirms they exist before using them.
Details
Original description by the author
Guides agents through experiment creation: reading the project's setup with experiment-setup-context, defining the hypothesis, configuring rollout and bucketing, setting up analytics and running time, and reporting which choices are guesses. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics. TRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create. DO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments.
repo: PostHog/posthog
Popularity
- GitHub stars
- 41k
- Ranking position
- #6877
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
depot-ci
41kHelps your agent set up and run Depot CI workflows, a GitHub Actions alternative, including migrating existing workflows and reading run logs.
depot-container-builds
41kHelps your agent build Docker images on Depot's remote builders, including multi-platform images, pushing to registries, and fixing build failures.
depot-github-runners
41kHelps your agent move GitHub Actions jobs to Depot-managed runners, choosing runner sizes and labels, and troubleshooting runner setup issues.
editing-agents-md
41kHelps your agent decide whether a rule belongs in an AGENTS.md or CLAUDE.md file, and write it so it sticks without bloating the file.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.