
Init
Bootstrap Playwright E2E testing in an existing web project with config, folders, sample test, and CI workflow.
Overview
Init is an agent skill for the Ship phase that sets up Playwright E2E tests, config, and CI-oriented defaults in an existing project.
Install
npx skills add https://github.com/alirezarezvani/claude-skills --skill initWhat is this skill?
- Detects React, Next.js, Vue, Angular, or Svelte from package.json
- Installs Playwright and generates framework-aware playwright.config
- Creates e2e folder structure, example test, and optional GitHub Actions workflow
- Chooses TypeScript vs JavaScript based on tsconfig presence
- 5 setup steps (analyze project, install, config, structure, CI)
Adoption & trust: 1.6k installs on skills.sh; 17.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have a web app but no browser test runner, config, or CI hook to catch regressions before deploy.
Who is it for?
Indie developers adding first-class E2E coverage to React or Next.js repos without hand-rolling boilerplate.
Skip if: Projects that already have full Playwright suites or teams needing only unit or API test setup.
When should I use this skill?
Use when the user says set up playwright, add e2e tests, configure playwright, testing setup, init playwright, or add test infrastructure.
What do I get? / Deliverables
You get installed Playwright dependencies, an e2e directory, framework-matched config, a sample test, and optional workflow scaffolding to run tests locally and in CI.
- playwright.config.ts or .js
- e2e folder with example spec
- Optional CI workflow for Playwright runs
Recommended Skills
Journey fit
E2E infrastructure is added when you are ready to gate quality before release, which maps to the ship phase even though it touches the codebase. Testing is the canonical shelf because the skill installs @playwright/test, config, and example specs rather than product features.
How it compares
Project bootstrap for Playwright, not a flaky-test debugger or visual regression platform.
Common Questions / FAQ
Who is init for?
Solo builders on modern frontend frameworks who want Playwright installed with sensible defaults in one guided pass.
When should I use init?
Use it in Ship when adding e2e tests before launch, or late in Build when hardening a MVP before the first production deploy.
Is init safe to install?
It may run npm install and write config files; review the Security Audits panel on this page before installing any skill from the catalog.
SKILL.md
READMESKILL.md - Init
# 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 alread