Write Playwright tests for a new component, block, page, or feature by building its Page Object Model (POM) class first, then its spec file, following one consistent house style — locator priority, class shape, describe-block grouping, tagging, and assertion conventions — adapted only to each repo's own file layout and import syntax. Use whenever the user asks to add or write tests for anything new in a Playwright suite — "write tests for the new hero carousel", "add a POM for the FAQ block", "test the new pricing page", "we just shipped a testimonial slider, can you cover it" — even if they never say "POM" or "spec" out loud. Also use when extending an existing component with new sub-elements or states.
Ships in playwright-test-writer. 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.
Read when SKILL.md points to them.
Tests are built through a Page Object Model: locators and interaction/assertion helpers live in dedicated classes, and spec files only call into those classes — they never touch a raw locator directly. Write the POM first; the spec often can't be written correctly before it exists, since a spec has nothing but the POM's methods/locators to call.
Work in this order every time:
references/pom-patterns.md and references/spec-patterns.md are the actual rulebook for steps 3–4 — read them before writing code. references/discovery-checklist.md has commands for step 1. If a repo already has an established Playwright POM suite with its own different conventions for the same kind of thing (its own describe-block scheme, its own locator style), follow the existing suite for consistency within that repo rather than overriding it wholesale — but that's a "this repo is the exception" call, not the default.
Only figure out the mechanical stuff — where files live and how they're imported — not the testing conventions themselves:
*.spec.ts files and whatever directory holds their corresponding classes (commonly pages/, page-objects/, objects/, poms/, models/).test/expect? Many suites wrap Playwright's test.extend in a custom fixture module. If one exists, import from it, not from the raw @playwright/test package — that's usually the only way to get pre-built page objects and helper fixtures.tsconfig/jsconfig paths, bundler aliases) vs. plain relative imports — match whichever the repo uses; don't introduce one it doesn't have.package.json scripts — commands are inherently repo-specific, there's no way around discovering these.Full checklist with example commands: references/discovery-checklist.md.
This determines where the POM lives and how the spec gets hold of it:
If you're unsure which shape fits, ask — chrome and whole-new-page both touch shared wiring, and guessing wrong means redoing step 5.
Don't invent test-id values, ARIA roles, or class names. A guessed selector produces a POM that looks plausible and fails silently against the real DOM.
Full rules and examples: references/pom-patterns.md. The essentials:
new ChildItem(page, this.items.nth(index))), not re-queried from the page root each time.div.a > div.b.c) — ever.assert*, check*, or verify* so a test calling only that helper is still recognized as asserting something.somePageObject.page) when the page fixture is already the same instance — use page directly.Full rules and examples: references/spec-patterns.md. The essentials:
test/expect from the repo's fixture wrapper if one exists, never straight from the framework package.describe blocks by concern: navigation, visibility and interaction, accessibility — use whichever apply, don't force all three if one makes no sense for this feature.visibility and interaction, split into device agnostic, desktop (tagged @desktop), and mobile (tagged @mobile) wherever behavior genuinely differs by viewport (hover-only vs. tap-only interactions) — check the runner config for how these tags gate which projects a test runs under before assuming they exist/behave a particular way.accessibility describe block that scopes a scan (axe-core is the common integration) to its root selector, not the whole page.if, ternaries) controlling test flow — use test.skip(condition, reason) for genuine data-dependent skips. Every test contains an assertion, whether directly or via a named assert*/check*/verify* helper.Find where the repo already wires equivalent existing objects into its fixtures/shared setup, and do the same for the new one. If it's a content block needing a new page/route to test against, add that the same way existing page-path configuration is done. This step is inherently repo-specific plumbing — lean on whatever step 1 found.
Run whatever lint, typecheck, and test commands step 1 identified, in that order, and fix everything they flag.
If a real environment is reachable, run the new spec for real rather than trusting static checks alone. If the spec has viewport-specific blocks (@desktop/@mobile), run enough of the project/browser matrix to actually exercise all of them — running only a default project can silently skip tagged-out blocks.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/playwright-test-writer:playwright-test-writerfrom playwright-test-writer
npx claudepluginhub tomrobinson26/qa-skills --plugin playwright-test-writer