Use this skill when the user wants a two-script headed browser workflow with a stable persistent profile.
The workflow is:
- ensure
playwright-cliexists node scripts/start.jsnode scripts/pl.js <PLAYWRIGHT-CLI STYLE COMMAND>
STEP 0
Before anything else:
- check
playwright-cli --help - if it does not exist, stop and redirect to
references/install-playwright-cli.md - consult the
playwright-cliskill body before describing command usage, so command examples follow the real CLI surface
NON-NEGOTIABLE RULE
ALWAYS USE HEADED MODE.
- If a physical desktop exists, use the real visible browser window.
- If no physical desktop exists, use a virtual display workaround such as Xvfb.
- Do not switch to headless mode as the default answer.
The safe default is:
- use Playwright's default bundled Chromium
- create a persistent profile under the user's home directory
- run the browser in headed mode with full JS rendering
- never touch the user's daily live browser profile by default
- keep all startup defaults hardcoded in
scripts/start.js
The default recommended pattern is:
- run
node scripts/start.js - wait until it reports the stable profile is ready
- run
node scripts/pl.js ... - keep it headed so sites behave like a real visible browser
- reuse the same profile next time so tabs, cookies, and logins survive
Core truth to preserve
The stable session behavior comes from the persistent profile started by start.js.
start.jsowns setup, browser startup, display bootstrap, and readinesspl.jsowns command forwarding against the already-started session- the user should not need extra attach steps
- if something must change, edit
scripts/start.js - cleanup may kill the running browser process, but must NOT delete the persistent profile directory by default
- do not casually delete
~/.playwright-stable-profile/profile/or wipe browser state during normal recovery
Recommended default answer shape
When the user asks how to do this, structure the answer like this:
- explain the two-script model in one sentence
- show the install command using
pnpm - show
node scripts/start.js - show a few
node scripts/pl.js ...commands - point to configuration or troubleshooting docs if needed
Installation guidance
Prefer pnpm here.
pnpm add playwright playwright-cli
The scripts handle Chromium installation at startup if needed.
Read these references when needed
references/install-playwright-cli.md— install/check the CLI tool before doing anything elsereferences/setup.md— exact install and run stepsreferences/configuration.md— what to change inscripts/start.jsreferences/troubleshooting.md— diagnose failures and stale state
Bundled scripts
scripts/start.js— full startup and readiness scriptscripts/pl.js— command wrapper using Playwright CLI style commands
Default CLI recipe
pnpm add playwright playwright-cli
node scripts/start.js
node scripts/pl.js open https://example.com
node scripts/pl.js snapshot
node scripts/pl.js click e15
node scripts/pl.js close
This is a headed browser flow. Do not switch to headless by default.
Headed-only realism rule
If the user cares about realism, anti-bot flows, captchas, or browser parity, recommend:
- ALWAYS USE HEADED MODE
- full JS rendering in the normal browser process
- virtual display infrastructure when a real desktop cannot be used safely
Do not casually suggest headless mode for these flows.
What not to claim
Do not say:
- that the user needs a manual attach step
- that the user needs extra helper scripts beyond
start.jsandpl.js - that headless mode is equivalent to a real visible browser for sensitive flows
- that normal cleanup should delete the persistent profile files
Output preference
Prefer concise, runnable snippets and point directly to scripts/start.js for configuration changes.