npx skills add ...
npx skills add secondsky/claude-skills --skill playwright
Browser automation and E2E testing with Playwright. Auto-detects dev servers, writes clean test scripts. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use for cross-browser testing, visual regression, API testing, component testing in TypeScript/JavaScript and Python projects.
npx skills add secondsky/claude-skills --skill playwright
Expert knowledge for browser automation and end-to-end testing with Playwright - a modern cross-browser testing framework.
IMPORTANT - Path Resolution:
This skill can be installed in different locations. Before executing commands, determine the skill directory based on where you loaded this SKILL.md file, and use that path in all commands. Replace $SKILL_DIR with the actual discovered path.
Common installation paths:
~/.claude/plugins/*/playwright/skills/playwright~/.claude/skills/playwright<project>/.claude/skills/playwrightWhen automating browser tasks:
Auto-detect dev servers - For localhost testing, ALWAYS run server detection FIRST:
Write scripts to /tmp - NEVER write test files to skill directory; always use /tmp/playwright-test-*.js
Use visible browser by default - Always use headless: false unless user specifically requests headless mode
Parameterize URLs - Always make URLs configurable via constant at top of script
Execute via run.js - Always run: cd $SKILL_DIR && node run.js /tmp/playwright-test-*.js
This installs Playwright and Chromium browser. Only needed once.
/tmp/playwright-test-*.jscd $SKILL_DIR && node run.js /tmp/playwright-test-*.jsExecute: cd $SKILL_DIR && node run.js /tmp/playwright-test-responsive.js
Optional utility functions in lib/helpers.js:
Configure custom headers for all HTTP requests via environment variables:
Headers are automatically applied when using helpers.createContext().
For quick one-off tasks:
When to use:
detectDevServers() before writing test code/tmp/playwright-test-*.js, never to skill directoryTARGET_URL constantheadless: false unless explicitly requestedpage.route()slowMo: 100 to make actions visiblewaitForURL, waitForSelector, waitForLoadState instead of fixed timeoutsconsole.log() to track progressPlaywright not installed:
Module not found:
Ensure running from skill directory via run.js wrapper
Browser doesn't open:
Check headless: false and ensure display available
Element not found:
Add wait: await page.waitForSelector('.element', { timeout: 10000 })
When installing Playwright and browser binaries, follow supply chain security best practices:
npm config set ignore-scripts true (then manually run npx playwright install to download browsers)socket package score npm <pkg> or use socket npm install <pkg> to check packagesLoad the dependency-upgrade skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.
vitest-testing - Unit and integration testingapi-testing - HTTP API testingtest-quality-analysis - Test quality patternsLoad references/API_REFERENCE.md when you need: