Skip to main content
skill Claude Code

pw-init — Claude Code skill: what it does, how to install

Initializes Playwright e2e testing in web projects. It inspects your framework, generates a tailored config, creates e2e folder structures, and wires CI workflows.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add alirezarezvani/claude-skills
/plugin install pw@claude-code-skills
Open on GitHub

What pw-init does

The skill inspects your project using the Explore subagent. It scans package.json for Next.js, React with Vite, Vue, Nuxt, or Angular, checks whether TypeScript is configured, and verifies existing test setups. Then it installs @playwright/test alongside browser binaries and builds playwright.config.ts using the appropriate port for your local dev server.

Next, it creates the e2e/ folder with fixture directories, page object placeholders, and an initial test file. It registers npm scripts inside package.json for default, UI, and debug execution. When .github/workflows/ or .gitlab-ci.yml is present, the skill adds a testing workflow with report artifact preservation.

Before finishing, it executes npx playwright test to diagnose any startup failures right away. This is worth installing when bootstrapping end-to-end tests in a clean repository without manual configuration work.

What it helps with

  • install and configure Playwright based on the detected web framework
  • generate playwright.config.ts with matching local dev server settings
  • scaffold the e2e directory structure with a sample test and fixtures
  • set up GitHub Actions or GitLab CI workflows for browser tests

Example prompts for the agent

  • set up playwright
  • add e2e tests
  • configure playwright

How to install pw-init

1Plugin marketplace

/plugin marketplace add alirezarezvani/claude-skills
/plugin install pw@claude-code-skills

This installs the whole pw plugin with all its skills

2Skills CLI (Vercel)

npx skills add alirezarezvani/claude-skills --skill pw-init -a claude-code

3Manually: put the files in place

~/.claude/skills/pw-init/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pw-init/

From the same set349

The whole set →
engineering-skills Alireza Rezvani An engineering skill index for Claude Code that helps you select one specialist SKILL.md for the task at hand. It covers architecture, testing, DevOps, and data work. Claude Code 2,387installs finance-skills Alireza Rezvani Routes ambiguous finance prompts to the right bundled skill: financial-analyst, saas-metrics-coach, or month-end-close. Claude Code 2,312installs marketing-skills Alireza Rezvani A directory and router for marketing skills in Claude Code. It picks the right specialist skill for SEO, content, CRO, channels, and related tasks. Claude Code 2,264installs business-growth-skills Alireza Rezvani Routes growth and revenue prompts to the right specialized skill across customer success, sales engineering, RevOps, and proposals in Claude Code. Claude Code 2,189installs engineering-advanced-skills Alireza Rezvani An index of 37 engineering skills for architecture, automation, reliability, and platform work. Use it when a project needs task-specific engineering workflows. Claude Code 2,019installs product-skills Alireza Rezvani Product work orchestrator for Claude Code. Routes queries across 16 domain lanes and validates discovery trees with deterministic scripts. Claude Code 1,994installs pm-skills Alireza Rezvani Routes project-delivery requests across 8 PM sub-skills for Jira, Confluence, sprints, reporting, and team communication. Useful for controlled delivery work. Claude Code 1,975installs senior-backend Alireza Rezvani Scaffolds backend APIs, detects database bottlenecks, and runs load tests. Useful when designing Express routes, optimizing PostgreSQL, or preparing for production. Claude Code 1,674installs

Similar

android-performance official OpenAI Captures Simpleperf CPU profiles, Perfetto traces, and gfxinfo metrics via adb. Helps diagnose jank and heavy functions in Android apps. CX Codex GP ChatGPT 19installs testing-data-visualizations official OpenAI This skill establishes test strategies for charts, dashboards, and diagrams. It separates unit, component, visual regression, and E2E coverage without brittle pixel snapshots. CX Codex GP ChatGPT 18installs agent-browser-verify official Vercel Labs Checks a dev server page in the browser for loading issues, console errors, and missing UI elements. Use it to verify a running project before moving on. CX Codex GP ChatGPT 14installs design-qa official OpenAI A skill for side-by-side design and implementation comparison before handoff. Works with Figma, screenshots, and URLs; catches visual gaps in layout, typography, and interaction states. CX Codex GP ChatGPT 14installs microsoft-store-publisher official github Prepares Windows desktop apps for Microsoft Store publication, including MSIX checks, WACK validation, and Partner Center submission work. GitHub Copilot 3installs improve-codebase-architecture Matt Pocock This skill scans a codebase for architectural friction, then builds a visual HTML report with refactoring candidates. Use it before a deeper architecture review. Claude Code 1,163,035installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. Claude Code CX Codex Cursor +1 673,100installs tdd Matt Pocock Guides the red-green TDD loop: ensures tests are written first, keep them at public interfaces, and avoid coupling to implementation details. Claude Code 1,141,062installs

Questions about pw-init

How to install pw-init in Claude Code?

Run npx skills add alirezarezvani/claude-skills --skill pw-init -a claude-code or install it via /plugin marketplace add alirezarezvani/claude-skills.

What does pw-init do?

It installs Playwright, writes framework-specific test configurations, scaffolds the e2e/ folder with starter tests, and verifies the run using npx playwright test.

How does pw-init configure the webServer block?

It inspects package.json: Vite uses port 5173, Next.js or Nuxt use port 3000, and Angular defaults to port 4200. If no framework is detected, the block is omitted.

Source text

SKILL.md · MIT
---
name: "pw-init"
description: >-
  Set up Playwright in a project. Use when user says "set up playwright",
  "add e2e tests", "configure playwright", "testing setup", "init playwright",
  or "add test infrastructure".
---

# Initialize Playwright Project

Set up a production-ready Playwright testing environment. Detect the framework, generate config, folder structure, example test, and CI workflow.

## Steps

### 1. Analyze the Project

Use the `Explore` subagent to scan the project:

- Check `package.json` for framework (React, Next.js, Vue, Angular, Svelte)
- Check for `tsconfig.json` → use TypeScript; otherwise JavaScript
- Check if Playwright is already installed (`@playwright/test` in dependencies)
- Check for existing test directories (`tests/`, `e2e/`, `__tests__/`)
- Check for existing CI config (`.github/workflows/`, `.gitlab-ci.yml`)

### 2. Install Playwright

If not already installed:

```bash
npm init playwright@latest -- --quiet
```

Or if the user prefers manual setup:

```bash
npm install -D @playwright/test
npx playwright install --with-deps chromium
```

### 3. Generate `playwright.config.ts`

Adapt to the detected framework:

**Next.js:**
```typescript
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './e2e',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: [
    ['html', { open: 'never' }],
    ['list'],
  ],
  use: {
    baseURL: 'http://localhost:3000',
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
  },
  projects: [
    { name: "chromium", use: { ...devices['Desktop Chrome'] } },
    { name: "firefox", use: { ...devices['Desktop Firefox'] } },
    { name: "webkit", use: { ...devices['Desktop Safari'] } },
  ],
  webServer: {
    command: 'npm run dev',
    url: 'http://localhost:3000',
    reuseExistingServer: !process.env.CI,
  },
});
```

**React (Vite):**
- Change `baseURL` to `http://localhost:5173`
- Change `webServer.command` to `npm run dev`

**Vue/Nuxt:**
- Change `baseURL` to `http://localhost:3000`
- Change `webServer.command` to `npm run dev`

**Angular:**
- Change `baseURL` to `http://localhost:4200`
- Change `webServer.command` to `npm run start`

**No framework detected:**
- Omit `webServer` block
- Set `baseURL` from user input or leave as placeholder

### 4. Create Folder Structure

```
e2e/
├── fixtures/
│   └── index.ts          # Custom fixtures
├── pages/
│   └── .gitkeep          # Page object models
├── test-data/
│   └── .gitkeep          # Test data files
└── example.spec.ts       # First example test
```

### 5. Generate Example Test

```typescript
import { test, expect } from '@playwright/test';

test.describe('Homepage', () => {
  test('should load successfully', async ({ page }) => {
    await page.goto('/');
    await expect(page).toHaveTitle(/.+/);
  });

  test('should have visible navigation', async ({ page }) => {
    await page.goto('/');
    await expect(page.getByRole('navigation')).toBeVisible();
  });
});
```

### 6. Generate CI Workflow

If `.github/workflows/` exists, create `playwright.yml`:

```yaml
name: "playwright-tests"

on:
  push:
    branches: [main, dev]
  pull_request:
    branches: [main, dev]

jobs:
  test:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: lts/*
      - name: "install-dependencies"
        run: npm ci
      - name: "install-playwright-browsers"
        run: npx playwright install --with-deps
      - name: "run-playwright-tests"
        run: npx playwright test
      - uses: actions/upload-artifact@v4
        if: ${{ !cancelled() }}
        with:
          name: "playwright-report"
          path: playwright-report/
          retention-days: 30
```

If `.gitlab-ci.yml` exists, add a Playwright stage instead.

### 7. Update `.gitignore`

Append if not already present:

```
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
```

### 8. Add npm Scripts

Add to `package.json` scripts:

```json
{
  "test:e2e": "playwright test",
  "test:e2e:ui": "playwright test --ui",
  "test:e2e:debug": "playwright test --debug"
}
```

### 9. Verify Setup

Run the example test:

```bash
npx playwright test
```

Report the result. If it fails, diagnose and fix before completing.

## Output

Confirm what was created:
- Config file path and key settings
- Test directory and example test
- CI workflow (if applicable)
- npm scripts added
- How to run: `npx playwright test` or `npm run test:e2e`

© Alireza Rezvani · MIT · alirezarezvani/claude-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor