| name | playwright |
| description | Drive Playwright from the CLI for end-to-end browser testing and AI-assisted test authoring with Playwright Test Agents (Planner, Generator, Healer). Use when the user says "write e2e tests", "playwright", "browser test", "test a web page/app", "record a test", "codegen", "show the trace/report", "fix the failing e2e test", "heal my tests", "set up playwright agents", or wants to plan/generate/repair Playwright tests. Universal — runs via `npx`, assumes no global install.
|
| allowed-tools | Bash(npx:*), Bash(node:*) |
Playwright
End-to-end browser testing (Chromium, Firefox, WebKit) plus an AI authoring loop
— the Test Agents. Everything runs through npx; do not assume a global
install and do not npm i -g playwright. If a project already depends on
@playwright/test, prefer its local version (npx playwright ... resolves it).
Docs: https://playwright.dev — Test Agents: https://playwright.dev/docs/test-agents
First contact
Always discover the live command surface rather than guessing — it's version-specific:
npx playwright --help
npx playwright <command> --help
npx playwright --version
If browsers aren't installed yet, the first run prompts for them:
npx playwright install
npx playwright install chromium
npx playwright install-deps
Core CLI
npx playwright test
npx playwright test --grep "login"
npx playwright test path/to/spec.ts
npx playwright test --project=chromium
npx playwright test --headed
npx playwright test --ui
npx playwright test --debug
npx playwright codegen localhost:3000
npx playwright show-report
npx playwright show-trace trace.zip
npx playwright screenshot <url> out.png
npx playwright open <url>
trace: 'on-first-retry' and screenshot: 'only-on-failure' in
playwright.config.ts are the high-value defaults — they make show-trace and
the HTML report useful for diagnosing failures without slowing the happy path.
Test Agents — the AI authoring loop
Playwright ships three agents that operate a real browser over MCP (they
observe the live DOM, they don't hallucinate selectors):
| Agent | Job |
|---|
| 🎭 Planner | Explores the running app and writes a human-readable Markdown test plan into specs/. |
| 🎭 Generator | Turns a plan into executable *.spec.ts, verifying every selector and assertion live as it goes. |
| 🎭 Healer | Runs the suite, replays failures, inspects the UI, patches broken locators/waits, and re-runs until green. |
Use them independently, in sequence (plan → generate → heal), or chained in an
agentic loop.
Setup — scaffold the agents INTO THE TARGET PROJECT (not into this plugin)
The agent definitions are versioned with Playwright and regenerated on
upgrade, and they assume a seed.spec.ts + specs/ in the project under test.
So they belong in the project you're testing, freshly generated — never copy
a frozen set into braynee. When the user wants the agents, run this in their
project's repo root:
npx playwright init-agents --loop=claude
This writes Claude Code agent definitions (Planner/Generator/Healer), a specs/
dir, and a seed.spec.ts. Other loop providers exist if asked:
--loop=vscode, --loop=copilot, --loop=opencode. Add --prompts to also
emit prompt files. Re-run it after a Playwright upgrade to refresh the agents.
Requires Playwright >= 1.56 — verify with npx playwright --version first.
Working the loop
- Seed — make sure
seed.spec.ts points at the app and sets up auth/baseURL.
- Plan — ask the Planner to explore a flow; review the Markdown in
specs/.
- Generate — hand a plan to the Generator; it writes verified
*.spec.ts.
- Run —
npx playwright test (use --ui to inspect).
- Heal — on failures, the Healer diagnoses and patches, then re-runs.
Notes
- Universal by design: this skill prescribes
npx so it works in any project on
any machine — there is no machine-global Playwright dependency.
- The agents need the app actually running (or a
webServer block in
playwright.config.ts that starts it). Point seed.spec.ts/baseURL at it.
- For CI,
retries: process.env.CI ? 2 : 0 plus the trace/screenshot defaults
above give debuggable failures without flake noise.