/dif:dif-generate-surfacesfrom dif
Scaffolds dif.sh surfaces by analyzing app structure (routes, README, package.json) and product context. Use after `dif init` or when `dif new` fails with "surface does not exist".
Ships in dif. 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.
None: SKILL.md is the whole skill.
Use this skill to produce the initial set of dif/surfaces/<name>.md files for a dif project — either right after dif init (which only writes the one default surface), or when dif new --surface X fails with "surface does not exist" because nobody's created X yet.
A surface is a unit of experimentation agency, not a unit of code. It's the place in the app where you'll run experiments — broadly: the home page, the checkout flow, the search results page, the signup form. One surface per place where you'd reasonably A/B test something.
Surfaces are not one-per-route or one-per-component. A typical app has 3–8 surfaces total, not 30. Over-fragmenting splits institutional memory across too many Learnings logs and makes the dif new "recent learnings on this surface" embed less useful.
List dif/surfaces/*.md. If many already exist, scope your work to "what's missing" — read each existing surface's H1 + description paragraph to understand what's already represented, then propose only the gaps. If the directory only contains the default home.md from dif init, propose a fresh set.
Also read dif/context.json if it exists — active experiments tell you which surfaces are already in real use.
The point is to understand what the app does and where experimentation actually happens. Useful reads, in priority order:
README.md — what is this app, who uses it, what's the productpackage.json — framework signals (Next.js, Remix, Vite, etc.) tell you where the routes liveapp/ (Next.js app router), pages/ (Next.js pages or Vite), src/routes/ (Remix / SvelteKit), src/App.tsx (React Router config), and equivalents in other stacksdif/config.yaml — declared audience attributes hint at what dimensions the team already cares aboutdocs/, ARCHITECTURE.md, or similar that explains the app's surface setDon't fan out further than needed. The signal is usually obvious from README + routes in 1–2 minutes of reading.
Aim for 3–8 surfaces. Each one gets:
checkout, signup, search-results)Examples for a typical e-commerce app:
home — landing surface; first-touch optimization, hero copy / layout testssearch-results — list page after a user searches; ranking, filter UI, density testsproduct-detail — single-product page; image carousel, social proof, CTA copycart — cart review before checkout; abandonment-recovery, upsellscheckout — payment + confirm step; form length, trust signals, payment optionssignup — account creation flow; field count, social-auth prominenceNotice these are coarse-grained. There's no search-results-mobile or checkout-step-2 — those would be variants or audience predicates inside one surface, not separate surfaces.
Show the proposed list before writing. Format like this:
I'd propose these surfaces:
- home: landing surface; first-touch optimization
- checkout: payment step; form length, trust signals
- signup: account creation; field count, social-auth prominence
- search-results: post-search ranking and density
- product-detail: PDP CTA + social proof
Add, remove, or rename any before I write the files?
Accept renames, additions, removals. Push back gently on:
checkouts, checkout-flow-page) — suggest the singular kebab form.The file format mirrors what dif init emits for the default surface — keep the structure identical so the parser stays happy and dif new knows where to read the Learnings log from.
# Surface: <name>
(One-sentence description: where in the app is this surface? Who sees it?
What kind of experimentation happens here?)
## Known landmines
(Vendor DOM you can't touch, regulated regions, race conditions —
anything that's bitten a previous test on this surface. One bullet per.)
## Learnings
(One line per concluded test, appended automatically by `dif conclude`.)
Fill the description from product context — one to two concrete sentences. Leave ## Known landmines and ## Learnings as empty stub text. Both fields accrue from real experience, not speculation; pre-filling them with guesses pollutes future dif new drafts (which embed the last 3 Learnings into the experiment Brief).
After writing all of them, run dif validate to confirm the files parse cleanly. Then dif build to refresh dif/context.json so any agent picking up next sees the new surfaces.
dif/config.yaml's default_surfacedefault_surface is the surface dif new writes to when no --surface flag is passed. The user picks it deliberately during dif init. Don't auto-flip it. If the user's default_surface doesn't appear in your proposed set, flag it as a question ("you've got default_surface: foo in config but no foo in the new list — keep the default or rename it?") rather than silently changing the config.
checkout, not checkouts.cart, signup, home. Two words when you need to disambiguate: search-results, product-detail.signup, not signup-form-test or new-signup-flow.dif new drafts on this surface embed the last 3 lines into the experiment Brief, so seeding it with guesses corrupts future briefs.default_surface. That's a config change the user makes deliberately. Ask, don't act.The natural next step is drafting an experiment. The dif-author-experiment skill picks up from here — dif new <id> --surface <one-of-the-new-surfaces> will now succeed instead of exit-3'ing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
dif-sh, surface-generation, experimentation-setup, scaffolding
npx claudepluginhub dif-sh/dif --plugin dif7 skills in this plugin
/dif-author-experimentAuthoring and iterating on dif.sh experiments — drafting frontmatter, choosing variants and weights, declaring audiences, and validating the file. Use whenever the user wants to create, draft, edit, or fix a dif experiment, or mentions A/B test, variant, audience, hypothesis, surface, exclusion group, or the commands dif new, dif validate, or dif build./dif-conclude-experimentConclude a dif.sh experiment or rollout with real numbers. Gets the result from dif analytics over MCP or REST, checks the verdict, writes the Decision from decision_draft, runs dif conclude, and records the surface Learning. Use when the user wants to conclude, finish, ship, kill, wrap up or document the outcome of a dif experiment, write a decision, record a learning, or run the command dif conclude./dif-connect-cloudConnect a dif.sh workspace to dif analytics from the terminal. Signs the dif CLI in with a code the person approves in the browser, links or creates the dif analytics project, writes its publishable key into dif/config.yaml, shows the GitHub App install link and runs dif build. Use when the user wants to connect, link or set up dif analytics, log in or sign up to dif, send events to dif analytics, or mentions dif cloud, dif auth login, dif connect or needs_selection./dif-docsReference for dif.sh — feature flags and A/B experiments stored as Markdown files in the repo and compiled by `dif build` into a typed TypeScript client. Use when adding feature flags, a percentage rollout, or an A/B test to a JavaScript or TypeScript app (Next.js, React, SvelteKit, plain TS), when the user wants flags as code instead of a dashboard, or when the user mentions dif, dif/config.yaml, dif build, dif validate, or @dif.sh/sdk./dif-setup-analyticsSet up dif analytics in an app and prove events arrive. Installs the site analytics script for page views, wires sign-in, consent and CSP, plans and adds marketing and product events with dif.track and data-dif-event, checks every experiment metric is tracked, and runs the install check. Use when the user wants to set up, install, add or check dif analytics, page views, visitors, UTM, conversion or product events, tracking, a tracking plan or instrumentation, or when triage reports fix_instrumentation or a metric has no data./dif-triage-experimentsTriage every running dif.sh experiment and rollout from the dif analytics overview. Shows what needs action, then ramps rollouts, turns off or kills harmful variants, and concludes winners and inconclusive tests by editing dif/ files, with one branch and one PR per experiment in autonomous mode. Use when the user asks to triage experiments, review all experiments, see what needs action, ramp, turn off, kill, find winners, or check the dif analytics overview.Other plugins' skills for the same job