# Init playwright

> Init playwright is an open-source agent skill for developer tools. Sets up Playwright test tooling and MCP browser drivers in a pnpm monorepo. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ruan-cat/monorepo/tree/main/ai-plugins/low-frequency-skill/skills/init-playwright
- **Repository:** https://github.com/ruan-cat/monorepo
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** init-playwright
- **Collection:** https://github.com/ruan-cat/monorepo
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill walks an agent through adding the Playwright toolchain to a pnpm monorepo: installing the test runner, the CLI and an MCP server, then wiring a root Playwright config, dev server ports, e2e and visual regression test layout, and generated AI skill files. It also records two environment pitfalls hit along the way, one involving a Prettier flag under Node 22 and one where a pnpm filter swallowed server arguments for the Vite dev server.

A large part of the content is a warning and troubleshooting guide about headless Chromium consuming high CPU when browser sessions stay alive during AI use. It explains the difference between persistent MCP browser sessions and one-off test runs, suggests preferring a headed browser for 3D dashboard pages, and lists emergency steps and a regression checklist for stray Chromium processes.

The workflow is written for Vue 3, Vite and TypeScript projects on Node 22 with Windows commands, and includes a memory-file template for CLAUDE.md, AGENTS.md or GEMINI.md.

## When your agent uses it

> 在 pnpm monorepo 初始化 Playwright 三件套（@playwright/test + @playwright/cli + playwright-mcp），含 e2e/视觉测试骨架、MCP 配置、AI skills 生成、AI 记忆更新。 内置无头浏览器 CPU 过载事故复盘与故障排查指南：可排查 headless 模式下的 高 CPU 占用（100%）、浏览器卡死、Chromium 进程残留无法退出、 大屏 3D WebGL 渲染性能问题；提供紧急止损步骤和长期回归检查清单。 当用户提及 playwright 初始化、大屏视觉测试、e2e 测试搭建、 playwright monorepo 配置、pw_core/pw_visual MCP 等时触发。 也适用于无头浏览器性能故障排查、headless CPU 100% 诊断、 Chromium 进程残留清理、浏览器进程无法退出处理、 大屏 3D 渲染性能调优等排查场景。

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ruan-cat/monorepo/tree/HEAD/ai-plugins/low-frequency-skill/skills/init-playwright)
- [License: MIT](https://github.com/ruan-cat/monorepo/tree/HEAD/ai-plugins/low-frequency-skill/skills/init-playwright)

## Features

- **Playwright toolchain install:** Adds the test runner, CLI and MCP server packages to a pnpm workspace and installs Chromium.
- **Root Playwright configuration:** Provides a shared config with test directories, screenshot baselines, reporters and a Vite web server.
- **Visual regression setup:** Organizes e2e and visual spec files, separates them from Vitest tests and commits screenshot baselines.
- **Headless CPU safety guidance:** Explains how persistent headless browser sessions can drive CPU load and how to manage them.
- **Browser process troubleshooting:** Lists symptoms, emergency steps and a checklist for finding and closing leftover Chromium processes.
- **Agent memory rule template:** Offers a short block of browser usage rules to paste into agent instruction files.

## Good for

- Set up Playwright e2e and visual tests in a pnpm monorepo
- Add Playwright MCP browser tools for an AI coding agent
- Configure a Vite dev server for Playwright's web server
- Diagnose a headless Chromium process that will not exit
- Write browser usage rules into CLAUDE.md or AGENTS.md

## Install

### Claude Code

This skill ships in the `low-frequency-skill` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ruan-cat/monorepo
/plugin install low-frequency-skill@ruan-cat-tools
```

Or copy only this skill to `~/.claude/skills/init-playwright`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/init-playwright &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/init-playwright" ~/.claude/skills/init-playwright &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/init-playwright` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/init-playwright` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/init-playwright &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/init-playwright" ~/.agents/skills/init-playwright &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/init-playwright` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/init-playwright` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/init-playwright &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/init-playwright" ~/.cursor/skills/init-playwright &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/init-playwright` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ruan-cat/monorepo.git --path ai-plugins/low-frequency-skill/skills/init-playwright
```

Or copy the folder to `~/.gemini/skills/init-playwright` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/init-playwright`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/init-playwright &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/init-playwright" ~/.copilot/skills/init-playwright &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/init-playwright` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ruan-cat/monorepo.git
```

Then copy `monorepo/ai-plugins/low-frequency-skill/skills/init-playwright` into your agent's skills folder as `init-playwright`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill install?

It installs @playwright/test, @playwright/cli and playwright-mcp as dev dependencies at the workspace root, then installs Chromium.

### Does Init playwright change how tests are named?

Yes. It separates Vitest unit tests using *.test.ts from Playwright tests using *.spec.ts, placing e2e and visual specs in their own folders.

### Which Node and operating system does Init playwright assume?

The workflow describes Node 22 on Windows and uses Windows commands such as tasklist and taskkill, with Linux and macOS alternatives listed as comments.

### Does Init playwright include any scripts?

No scripts are bundled with the skill. It provides instructions and code snippets for the agent to apply.

### How do I install Init playwright in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/init-playwright to use it in all your projects, or to .claude/skills/init-playwright in one project. Or install the low-frequency-skill plugin, which includes it: /plugin marketplace add ruan-cat/monorepo, then /plugin install low-frequency-skill@ruan-cat-tools.

### Does Init playwright run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Init playwright?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Init playwright?

The closest alternatives to Init playwright are Playwright, Webapp testing, Playwright skill, Playwright generate test and Playwright interactive.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Playwright](https://ai-powered.com/skills/playwright): Playwright is a free agent skill for browser automation.
- [Webapp testing](https://ai-powered.com/skills/webapp-testing-github): Webapp testing is an open-source agent skill for browser automation.
- [Playwright skill](https://ai-powered.com/skills/playwright-skill): Playwright skill is an open-source agent skill for browser automation.
- [Playwright generate test](https://ai-powered.com/skills/playwright-generate-test): Playwright generate test is an open-source agent skill for browser automation.
- [Playwright interactive](https://ai-powered.com/skills/playwright-interactive): Playwright interactive is a free agent skill for browser automation.
- [E2E testing](https://ai-powered.com/skills/e2e-testing-fmarzochi): E2E testing is an open-source agent skill for developer tools.
- [E2E testing](https://ai-powered.com/skills/e2e-testing): E2E testing is an open-source agent skill for developer tools.
- [Playwright E2E testing](https://ai-powered.com/skills/playwright-e2e-testing): Playwright E2E testing is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/init-playwright
