Playwright CLI
@microsoftMicrosoft's playwright-cli skill: an AI agent drives a real browser with short shell commands to test pages, mock requests and write Playwright tests.
Instruction-only skill for Microsoft's playwright-cli; it can open any site, run page JavaScript and save your browser session to disk, but needs no API key.
Install Playwright CLI in Google Antigravity
Antigravity loads skills from .agents/skills/ in your project or ~/.gemini/config/skills/ for all projects (official docs). Full guide
Install the "Playwright CLI" skill for Google Antigravity. Follow the steps at https://www.antigravityskills.org/install/playwright-cli.md (source: https://github.com/microsoft/playwright-cli/tree/main/skills/playwright-cli). Before running anything, show me what you will download and whether it includes scripts, and wait for my OK. Install it into this project (.agents/skills/) unless I say global. When done, check that Antigravity lists it as an installed skill.
The agent reads the install file, shows you what it will download and waits for your OK.
Option 2: install it yourself
- 1. Install the CLI
npm install -g @playwright/cli@latest && playwright-cli --help
README, Installation. Node.js 18 or newer.
- 2. Install the skill into this workspace with the CLI
playwright-cli install --skills=agents
Run from your project root. Writes the skill bundled with your CLI version to .agents/skills/playwright-cli/, Antigravity's workspace folder. The README only shows --skills (which writes .claude/skills/); the =agents form and its target come from the CLI's skillCheck.js at b1a5903 (unchanged since b85c7a7). Static review: we did not run it.
- 3. Or copy the folder from GitHub (project)
git clone --depth 1 https://github.com/microsoft/playwright-cli /tmp/playwright-cli && mkdir -p .agents/skills && cp -r /tmp/playwright-cli/skills/playwright-cli .agents/skills/
Use this instead of the previous step if you prefer a plain copy. Antigravity reads workspace skills from <project>/.agents/skills/<folder>/.
- 4. Or install globally (all projects)
mkdir -p ~/.gemini/config/skills && cp -r /tmp/playwright-cli/skills/playwright-cli ~/.gemini/config/skills/
After the clone above. Global skills folder from Antigravity's docs (antigravity.google/docs/skills).
- 5. Check that Antigravity sees it
Antigravity 2.0 app: start a new conversation and ask "What skills do you have?" (the app has no /skills command; typing / and the skill name also finds it, sometimes only after your first message). Antigravity CLI: run /skills; in a session that was already open, run /skills reload first. playwright-cli should be listed.
The playwright-cli README does not mention Antigravity. If you copy from GitHub, the CLI may later print a notice that the skill at .agents/skills/playwright-cli does not match the tool version; run playwright-cli install --skills=agents to replace it with the bundled copy.
Using Claude Code, Cursor or Codex? See other assistants below.
What is Playwright CLI?
How to use Playwright CLI?
Key features of Playwright CLI
- ✓88 commands in SKILL.md across 11 groups: core, navigation, keyboard, mouse, save as, tabs, storage, emulation, network, DevTools and WebMCP
- ✓Compact snapshots with element refs (e15) instead of full accessibility trees
- ✓Cookies, localStorage, sessionStorage and saved storage state (state-save / state-load)
- ✓Request mocking (route, unroute), console and network inspection, tracing and video recording with chapters
- ✓Chrome, Firefox, WebKit or Edge, device emulation (--mobile, --device), or attach to a running Chrome/Edge via CDP or the Playwright extension
- ✓10 reference guides, including test generation, request mocking, storage state, tracing, video recording and PR attachments
When to use Playwright CLI
- 1Having an agent test a web app flow and screenshot each result
- 2Generating Playwright test code from recorded actions
- 3Mocking an API response while checking a UI
- 4Saving a logged-in state once and reusing it across runs
Installation & Setup Guide
Agent Rules / Prompt SetupFollow these steps (taken from the project's own docs) to configure Playwright CLI in your development environment.
npm install -g @playwright/cli@latest
Documented in the README; check with playwright-cli --help.
playwright-cli install --skills
The README says Claude Code, GitHub Copilot and others use the locally installed skills. Per the CLI's skillCheck.js this writes .claude/skills/playwright-cli/ in the current folder.
The README gives no Cursor install, so we do not list one.
Usage Example & Verification
1) README example (Demo): "Use playwright skills to test https://demo.playwright.dev/todomvc/. Take screenshots for all successful and failing scenarios." -> What happens: the agent runs playwright-cli open, types todo items and presses Enter, checks the snapshot after each step, and saves a screenshot per scenario. The browser is headless unless you ask for --headed. 2) README example (Skills-less operation): "Test the 'add todo' flow on https://demo.playwright.dev/todomvc using playwright-cli. Check playwright-cli --help for available commands." -> What happens: the same task without the skill installed; the README says the agent learns the commands from --help. Useful to compare how much the skill helps. 3) Our example: "Log in to my staging site once, save the session to auth.json, then check the settings page with it." -> What happens: open with --headed so you can log in, state-save auth.json, later state-load auth.json and goto the settings page. references/storage-state.md says never to commit such files: they hold your cookies and tokens.
In Antigravity: Antigravity 2.0 app: start a new conversation and ask "What skills do you have?" (the app has no /skills command; typing / and the skill name also finds it, sometimes only after your first message). Antigravity CLI: run /skills; in a session that was already open, run /skills reload first. playwright-cli should be listed. Then ask "use playwright-cli to open https://demo.playwright.dev/todomvc/ and add a todo called Test"; the agent should run playwright-cli commands and report the snapshot.
Security Review
Static reviewInstruction-only skill for Microsoft's playwright-cli; it can open any site, run page JavaScript and save your browser session to disk, but needs no API key.
Full review: scope, findings, risks
Static review at commit b1a5903. skills/playwright-cli/SKILL.md declares allowed-tools: Bash(playwright-cli:*) Bash(npx playwright:*) Bash(npx --no-install playwright:*), and the folder has only Markdown files. Documented commands open any URL, run JavaScript in the page with eval and run-code (references/running-code.md: isolated context, no require or process, but fetch, timers and crypto are available), and upload local files. state-save writes cookies and storage to a JSON file; references/storage-state.md says never to commit it. attach --cdp=chrome or --extension=chrome connects to a browser you already use. SKILL.md tells the agent to treat WebMCP tool names, schemas and results from a page as untrusted input. playwright-cli.js, the CLI entry point, spawns npm view @playwright/cli version --json through a shell (1.5 s timeout) at most once a day, only for the open, attach, list, install and install-browser commands (skipped with NO_UPDATE_NOTIFIER or CI); at b85c7a7 it fetched https://registry.npmjs.org/@playwright/cli/latest directly instead and caches the check in Playwright's registry folder; skillCheck.js only reads SKILL.md files and prints a notice when they differ from the bundled copy. No environment variables or API keys are required; PLAYWRIGHT_CLI_SESSION optionally names a session.
Operational Notes & Known Limitations
Known Limitations
- •Needs Node.js 18 or newer and the @playwright/cli package; the skill only teaches the commands
- •Headless by default; a headless session closes after an hour without commands (references/session-management.md)
- •The browser profile is in memory unless you pass --persistent or --profile; persistent profiles and state-save files keep cookies on disk
- •run-code runs in an isolated context without require, process or Node modules, but fetch is available (references/running-code.md)
- •On Windows, URLs with & must be escaped (^& in cmd.exe, --% in PowerShell), per SKILL.md
- •The README names Claude Code and GitHub Copilot, not Antigravity or Cursor
- •At b1a5903 the CLI asks npm for the latest version (it runs npm view @playwright/cli version through a shell, 1.5 s timeout) at most once a day and only on open, attach, list, install and install-browser, unless NO_UPDATE_NOTIFIER or CI is set (playwright-cli.js)
Frequently Asked Questions
Is the playwright-cli skill safe?
The skill is 11 Markdown files with no scripts. The CLI it drives opens any URL, runs JavaScript in pages (eval, run-code), can upload local files and saves cookies with state-save. WebMCP tools offered by a page are untrusted input, as SKILL.md itself says. No API key is needed.
How do I install playwright-cli in Antigravity?
npm install -g @playwright/cli@latest, then run playwright-cli install --skills=agents in your project (writes .agents/skills/playwright-cli/), or copy skills/playwright-cli from GitHub there. Then ask "What skills do you have?" (Antigravity CLI: /skills).
Is this the same as Playwright MCP?
No. The README says coding agents increasingly prefer CLI commands plus skills over MCP because they avoid loading large tool schemas and accessibility trees into context; playwright-cli prints short snapshots with element refs instead.
Should I copy the skill from GitHub or use install --skills?
install --skills copies the SKILL.md bundled in your installed playwright-core, so it matches your CLI version. The GitHub folder is regenerated from that bundle by scripts/update.js and can be ahead of or behind your CLI.
Supported Platforms
Keep exploring this topic
Browse the full Antigravity skills directory for more source-linked skills with install steps and static safety reviews.
Related Skills
Agent Browser
@vercel-labs
Vercel Labs' agent-browser skill: a native Rust CLI that lets AI agents drive Chrome via CDP with accessibility snapshots and @eN element refs.
Browser Use
@browser-use
Official Browser Use skill: lets AI agents control your local Chrome (or a Browser Use Cloud browser) over CDP through the browser-use CLI.
TDD Workflow
@sickn33
Community skill that makes an agent work test-first: one failing behavioural test, minimal code to pass, then refactor, with a separate guide on mock anti-patterns.
Popular Skills
View All →Agent Manager
@sickn33
Manage multiple local CLI agents via tmux sessions.
Systematic Debugging
@sickn33
Debug systematically, not randomly. Find and fix bugs methodically.
Browser Automation (Playwright)
@sickn33
Expert browser automation for cleaning scraping and reliable testing.