Init playwright

From X-School-Academy/skill-pilot · View interactive version

Init playwright is an AI agent skill from the GitHub repository X-School-Academy/skill-pilot. Initialize and verify AI Agent for web browser setup with Chrome for browser automation.

How to use this skill

Skill file

Init Playwright CLI

Verify that playwright-cli, Chrome, and the Playwright MCP Bridge extension are ready

before any browser automation is attempted.

When to Use This Skill

Your Roles in This Skill

Role Communication

As an expert in your assigned roles, you must announce your actions before performing them using the following format:

As a {Role, and Role-XYZ if you have more roles}, I will {action description}

Other Agent Skills Required

Workflow Usage Requirement

When this skill is used in a workflow agent node:

Instructions

Step 1: Check if playwright-cli is installed

playwright-cli --version

If the command is not found:

pnpm install -g @playwright/cli@latest
playwright-cli --version

Step 2: Test browser + extension bridge

playwright-cli open --extension --headed

Treat this as an initialization flow, not a blocking foreground command:

Interpret the result as follows:

Step 3: Check any errors

If you get an error that Chrome is not installed

pnpm exec playwright install chrome # install the official branded Google Chrome browser

Once Chrome is installed, go to Step 2 and test the browser + extension bridge.

If the Chrome extension is not installed:

Ask the user to open Chrome and install the Playwright MCP Bridge extension using the URL below:

https://chromewebstore.google.com/detail/playwright-mcp-bridge/mmlmfjhmonkocbjadbfplnigmagldckm

Ask the user to confirm once the installation is complete, then go to Step 2 and test the browser + extension bridge.

If the extension is ready and waiting for authentication, give the user two options:

  1. Ask the user to copy and paste the token, then save it for automatic authentication.
  2. Ask the user to click the connect button for one-time approval.

The token format shown on the Chrome extension screen is:

PLAYWRIGHT_MCP_EXTENSION_TOKEN=xxxxxxxx_xxxxxxx_xxx_xxxxxxxxxxxxxxxxxxxxxx

If the user provides a token, kill the background playwright-cli open --extension --headed process, then verify it without saving anything:

PLAYWRIGHT_MCP_EXTENSION_TOKEN=token-string playwright-cli open --extension --headed

The verification is successful only if the command responds immediately with text like:

Browser `default` opened with pid 44554.

If verification succeeds, use the keys-safe-guard skill to save PLAYWRIGHT_MCP_EXTENSION_TOKEN into config/.env.

Otherwise, the command will return Extension connection timeout. Make sure the "Playwright MCP Bridge" extension is installed., but the user sees Invalid token provided in the web browser.

In this case, ask the user to check the web browser if it shows the message Invalid token provided.

If it is showing Invalid token provided, issue another command without the token:

playwright-cli open --extension --headed

Then tell the user the token is invalid and ask for a new token.

If the user does not want to paste a token, tell them they can manually approve the extension each time browser automation starts.

Or the user can set the PLAYWRIGHT_MCP_EXTENSION_TOKEN token in config/.env manually, then restart the service with the shell command core/bin/tool-cli engine-reload, and refresh the webui to restart the task afterward.

Until the command below gets the correct response, then go to Step 4.

PLAYWRIGHT_MCP_EXTENSION_TOKEN=token-string playwright-cli open --extension --headed

Step 4: Report result of the browser opened

playwright-cli list

The output should be:

### Browsers
- default:
  - status: open
  - browser-type: chrome
  - user-data-dir: <in-memory>
  - headed: true

Output result as plain text, say "Default Google Chrome has been opened and is ready to use. Open any web URL using: playwright-cli goto URL by agent skill playwright-cli." If the user asked to save it to a file, write it there.

Output

Plain text result shown to user (example):

Playwright CLI: ready
Chrome: Opened and ready to use
MCP Bridge extension: connected
Token setup: verified and saved with keys-safe-guard, or manual approval required
Open any web URL using: `playwright-cli goto URL` by agent skill `playwright-cli`

If the user requested file output, write the same content to the specified path.

Common Issues

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.