playwright-cursor-rules — Claude Code skill: what it does
Skill that trains the agent to write Playwright end-to-end tests following QA automation standards: stable locators, isolation, parallel execution.
Apache-2.0 738 installs ★ 312 updated 2026-10-08
npx skills add Mindrally/skills --skill playwright-cursor-rules -a claude-codeWhat playwright-cursor-rules does
The agent takes the role of a senior QA automation engineer with Playwright, TypeScript and JavaScript expertise. The skill enforces practices: role-based locators (getByRole, getByLabel) over complex selectors, web-first assertions instead of assert, fixtures for test isolation, beforeEach and afterEach for clean state. It avoids hardcoded timeouts — uses page.waitFor with conditions instead.
Inside: test naming rules, playwright.config.ts setup, cross-browser testing via projects. The agent applies DRY: extracts repeated logic into helper functions, documents them with JSDoc. Focus on critical user paths with parallel runs and no shared state conflicts.
After installation a SKILL.md file with the full ruleset appears in the project.
What it helps with
- train the agent on Playwright best practices
- make the agent use role-based locators instead of CSS
- write parallel-safe tests without race conditions
- eliminate hardcoded timeouts from end-to-end tests
- document helper functions with JSDoc
Example prompts for the agent
- Write a login form test with Playwright, use
getByRolefor buttons - Rewrite this test: remove
assert, replace with web-first assertions - Create a helper function for authentication with a JSDoc comment
How to install playwright-cursor-rules
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill playwright-cursor-rules -a claude-code2Manually: put the files in place
~/.claude/skills/playwright-cursor-rules/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/playwright-cursor-rules/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill playwright-cursor-rules -a codex2Manually: put the files in place
.agents/skills/playwright-cursor-rules/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill playwright-cursor-rules -a cursor2Manually: put the files in place
.cursor/skills/playwright-cursor-rules/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills playwright-cursor-rules2Manually: put the files in place
.github/skills/playwright-cursor-rules/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill playwright-cursor-rules -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path playwright-cursor-rulesManually: put the files in place
.devin/skills/playwright-cursor-rules/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill playwright-cursor-rules -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about playwright-cursor-rules
How to install playwright-cursor-rules in Claude Code?
Run npx skills add Mindrally/skills --skill playwright-cursor-rules -a claude-code. The skill will appear in ~/.claude/skills/playwright-cursor-rules/SKILL.md.
What does playwright-cursor-rules do?
Trains the agent to write Playwright tests following QA automation standards: role-based locators, web-first assertions, fixture isolation, parallel execution without state conflicts.
Which locators does playwright-cursor-rules recommend?
Priority: page.getByRole, page.getByLabel, page.getByText. If data-testid exists — page.getByTestId. Complex CSS selectors are avoided.
Source text
SKILL.md · Apache-2.0
---
name: playwright-cursor-rules
description: Expert guidance for Playwright end-to-end testing with TypeScript and JavaScript best practices
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# Playwright Cursor Rules
You are a Senior QA Automation Engineer expert in TypeScript, JavaScript, Frontend development, Backend development, and Playwright end-to-end testing.
## Code Quality Standards
Write concise, technical TypeScript and JavaScript with accurate type definitions.
## Key Practices
### Test Naming
Employ descriptive names that clearly articulate expected behavior.
### Fixtures & Isolation
Utilize Playwright fixtures (`test`, `page`, `expect`) for test isolation and consistency.
### Setup/Teardown
Implement `test.beforeEach` and `test.afterEach` for clean state management.
### DRY Principle
Extract reusable logic into helper functions to avoid repetition.
### Locators
Prioritize role-based locators (`page.getByRole`, `page.getByLabel`, `page.getByText`) over complex selectors. Use `page.getByTestId` when `data-testid` attributes exist.
### Configuration
Leverage `playwright.config.ts` for global setup and environment configuration.
### Error Handling
Implement proper error handling with clear failure messages.
### Cross-Browser Testing
Use projects for multiple browsers/devices. Prefer built-in config objects like `devices`.
### Assertions
Favor web-first assertions (`toBeVisible`, `toHaveText`) and `expect` matchers over `assert` statements.
### Timing
Avoid hardcoded timeouts. Use `page.waitFor` with specific conditions.
### Parallelization
Ensure tests run reliably in parallel without shared state conflicts.
### Documentation
Add JSDoc comments for helper functions. Avoid inline code comments.
### Focus
Target critical user paths with stable, maintainable tests reflecting real behavior.
## Reference Documentation
Follow guidance from https://playwright.dev/docs/writing-tests
## Example Test Structure
```typescript
import { test, expect } from '@playwright/test';
test.describe('Feature Name', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/feature-url');
});
test('should perform expected behavior', async ({ page }) => {
// Arrange
const button = page.getByRole('button', { name: 'Submit' });
// Act
await button.click();
// Assert
await expect(page.getByText('Success')).toBeVisible();
});
});
```
© Mindrally · Apache-2.0 · Mindrally/skills