Playwright
Production Claude Code setup for ~/.claude/: rules, hooks, agents, skills, and governance docs.
npx -y skills add stuartshields/claude-setup --skill playwrightAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Playwright MCP browser automation workflow. Snapshot-first approach for page interaction, visual verification, form filling, and debugging.
SKILL.md
4.9 KB, as published. Nobody here has run it
Skill: playwright
When to Use
Use this skill for browser automation tasks: visual testing, page interaction, form filling, screenshot comparison, and debugging rendered pages. Invoke with /playwright [URL] to navigate to a specific page, or /playwright to start without a URL.
Use $ARGUMENTS as the URL to navigate to. If empty, ask the user what page to work with.
Do NOT use this skill for writing test files or test code. This is for live browser interaction via MCP tools.
Snapshot First, Screenshot Second
The Playwright MCP provides two ways to see page state. Use the right one:
browser_snapshot- Returns the accessibility tree. Use this for planning actions, finding interactive elements, and understanding page structure. Fast, deterministic, token-efficient. Always start here.browser_take_screenshot- Returns a visual image. Use this for visual verification, layout debugging, comparing against Figma designs, and documentation. You cannot perform actions based on screenshots alone. Usebrowser_snapshotfor that.
Default workflow:
browser_snapshotto understand what's on the page- Perform actions (
browser_click,browser_type,browser_fill_form, etc.) browser_snapshotagain to verify the action workedbrowser_take_screenshotonly when visual verification is needed
Visual Verification with Figma
When comparing implementation against Figma designs:
- Call
get_screenshotfrom the Figma MCP for the design reference - Navigate to the implementation with
browser_navigate - Match viewport dimensions to the Figma frame with
browser_resize - Call
browser_take_screenshotto capture the current state - Compare the two images. If they don't match, identify the specific deltas and fix them
- Repeat until visual parity is achieved
Don't declare "looks good" after a single screenshot. Compare carefully. If you can't tell, use browser_evaluate to measure computed styles and compare against the Figma spec values.
Be Specific with Actions
Vague instructions lead to wrong element clicks. When interacting with elements:
- Reference elements by their accessibility role and name from
browser_snapshotoutput (e.g., "Submit button in the login form", not just "the button") - If multiple elements share the same label, provide context: parent container, position, or surrounding text
- After every action, take a snapshot to confirm the expected state change happened. Don't assume it worked.
Form Interactions
- Use
browser_fill_formto populate multiple fields at once instead of individualbrowser_typecalls when possible - For dropdowns, use
browser_select_optionrather than clicking and typing - After form submission, use
browser_wait_forto confirm the expected result (success message, redirect, etc.) - Check
browser_console_messagesif something fails silently
Debugging
When something goes wrong:
browser_console_messages- Check for JavaScript errorsbrowser_network_requests- Look for failed API calls (4xx, 5xx)browser_evaluate- Inspect DOM state, computed styles, or run diagnostic JSbrowser_take_screenshot- See what the user would actually see
Don't guess at the problem. Use these tools to gather evidence first.
Token Efficiency
Large DOM trees consume significant tokens per browser_snapshot. Keep context manageable:
- Target specific sections of a page rather than full-page snapshots when possible
- For very large pages, use
browser_evaluateto query specific elements instead of snapshotting the entire tree - Close tabs and pages you're done with using
browser_close
Authentication
The Playwright MCP browser is visible. For authenticated pages:
- Navigate to the login page and let the user log in manually with their own credentials
- Cookies persist for the session duration, so you only need to do this once
- Don't attempt to script login with hardcoded credentials