Scaffolds playwright.config.ts with multi-project setup, reporters, retries, webServer block, and base URL. Adapts to detected framework and enabled test types.
How this skill is triggered — by the user, by Claude, or both
Slash command
/playwright-coding-agent:playwright-config-generatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generates or updates `playwright.config.ts` in the workspace root with a production-ready multi-project configuration tailored to the detected framework and enabled test types.
Generates or updates playwright.config.ts in the workspace root with a production-ready multi-project configuration tailored to the detected framework and enabled test types.
This skill runs when:
/playwright-init command — user initializes Playwright agent for the first timeplaywright.config.ts does not exist — scaffolding a new projectplaywright.config.ts exists but is incomplete — user explicitly requests regeneration with --update-configDo not overwrite an existing, complete configuration unless explicitly requested. If the file exists and appears intentional, warn the user before modifying.
Generate playwright.config.ts with the following structure. Adapt each section based on resolved config:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 1,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html', { outputFolder: 'playwright-report' }],
['junit', { outputFile: 'test-results/junit.xml' }],
['list']
],
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
trace: 'on-first-retry',
},
webServer: {
command: 'next dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
projects: [
{
name: 'setup',
testMatch: '**/*(@|.)setup.ts',
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
dependencies: ['setup'],
testIgnore: '**/*.api.ts',
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
dependencies: ['setup'],
testIgnore: '**/*.api.ts',
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
dependencies: ['setup'],
testIgnore: '**/*.api.ts',
},
{
name: 'api',
use: {},
testMatch: '**/*.api.ts',
},
{
name: 'visual',
use: { ...devices['Desktop Chrome'] },
testMatch: '**/*.visual.ts',
},
],
});
testDir: Always './tests' (or per config override).
fullyParallel: true by default (run all tests in parallel within a project).
forbidOnly: !!process.env.CI — prevent committed .only tests in CI.
retries:
workers:
undefined (auto-detect CPU cores)1 (sequential for deterministic results)reporter: Always include:
html — interactive report at playwright-report/junit — CI integration at test-results/junit.xmllist — console outputuse.baseURL: Default http://localhost:3000. Override per env var BASE_URL.
use.trace: 'on-first-retry' — capture traces on first test retry for debugging.
webServer: Auto-configured based on detected framework (see framework-detection skill). Omit if test type is api only.
Configure projects for each enabled test type:
| Project | Test Match | Browsers | Dependencies | Skip Pattern |
|---|---|---|---|---|
| setup | **/*(@|.)setup.ts | N/A | None | N/A |
| chromium | **/*.ts (default) | Chrome | setup | **/*.api.ts, **/*.visual.ts |
| firefox | **/*.ts (default) | Firefox | setup | **/*.api.ts, **/*.visual.ts |
| webkit | **/*.ts (default) | Safari | setup | **/*.api.ts, **/*.visual.ts |
| api | **/*.api.ts | None | None | e2e patterns |
| visual | **/*.visual.ts | Chrome (single) | setup | api patterns |
Setup project: Runs authentication or data setup once per session. All browser projects depend on it (dependencies: ['setup']).
Browser projects: Chromium, Firefox, WebKit for e2e tests. Depend on setup. Ignore API and visual tests.
API project: No browser required; uses request fixture. Ignore e2e patterns.
Visual project: Single browser (Chromium) for deterministic snapshots. Depends on setup.
Adapt the template based on detected context:
Detected TypeScript (.ts files, tsconfig.json present):
playwright.config.tsDetected JavaScript (.js files only, no TypeScript):
playwright.config.jsmodule.exports = defineConfig({ ... })Example: If only e2e is enabled, omit the api and visual projects entirely.
{ command: 'next dev', url: 'http://localhost:3000', ... }{ command: 'ng serve', url: 'http://localhost:4200', ... }{ command: 'nuxt dev', url: 'http://localhost:3000', ... }webServer block entirely (user starts server manually)webServer.url or detected framework defaultsbaseURL in resolved configWrite the generated config file to workspace root as playwright.config.ts or playwright.config.js (based on detected language).
Report completion:
playwright.config.ts generated successfully.
- Projects: chromium, firefox, webkit (e2e), api, visual
- WebServer: next dev on http://localhost:3000
- Reporters: html, junit, list
- Retries: 2 in CI, 1 locally
If overwriting an existing file, report:
playwright.config.ts updated. Backup saved to playwright.config.ts.bak.
Emit structured metadata:
{
"filePath": "./playwright.config.ts",
"language": "typescript",
"projects": ["setup", "chromium", "firefox", "webkit", "api", "visual"],
"webServer": {
"command": "next dev",
"url": "http://localhost:3000"
},
"baseURL": "http://localhost:3000",
"reporters": ["html", "junit", "list"],
"retries": {
"local": 1,
"ci": 2
}
}
npx claudepluginhub gagandeepp/software-agent-teams --plugin playwright-coding-agentCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.