/product-engineer:flow-testfrom product-engineer
Creates end-to-end tests with a UX budget that fails CI when happy paths require more clicks, fields, or page loads than allowed. Works with Playwright or Cypress.
Ships in product-engineer. 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.
A flow that took 6 clicks at launch takes 11 a year later, one reasonable PR at a time, and nothing fails along the way. This skill makes the flow's cost an assertion: an end-to-end test walks the happy path the way a user would, counts the interactions, and fails when the count exceeds the budget.
Look for an existing end-to-end stack: playwright.config.*, cypress.config.*, wdio.conf.*, Maestro or Detox for mobile. Reuse its config, fixtures, authentication helpers, test-data seeding and CI job.
If there's none, propose Playwright and ask before adding it: a new tool in the project's toolchain is the team's decision.
Read flow-audit.md in the feature folder (docs/product/<feature-slug>/) for the steps and the budget. Without one, trace the happy path quickly (entry point → steps → goal state) and set the budget to today's count: the test's first job is to stop the flow from getting worse.
What to assert, depending on the flow:
These match the definitions in happy-path-audit, so the audit's budget can be asserted as is.
Count interactions in the page, not in the test code. A listener on real DOM events counts every click, whichever helper or page object produced it. Add this once next to the project's other fixtures, adapted to its language and conventions (Playwright with TypeScript shown):
// e2e/fixtures/ux-meter.ts
import { test as base, expect, type Page } from '@playwright/test';
export type UxBudget = { clicks?: number; fields?: number; navigations?: number };
export class UxMeter {
clicks = 0;
fields = 0;
navigations = 0;
constructor(private readonly page: Page) {}
async install() {
await this.page.exposeBinding('__uxMeter', (_source, kind: 'click' | 'field') => {
if (kind === 'click') this.clicks++;
else this.fields++;
});
await this.page.addInitScript(() => {
const report = (kind: string) => (window as any).__uxMeter?.(kind);
const touched = new WeakSet<EventTarget>();
const onField = (event: Event) => {
if (event.target && !touched.has(event.target)) {
touched.add(event.target);
report('field');
}
};
addEventListener('click', (event) => { if (event.isTrusted) report('click'); }, true);
addEventListener('input', onField, true);
addEventListener('change', onField, true);
});
this.page.on('framenavigated', (frame) => {
if (frame === this.page.mainFrame()) this.navigations++;
});
}
/** Call once the start state is visible (after login, seeding and the first goto). */
start() {
this.clicks = 0;
this.fields = 0;
this.navigations = 0;
}
expectWithin(budget: UxBudget) {
const actual = { clicks: this.clicks, fields: this.fields, navigations: this.navigations };
base.info().annotations.push({ type: 'ux-budget', description: JSON.stringify({ actual, budget }) });
for (const key of Object.keys(budget) as (keyof UxBudget)[]) {
expect(actual[key], `UX budget exceeded for ${key}: ${JSON.stringify(actual)}`)
.toBeLessThanOrEqual(budget[key]!);
}
}
}
export const test = base.extend<{ ux: UxMeter }>({
ux: async ({ page }, use) => {
const meter = new UxMeter(page);
await meter.install();
await use(meter);
},
});
export { expect };
What it counts:
click, check and tap produce trusted events and are counted. Clicks dispatched by the app's own JavaScript are not.fill and selectOption count one field per input, however many times it's edited. They don't count a click: focusing a text field is part of filling it. A native <select> costs a real user two clicks — add them to the budget by hand if the flow has one.framenavigated fires for full page loads and for client-side route changes. If the app rewrites the URL several times per screen (query parameters, redirects), assert clicks and fields and leave navigations out.click, input and change in the capture phase, reset at the start state, asserted at the goal state.Happy path first. Walk it like a user: role- and label-based locators (getByRole, getByLabel), which survive refactors and double as an accessibility check. Seed the start state through the API if that's faster, but never take API shortcuts for the steps being measured.
import { test, expect } from './fixtures/ux-meter';
test('first invoice is sent within budget', async ({ page, ux }) => {
await page.goto('/dashboard'); // signed in through storageState
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
ux.start();
await page.getByRole('button', { name: 'New invoice' }).click();
await page.getByLabel('Client').fill('Acme');
await page.getByRole('option', { name: 'Acme Corp' }).click();
await page.getByLabel('Amount').fill('1200');
await page.getByRole('button', { name: 'Send invoice' }).click();
await expect(page.getByText('Invoice sent')).toBeVisible(); // goal state
ux.expectWithin({ clicks: 3, fields: 2 }); // budget from flow-audit.md
});
Then the critical unhappy paths listed in unhappy-paths.md. Simulate failures with network interception (page.route returning a 500 or a validation error) and assert the recovery: the error is visible, the input is kept, and the user gets back on the path within a small budget.
ux-budgets.json when there are several flows, so any budget change shows up in the diff.ux-budget annotation records the measured counts, so ux-review can show before and after on a PR.The fixture, the flow tests and the budgets committed to the repo, with a run that passes — or that fails on an existing regression, which you report. Summarize: flows covered, budgets set (current and target), and any flow already over its target.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
e2e-testing, ux-budget, click-budget, playwright, cypress, regression-testing
npx claudepluginhub trystan-sa/product-engineer-skills --plugin product-engineer15 skills in this plugin
/ab-test-designDesign an A/B test that can answer its question — hypothesis, one primary metric, guardrails, randomization unit, minimum detectable effect, sample size and duration with a bundled calculator — decide whether a test is worth running at all, and implement the variant behind the project's feature-flag tool (GrowthBook, LaunchDarkly, Statsig, PostHog, Optimizely, Unleash or in-house flags). Use when asked to A/B test, experiment, split test, or validate a change with data before rolling it out./accessibility-auditAudit and fix accessibility in the product's real UI code against WCAG 2.2 AA — contrast, semantics, keyboard and focus, screen-reader names and announcements, forms and errors, motion, target size — combining the automated checks the project supports (axe, lint rules) with a manual review of what tools can't catch. Use when accessibility is questioned, before shipping user-facing UI, for a compliance review, or when ux-review flags accessibility issues./adoption-planPlan how users will discover, try, activate and keep using a feature — map entry points against the moments users need it, define the adoption funnel and the value moment, design empty states and onboarding, plan launch communication, and diagnose low adoption after launch. Use when launching or relaunching a feature, when a shipped feature is under-used, or when asked about discoverability, onboarding, activation or feature adoption./design-system-adoptionMeasure how much of a codebase actually uses its design system — token coverage versus hardcoded colors, spacing and font sizes, design-system components versus local re-implementations and forks — find the hotspots and the repeated patterns that should become components, and plan a ratcheted migration with lint rules and safe codemods. Use when asked whether the design system is used, why the UI is inconsistent, to inventory components, or to plan a design-system migration./design-system-extractExtract design tokens — color, typography, spacing, radii, shadows, motion, breakpoints — from a codebase, brand guide or screenshots into a tokens file in the project's own format (CSS variables, Tailwind theme, TypeScript or DTCG JSON), and report where the product disagrees with itself. Use when a project has no tokens yet, when asked to "extract tokens" or "build a design system from the code", or before measuring design-system adoption./experiment-readoutAnalyze a finished A/B test and recommend a decision — validity checks first (sample ratio mismatch, duration, exposure), then lift, confidence intervals and p-values from a bundled script, guardrails and pre-registered segments, and a ship / iterate / roll back call with a stakeholder summary and flag cleanup. Use when an experiment has ended, or when someone asks "did the test win?", "is this significant?", or to read A/B results.Other plugins' skills for the same job