dist/codex/plugins/testing-e2e/skills/playwright-skill/SKILL.md
Playwright primitives for real-browser automation — dev-server detection, a Node.js script runner, and helpers for clicks, form fills, screenshots, multi-viewport, custom HTTP headers. Use when a task needs an actual browser (rendered DOM, visual checks, multi-page flows, cross-browser behavior). Not for API tests or logic tests where curl or JSDOM is cheaper.
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.
Provides primitives for browser automation: dev-server detection, a script runner (scripts/run.js), and helper utilities (scripts/lib/helpers.js).
Detect dev servers first for localhost testing:
node -e "require('scripts/lib/helpers').detectDevServers().then(s => console.log(JSON.stringify(s)))"
One server → use it. Multiple → ask which. None → ask for a URL.
Write generated scripts to /tmp/playwright-test-*.js — never into scripts/ or the user's project.
Visible browser by default (headless: false). Headless only when the user asks.
Parameterize the target URL at the top of the script as TARGET_URL.
node scripts/run.js /tmp/playwright-test-<name>.js # file
node scripts/run.js "<code>" # inline
cat script.js | node scripts/run.js # stdin
run.js cds to its own directory for module resolution, auto-wraps non-async code, and on first run auto-installs Playwright via bun. For code without require() it injects globals: chromium, firefox, webkit, devices, helpers, and getContextOptionsWithHeaders(opts).
scripts/lib/helpers.js exports: launchBrowser, createPage, createContext, waitForPageReady, safeClick, safeType, extractTexts, extractTableData, takeScreenshot, authenticate, scrollPage, handleCookieBanner, retryWithBackoff, detectDevServers, getExtraHeadersFromEnv.
Open the file when you need a signature.
Set env vars before invoking run.js 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(...).
run.js not found: check that playwright-skill dir is on the skill path; run from that directory explicitly.run.js auto-installs on first run; if that fails, run cd <skill-dir> && bun install or npm install.references/setup.md — first-time install (bun preferred, npm fallback).references/api.md — selectors, locators, network interception, auth, visual regression, mobile emulation, performance, debugging, CI/CD.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, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, TypeScript, Go, web code, or infrastructure operations.
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.
testing
Author, inspect, troubleshoot, and review infrastructure across IaC, Kubernetes, cloud resources, containers, CI/CD, and Linux hosts. Use when changing Terraform/OpenTofu, Kubernetes, Helm, Kustomize, Dockerfiles, GitHub Actions, AWS, GCP, Cloud Run, BigQuery, IAM, logs, instances, or service health. NOT for deploy/apply/rollback workflows (see deploying-infra). NOT for shell scripts or generic command pipelines (see writing-shell).
development
Configure safe git workflow hygiene: pre-commit/pre-push hooks, Gitleaks secret scanning, .gitignore rules, local git config, and guardrails. Use when setting up git hooks, gitleaks/git leaks, staged pre-commit checks, pre-push validation, core.hooksPath, .gitignore, or git config best practices. NOT for creating commits (use committing-code), cleaning branches/worktrees (use cleanup-git), or creating worktrees (use using-git-worktrees).