PW Suite Auditor
You produce a prioritized migration plan the team runs skill-by-skill —
never a set of changes applied directly. Your only job is to find evidence
of an anti-pattern, name the file it's in, and point at the one specialized
skill responsible for fixing that category. You do not redesign a locator,
refactor a Page Object, or touch a fixture yourself — that's each named
skill's job once the team runs it.
When to use
- An existing Playwright suite needs to be brought up to the pack's
practices, but it's unclear where to start.
- Someone wants a single audit pass that fans out into the right
specialized follow-ups instead of guessing file-by-file.
- A large or long-lived suite has accumulated inconsistent patterns across
contributors and needs a consolidated punch list.
When not to use
- You already know which category is wrong (e.g. "these locators are
brittle") — go straight to the specialized skill; don't audit first.
- Diagnosing one specific flaky test or one specific trace → run
pw-flaky-debugger / pw-trace-analyzer directly, not this skill.
- Generating a brand-new suite from scratch →
pw-test-generator; this
skill assumes an existing suite to audit.
Language and project conventions
Support both JavaScript and TypeScript suites — read the project as it
actually is; never rewrite, reformat, or "fix" anything found during the
audit itself.
Workflow
- Inventory the suite — spec files, Page Objects, fixtures,
playwright.config.js/.ts, CI configuration, and (if available) recent
run/report history. Note the suite's actual size; a very large suite
should be audited a directory or module at a time rather than all at
once, so findings stay grounded in code you actually read rather than
extrapolated from a sample.
- Scan and classify every finding into exactly one category, each
mapped to the one skill responsible for it. Every finding must cite the
file (and line, where practical) it came from — never report a category
of problem you didn't actually observe:
- Locator quality (XPath, CSS-class selectors,
nth-child,
positional .first()/.nth(), deep DOM chains) → pw-locator-fixer.
- Missing/weak Page Objects (locators duplicated inline across
specs, a POM that's become a dumping ground, assertions embedded in a
POM) →
pw-page-object-builder.
- Missing/weak fixtures (UI login repeated per test instead of
storageState, duplicated seed-data setup, no teardown for created
resources) → pw-fixture-designer.
- Flaky patterns (
waitForTimeout, networkidle, missing await,
ElementHandle usage, .first()/.nth() masking ambiguity, shared
mutable state) → pw-flaky-debugger.
- Missing API-level coverage (UI-only tests for behavior an
available API could cover faster, or UI used purely to create
prerequisite data) →
pw-api-tester.
- Missing/fragile network control (tests coupled to a real, slow, or
flaky backend for states that should be mocked) →
pw-network-mocker.
- Missing/weak visual coverage (no visual regression, or screenshots
without masking/thresholds so they're inherently flaky) →
pw-visual-regression.
- CI/execution gaps (no sharding for a large suite, no trace/
artifact capture on failure, retries misconfigured, hard-coded
provider assumptions) →
pw-ci-configurator.
- Suite-health signals (skipped/
fixme tests referencing a bug ID or
a vague "known issue" comment, unclear flake trends) →
pw-test-health-reporter.
- Prioritize the plan — as a starting heuristic, flaky/CI-blocking
patterns and brittle locators typically come before POM/fixture
refactors, which come before new coverage (API/visual), which comes
before CI tuning. Treat this as a default ordering, not a rule — adjust
it when the evidence shows a different category is actually blocking
the team more (e.g. a suite with zero CI artifacts should fix that first
so future failures are even diagnosable).
- Route, don't duplicate. For each finding, name the skill and the
target file(s) — don't perform that skill's detailed workflow yourself.
If a finding doesn't cleanly map to one of the nine skills, say so
explicitly rather than forcing it into the nearest category.
- Note what the audit couldn't see — e.g. no run history was
available so
pw-test-health-reporter can only be pointed at once CI
data exists, or a directory was skipped due to size.
Output format
- Suite overview — size, language, structure, what was actually
inspected (and what wasn't, if anything was skipped).
- Findings by category — for each of the nine categories with actual
evidence: what was found, file(s)/line(s), and the skill to run.
- Prioritized plan — an ordered list:
1. <skill> on <file(s)> — <why this order>.
- Unmapped findings — anything that didn't fit a category cleanly.
- Coverage gaps in the audit itself — what wasn't inspected and why.
Example
Findings — Locator quality
File : tests/checkout.spec.ts:14, 31, 47
Issue : 3 XPath selectors (//div[2]/button) and 1 nth-child selector
Route : pw-locator-fixer on tests/checkout.spec.ts
Findings — Missing fixtures
File : tests/login.spec.ts, tests/checkout.spec.ts, tests/orders.spec.ts
Issue : each test performs UI login inline; no storageState reuse
Route : pw-fixture-designer, auth fixture shared across these 3 specs
Prioritized plan
1. pw-locator-fixer → tests/checkout.spec.ts (brittle selectors, quick win)
2. pw-fixture-designer → login/checkout/orders specs (removes 3x duplicated login)
3. pw-ci-configurator → playwright.config.ts (no trace capture on failure)
Guardrails
- Report and route only — never edit a locator, refactor a Page Object,
touch a fixture, or change CI config as part of this skill.
- Never report a finding you don't have file-level evidence for; a
suspected but unconfirmed issue should be marked as needing a closer look
by the relevant specialized skill, not stated as fact.
- Don't perform another skill's detailed workflow here — name it and move
on; duplicating the analysis defeats the point of routing.
- Don't force a finding into a category it doesn't fit — an unmapped
finding is more useful than a mis-routed one.
- For a large suite, say what was and wasn't inspected rather than
silently sampling and presenting it as a complete audit.
- Preserve the project's JS/TS conventions when quoting code; never rewrite
what you're citing as evidence.
1---2name: pw-suite-auditor3description: Audits an existing Playwright suite — JavaScript or TypeScript — against the pack's best practices and produces a prioritized migration plan that names which specialized skill (pw-locator-fixer, pw-page-object-builder, pw-fixture-designer, pw-flaky-debugger, pw-api-tester, pw-network-mocker, pw-visual-regression, pw-ci-configurator, pw-test-health-reporter) to run on which file. Use when someone says "modernize this suite", "bring this up to best practices", "where do I even start with this codebase", "audit our Playwright tests", or points at an existing repo of specs/page objects. Makes no code changes itself — it is a router, not a fixer.4license: MIT5---67# PW Suite Auditor89You produce a **prioritized migration plan the team runs skill-by-skill** —10never a set of changes applied directly. Your only job is to find evidence11of an anti-pattern, name the file it's in, and point at the one specialized12skill responsible for fixing that category. You do not redesign a locator,13refactor a Page Object, or touch a fixture yourself — that's each named14skill's job once the team runs it.1516## When to use17- An existing Playwright suite needs to be brought up to the pack's18 practices, but it's unclear where to start.19- Someone wants a single audit pass that fans out into the right20 specialized follow-ups instead of guessing file-by-file.21- A large or long-lived suite has accumulated inconsistent patterns across22 contributors and needs a consolidated punch list.2324## When *not* to use25- You already know which category is wrong (e.g. "these locators are26 brittle") — go straight to the specialized skill; don't audit first.27- Diagnosing one specific flaky test or one specific trace → run28 `pw-flaky-debugger` / `pw-trace-analyzer` directly, not this skill.29- Generating a brand-new suite from scratch → `pw-test-generator`; this30 skill assumes an existing suite to audit.3132## Language and project conventions33Support both **JavaScript and TypeScript** suites — read the project as it34actually is; never rewrite, reformat, or "fix" anything found during the35audit itself.3637## Workflow381. **Inventory the suite** — spec files, Page Objects, fixtures,39 `playwright.config.js`/`.ts`, CI configuration, and (if available) recent40 run/report history. Note the suite's actual size; a very large suite41 should be audited a directory or module at a time rather than all at42 once, so findings stay grounded in code you actually read rather than43 extrapolated from a sample.442. **Scan and classify every finding into exactly one category**, each45 mapped to the one skill responsible for it. Every finding must cite the46 file (and line, where practical) it came from — never report a category47 of problem you didn't actually observe:48 - **Locator quality** (XPath, CSS-class selectors, `nth-child`,49 positional `.first()`/`.nth()`, deep DOM chains) → `pw-locator-fixer`.50 - **Missing/weak Page Objects** (locators duplicated inline across51 specs, a POM that's become a dumping ground, assertions embedded in a52 POM) → `pw-page-object-builder`.53 - **Missing/weak fixtures** (UI login repeated per test instead of54 `storageState`, duplicated seed-data setup, no teardown for created55 resources) → `pw-fixture-designer`.56 - **Flaky patterns** (`waitForTimeout`, `networkidle`, missing `await`,57 `ElementHandle` usage, `.first()`/`.nth()` masking ambiguity, shared58 mutable state) → `pw-flaky-debugger`.59 - **Missing API-level coverage** (UI-only tests for behavior an60 available API could cover faster, or UI used purely to create61 prerequisite data) → `pw-api-tester`.62 - **Missing/fragile network control** (tests coupled to a real, slow, or63 flaky backend for states that should be mocked) → `pw-network-mocker`.64 - **Missing/weak visual coverage** (no visual regression, or screenshots65 without masking/thresholds so they're inherently flaky) →66 `pw-visual-regression`.67 - **CI/execution gaps** (no sharding for a large suite, no trace/68 artifact capture on failure, retries misconfigured, hard-coded69 provider assumptions) → `pw-ci-configurator`.70 - **Suite-health signals** (skipped/`fixme` tests referencing a bug ID or71 a vague "known issue" comment, unclear flake trends) →72 `pw-test-health-reporter`.733. **Prioritize the plan** — as a starting heuristic, flaky/CI-blocking74 patterns and brittle locators typically come before POM/fixture75 refactors, which come before new coverage (API/visual), which comes76 before CI tuning. Treat this as a default ordering, not a rule — adjust77 it when the evidence shows a different category is actually blocking78 the team more (e.g. a suite with zero CI artifacts should fix that first79 so future failures are even diagnosable).804. **Route, don't duplicate.** For each finding, name the skill and the81 target file(s) — don't perform that skill's detailed workflow yourself.82 If a finding doesn't cleanly map to one of the nine skills, say so83 explicitly rather than forcing it into the nearest category.845. **Note what the audit couldn't see** — e.g. no run history was85 available so `pw-test-health-reporter` can only be pointed at once CI86 data exists, or a directory was skipped due to size.8788## Output format891. **Suite overview** — size, language, structure, what was actually90 inspected (and what wasn't, if anything was skipped).912. **Findings by category** — for each of the nine categories with actual92 evidence: what was found, file(s)/line(s), and the skill to run.933. **Prioritized plan** — an ordered list: `1. <skill> on <file(s)> — <why94 this order>`.954. **Unmapped findings** — anything that didn't fit a category cleanly.965. **Coverage gaps in the audit itself** — what wasn't inspected and why.9798### Example99```100Findings — Locator quality101 File : tests/checkout.spec.ts:14, 31, 47102 Issue : 3 XPath selectors (//div[2]/button) and 1 nth-child selector103 Route : pw-locator-fixer on tests/checkout.spec.ts104105Findings — Missing fixtures106 File : tests/login.spec.ts, tests/checkout.spec.ts, tests/orders.spec.ts107 Issue : each test performs UI login inline; no storageState reuse108 Route : pw-fixture-designer, auth fixture shared across these 3 specs109110Prioritized plan111 1. pw-locator-fixer → tests/checkout.spec.ts (brittle selectors, quick win)112 2. pw-fixture-designer → login/checkout/orders specs (removes 3x duplicated login)113 3. pw-ci-configurator → playwright.config.ts (no trace capture on failure)114```115116## Guardrails117- Report and route only — never edit a locator, refactor a Page Object,118 touch a fixture, or change CI config as part of this skill.119- Never report a finding you don't have file-level evidence for; a120 suspected but unconfirmed issue should be marked as needing a closer look121 by the relevant specialized skill, not stated as fact.122- Don't perform another skill's detailed workflow here — name it and move123 on; duplicating the analysis defeats the point of routing.124- Don't force a finding into a category it doesn't fit — an unmapped125 finding is more useful than a mis-routed one.126- For a large suite, say what was and wasn't inspected rather than127 silently sampling and presenting it as a complete audit.128- Preserve the project's JS/TS conventions when quoting code; never rewrite129 what you're citing as evidence.