tests/fixtures/golden_skills/playwright-skill/gemini/SKILL.md
Support-only Playwright runtime/reference for browser-automation — dev-server detection, a Node.js script runner, quiet screenshot helpers, SPA readiness helpers, and custom HTTP headers. Use when browser-automation selects the bundled Playwright fallback; do not route user intent here directly.
npx skillsauth add alexei-led/claude-code-config playwright-skillInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Support-only helper for browser-automation. Provides Playwright primitives:
dev-server detection, a script runner (scripts/run.js), screenshot CLIs, and
helper utilities (scripts/lib/helpers.js).
Do not treat this as the user-facing browser skill. Load it only when
browser-automation chooses the bundled Playwright helper as the
runtime/reference.
Run from this skill directory — the directory containing this SKILL.md.
If the loaded skill path is different from ~/.pi/agent/skills, use that
loaded path.
Detect dev servers first for localhost testing:
node scripts/run.js --json "console.log(JSON.stringify(await helpers.detectDevServers()))"
One server → use it. Multiple → ask which. None → ask for a URL.
Use /tmp/playwright-* for generated scripts and artifacts unless the
user asked for permanent tests. Never write generated scripts or artifacts
into scripts/, the skill directory, or the user's project.
Prefer headless screenshots in Pi/headless harnesses. Use headed mode only when the platform exposes a usable visible browser.
Parameterize target URLs at the top of generated scripts as TARGET_URL.
node scripts/run.js --quiet /tmp/playwright-test-<name>.js
node scripts/run.js --json "console.log(JSON.stringify({ ok: !!chromium }))"
run.js preserves the caller working directory, auto-wraps code for await,
auto-installs Playwright on first run using bun with npm fallback, and sends
runner logs to stderr. Script stdout stays clean for JSON.
chromium, firefox, webkit, devices, helpers, and
getContextOptionsWithHeaders(opts) are exposed as globals for all scripts.
Scripts may still use normal imports such as require("fs"), require("path"),
or require("playwright").
For one page:
node scripts/screenshot-url.js \
--url http://localhost:3030/1?clicks=20 \
--selector .slidev-page \
--out /tmp/playwright-slide-01.png \
--manifest /tmp/playwright-slide-01.json \
--json
For a sequence:
node scripts/screenshot-sequence.js \
--url-template 'http://localhost:3030/{n}?clicks=20' \
--from 1 \
--to 17 \
--selector .slidev-page \
--out-dir /tmp/playwright-slidev \
--manifest /tmp/playwright-slidev/manifest.json \
--json
The manifest includes URL, title, screenshot path, viewport, console errors, network failures, and HTTP responses with status >=400.
Open scripts/lib/helpers.js when you need helper signatures. Key helpers:
launchBrowser, createContext, waitForStablePage, waitForPageReady,
safeClick, safeType, takeScreenshot, authenticate, and
detectDevServers.
Use helpers.waitForStablePage(page, { selector, animationFrames }) before SPA
screenshots when networkidle is not enough.
Set env vars before invoking run.js or screenshot helpers to inject extra
headers into every request:
# single header
PW_HEADER_NAME=X-Automated-By PW_HEADER_VALUE=playwright-skill \
node scripts/run.js /tmp/script.js
# multiple
PW_EXTRA_HEADERS='{"X-Automated-By":"playwright-skill","X-Debug":"true"}' \
node scripts/run.js /tmp/script.js
Headers apply automatically when scripts use helpers.createContext(browser).
For raw browser.newContext(...), wrap options with
getContextOptionsWithHeaders(...).
URL: <target URL>
Actions: <actions run>
Artifacts: <paths or none>
Failures: <failures or none>
Base success claims on script output or artifacts, not on command completion alone.
run.js not found: run from the directory containing this SKILL.md, or use
the absolute loaded skill path.run.js and screenshot helpers auto-install on
first run; if that fails, use references/setup.md.references/setup.md — first-time install (bun
preferred, npm fallback).references/api.md — runtime-only patterns and links to
official Playwright API docs. Open it when a helper doesn't cover the needed
action (custom locators, waits, network interception, or auth patterns).tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview. NOT for generic implementation planning that does not read or write `.spec/` files.
development
Simple web development with HTML, CSS, JS, and HTMX. Use when working with .html, .css, or .htmx files, web templates, stylesheets, or vanilla JS scripts. NOT for React/Vue/Angular (use writing-typescript) or Node.js backends.
tools
Idiomatic TypeScript development. Use when writing TypeScript code, Node.js services, React apps, or TypeScript design advice. Emphasizes strict typing, boundary validation, composition, fast feedback, behavior tests, and project-configured tooling. NOT for Go, Python, Rust, plain HTML/CSS/JS, or server-rendered templates (use writing-web).
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, CI `run:` shell bodies, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, Rust, TypeScript, Go, web code, or GitHub Actions workflow/job/permissions semantics; use operating-infra.