playwright-auth-state
Playwright workflows for authenticated browser state reuse through storageState and setup projects.
Conducts rigorous authoring and review of Playwright E2E tests. Enforces accessibility-first locators, web-first assertions, strict isolation, and DAMP architecture. Use when generating, refactoring, or reviewing any Playwright test code.
$ npx -y skills add hzijad/playwright-agent-skills --skill playwright-core --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/playwright-coreContext preview
The summary Claude sees to decide when to auto-load this skill.
Conducts rigorous authoring and review of Playwright E2E tests. Enforces accessibility-first locators, web-first assertions, strict isolation, and DAMP architecture. Use when generating, refactoring, or reviewing any Playwright test code.
name: playwright-core description: Conducts rigorous authoring and review of Playwright E2E tests. Enforces accessibility-first locators, web-first assertions, strict isolation, and DAMP architecture. Use when generating, refactoring, or reviewing any Playwright test code.
Writing end-to-end tests is easy. Writing end-to-end tests that survive UI refactors and network latency without flaking requires discipline.
Use this skill when you are authoring, reviewing, or refactoring Playwright tests that should behave like a real user journey. It pairs well with `playwright-auth-state` for logged-in flows, `playwright-network-mocking` for external API control, and `playwright-debugging` when a test is already failing.
**The approval standard:** A test is only valid if it tests the application exactly how a human user interacts with it. We do not test implementation details, we do not rely on fixed sleep timers, and we do not share state between tests. If a test fails, it should indicate a true user-facing bug, not a brittle CSS selector or a race condition.
Every Playwright test must be evaluated across these five dimensions before execution:
Does the test target user intent, or is it coupled to implementation?
Are we relying on Playwright's actionability engine, or are we manually guessing execution speed?
Can this test run in complete isolation, in any order, and in parallel?
Can another engineer read the test top-to-bottom and understand the business requirement?
Does the test verify what the user cares about?
---
When you identify a structural problem in a test, do not just patch it. Reach for a named restructuring:
---
You must follow this exact order of preference when querying the DOM. Fall to the next level only if the previous is impossible.
1. `page.getByRole()` - Always the first choice. Tests accessibility and user intent simultaneously. 2. `page.getByLabel()` - The standard for form inputs. 3. `page.getByPlaceholder()` - Acceptable for inputs without labels. 4. `page.getByText()` - For generic non-interactive text elements. 5. `page.getByTestId()` - The fallback. Use only when semantic querying is impossible, such as dynamic SVG charts. 6. CSS/XPath - Forbidden unless explicitly requested for legacy integration.
When a locator could match more than one element, refine it with semantic filtering instead of switching to position-based selection. Prefer `filter()`, `and()`, or a narrower accessible name over `nth()` or DOM traversal.
---
Always use auto-retrying assertions. Never read a value and assert it synchronously.
// Bad: synchronous evaluation. Causes race conditions if the element is still rendering.
const isVisible = await page.getByRole('button').isVisible();
expect(isVisible).toBeTruthy();
// Good: Playwright handles the polling and timeout automatically.
await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible();Do not force clicks on unready elements. Let Playwright wait for actionability.
// Bad: bypassing actionability checks.
await page.locator('.btn').click({ force: true });
// Good: waiting for the app to be ready.
await page.getByRole('button', { name: 'Submit' }).click();###
Playwright test patterns that avoid the mistakes agents make by default. Playwright Agent Skills is a small, opinionated set of reusable prompts for writing and reviewing Playwright tests.
Repo: hzijad/playwright-agent-skills
Playwright workflows for authenticated browser state reuse through storageState and setup projects.
Diagnostic Playwright workflows for flaky or failing tests, including trace analysis, UI mode, and state isolation.
Playwright workflows for deterministic third-party responses using page.route().