Browser Automation
One front door for every way to drive a browser: a shared logged-in browser, an isolated per-run browser, Playwright MCP, Playwright scripts, a browser-agent extension, and a throwaway browser, plus the rule that keeps unattended jobs from grabbing your screen.
What it is
This is the skill behind the browser-automation series. It answers one question before an agent touches a browser: which surface does this task need? Then it drives that surface the safe way. Six surfaces plus fetch-only tools, one decision table, and the connect-and-drive patterns for each.
The two parts that matter
The decision guide. A table keyed on what you want to do (reuse a login, explore an unfamiliar site, repeat a known flow, act in your own browser, render a public page, get through a hostile site) that names the surface and why. The defaults: when it's interactive and you're unsure, Playwright MCP; when a shared persistent login is the point, the shared logged-in browser; the stealth stack only after a normal surface has been blocked.
The attended-vs-unattended rule. A logged-in browser you reuse lives in a visible window, and activating a tab in it grabs focus. So before picking a surface, the skill asks whether the job could run unattended or during the workday. If it could, it must use a headless surface, never the visible shared browser or the extension. This is the rule that keeps a scheduled job from taking over your screen.
What's sanitized
The version I run has my ports, my browser profile paths, my supervisor job names, and the paths to my helper scripts wired in. This copy replaces all of that with placeholders and a small config.json you fill in: the CDP URL of your automation browser, an absolute artifacts directory for screenshots, the path to your Chrome for Testing binary, and the command that restarts your browser. Everything else, the decision guide, the safety rule, the anti-bot escalation, and the script patterns, is unchanged.
Setup
- Download the skill file below and save it as
~/.claude/skills/browser-automation/SKILL.md. - Run a dedicated Chrome for Testing with
--remote-debugging-portand its own--user-data-dir, log into your sites once in that window, and keep it running (launchd, systemd, or however you supervise processes). - Create
config.jsonnext toSKILL.mdwith the four values above. - Install Playwright, pinned to an exact version that matches your Chrome for Testing build:
npm install playwright@<version>. A client that's too new hangs on connect. - Optional: install the Playwright MCP server with
claude mcp add -s user playwright -- npx @playwright/mcp@latest --output-dir <your artifacts dir>.
For the reasoning behind each surface and when to skip it, read the series. Start with Part 1.
Ready to use this skill?
Drop it into your .claude/skills/ folder and you're ready.
This guide was my gift to you. I want everyone to be able to punch above their weight class by leveraging AI to do more with what they've got.
If this helped and you want to know how I help companies through AI consulting, mentoring, or workshops — sign up for my email list or reach out below.