generate
alirezarezvani/claude-skills
Generate production-ready Playwright tests from user stories, URLs, or component names.
What is generate?
Generates Playwright e2e tests from feature descriptions, component paths, or URLs. Use when you need to write tests for a login flow, checkout process, form submission, or any other user behavior. The skill explores your codebase, applies matching templates, and produces tests following your project's conventions.
- Parses user stories and component paths to identify what to test
- Explores playwright.config.ts, existing tests, and page objects to understand project patterns
- Selects and adapts templates for auth, CRUD, checkout, search, forms, dashboards, and more
- Generates tests using web-first locators (getByRole, getByLabel, getByText) with auto-retry assertions
- Creates supporting page objects, fixtures, and test data files when needed
- Runs generated tests and reports coverage
How to install generate
npx skills add https://github.com/alirezarezvani/claude-skills --skill generate- Playwright installed and configured (playwright.config.ts present)
- A codebase with components, pages, or URLs to test
- Optionally: existing test patterns, page objects, or fixtures to match
How to use generate
- 1.Describe what you want to test (e.g., 'write tests for the login page', 'test the checkout flow', or provide a component path)
- 2.The skill reads your playwright.config.ts and existing tests to understand conventions
- 3.It loads a matching template (auth, CRUD, forms, etc.) and adapts it to your app
- 4.Generated test file is created in your testDir with proper imports and locators
- 5.Run the test with npx playwright test <file> to verify it passes
Use cases
- Write e2e tests for a login flow with email and password
- Generate tests for a checkout or payment process
- Create tests for a search page with filters and sorting
- Test a form submission with validation and error handling
- Generate accessibility tests for a component or page
- QA engineers writing Playwright tests
- Full-stack developers adding test coverage to features
- Teams adopting e2e testing practices
- Projects using TypeScript or JavaScript with Playwright
generate FAQ
The skill adapts the closest matching template and uses your codebase patterns. If no template fits, it generates a test from scratch following Playwright best practices.
Yes. The skill explores your project structure, detects page objects in pages/ and fixtures in fixtures/, and imports them automatically.
Yes. There is an api/ template for testing API endpoints directly with Playwright's request context.
It uses getByRole() first, then getByLabel(), getByText(), getByPlaceholder(), and getByTestId() only as a fallback.
Yes. It checks for auth.setup.ts or storageState config and reuses your auth setup in generated tests.
Full instructions (SKILL.md)
Source of truth, from alirezarezvani/claude-skills.
name: "generate" description: >- Generate Playwright tests. Use when user says "write tests", "generate tests", "add tests for", "test this component", "e2e test", "create test for", "test this page", or "test this feature".
Generate Playwright Tests
Generate production-ready Playwright tests from a user story, URL, component name, or feature description.
Input
$ARGUMENTS contains what to test. Examples:
"user can log in with email and password""the checkout flow""src/components/UserProfile.tsx""the search page with filters"
Steps
1. Understand the Target
Parse $ARGUMENTS to determine:
- User story: Extract the behavior to verify
- Component path: Read the component source code
- Page/URL: Identify the route and its elements
- Feature name: Map to relevant app areas
2. Explore the Codebase
Use the Explore subagent to gather context:
- Read
playwright.config.tsfortestDir,baseURL,projects - Check existing tests in
testDirfor patterns, fixtures, and conventions - If a component path is given, read the component to understand its props, states, and interactions
- Check for existing page objects in
pages/ - Check for existing fixtures in
fixtures/ - Check for auth setup (
auth.setup.tsorstorageStateconfig)
3. Select Templates
Check templates/ in this plugin for matching patterns:
| If testing... | Load template from |
|---|---|
| Login/auth flow | ../pw/templates/auth/login.md |
| CRUD operations | templates/crud/ |
| Checkout/payment | templates/checkout/ |
| Search/filter UI | templates/search/ |
| Form submission | templates/forms/ |
| Dashboard/data | templates/dashboard/ |
| Settings page | templates/settings/ |
| Onboarding flow | templates/onboarding/ |
| API endpoints | templates/api/ |
| Accessibility | templates/accessibility/ |
Adapt the template to the specific app — replace {{placeholders}} with actual selectors, URLs, and data.
4. Generate the Test
Follow these rules:
Structure:
import { test, expect } from '@playwright/test';
// Import custom fixtures if the project uses them
test.describe('Feature Name', () => {
// Group related behaviors
test('should <expected behavior>', async ({ page }) => {
// Arrange: navigate, set up state
// Act: perform user action
// Assert: verify outcome
});
});
Locator priority (use the first that works):
getByRole()— buttons, links, headings, form elementsgetByLabel()— form fields with labelsgetByText()— non-interactive text contentgetByPlaceholder()— inputs with placeholder textgetByTestId()— when semantic options aren't available
Assertions — always web-first:
// GOOD — auto-retries
await expect(page.getByRole('heading')).toBeVisible();
await expect(page.getByRole('alert')).toHaveText('Success');
// BAD — no retry
const text = await page.textContent('.msg');
expect(text).toBe('Success');
Never use:
page.waitForTimeout()page.$(selector)orpage.$$(selector)- Bare CSS selectors unless absolutely necessary
page.evaluate()for things locators can do
Always include:
- Descriptive test names that explain the behavior
- Error/edge case tests alongside happy path
- Proper
awaiton every Playwright call baseURL-relative navigation (page.goto('/')notpage.goto('http://...'))
5. Match Project Conventions
- If project uses TypeScript → generate
.spec.ts - If project uses JavaScript → generate
.spec.jswithrequire()imports - If project has page objects → use them instead of inline locators
- If project has custom fixtures → import and use them
- If project has a test data directory → create test data files there
6. Generate Supporting Files (If Needed)
- Page object: If the test touches 5+ unique locators on one page, create a page object
- Fixture: If the test needs shared setup (auth, data), create or extend a fixture
- Test data: If the test uses structured data, create a JSON file in
test-data/
7. Verify
Run the generated test:
npx playwright test <generated-file> --reporter=list
If it fails:
- Read the error
- Fix the test (not the app)
- Run again
- If it's an app issue, report it to the user
Output
- Generated test file(s) with path
- Any supporting files created (page objects, fixtures, data)
- Test run result
- Coverage note: what behaviors are now tested
Related skills
More from alirezarezvani/claude-skills and the wider catalog.

grill-me
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

hard-call
Framework for irreversible decisions with no good options—use 10/10/10, reversibility test, and regret minimization.

information-security-manager-iso27001
ISO 27001 ISMS implementation and cybersecurity governance for HealthTech and MedTech companies. Use when designing an ISMS, running security risk assessments, implementing controls, pursuing ISO 27001 certification, preparing security audits, responding to security incidents, or verifying compliance. Covers ISO 27001, ISO 27002, healthcare security, and medical device cybersecurity.

init
Set up production-ready Playwright testing with framework detection, config generation, and CI workflow.

interview-system-designer
This skill should be used when the user asks to "design interview processes", "create hiring pipelines", "calibrate interview loops", "generate interview questions", "design competency matrices", "analyze interviewer bias", "create scoring rubrics", "build question banks", or "optimize hiring systems". Use for designing role-specific interview loops, competency assessments, and hiring calibration systems.

isms-audit-expert
Information Security Management System (ISMS) audit expert for ISO 27001 compliance verification, security control assessment, and certification support. Use when the user mentions ISO 27001, ISMS audit, Annex A controls, Statement of Applicability (SOA), gap analysis, nonconformity management, internal audit, surveillance audit, or security certification preparation. Helps review control implementation evidence, document audit findings, classify nonconformities, generate risk-based audit plans, map controls to Annex A requirements, prepare Stage 1 and Stage 2 audit documentation, and support corrective action workflows.