Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill playwright-cursor-rules -a claude-code
Open on GitHub

What 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 getByRole for 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-code

2Manually: put the files in place

~/.claude/skills/playwright-cursor-rules/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/playwright-cursor-rules/

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

Similar skills

All skills for Testing and QA →

From the same set247

The whole set →
aws-development aws-development — a skill that hands your agent AWS conventions: Lambda, CDK, SAM, DynamoDB, IAM, and serverless architecture built with Infrastructure as Code. CX Codex +1 741installs supabase-development supabase-development gives the agent a working set of Supabase rules: schema design, RLS policies, auth, realtime subscriptions and Edge Functions. CX Codex +1 740installs auth0-authentication auth0-authentication — a skill that gives your coding agent Auth0 guidelines: auth flows, Actions, token validation and redirect safety. CX Codex +1 740installs monitoring-guidelines monitoring-guidelines — a skill providing guidelines for application and infrastructure monitoring, SLO burn rates, and symptom-based alerting strategies. CX Codex +1 739installs cloudflare-development cloudflare-development — a skill that hands your agent Cloudflare edge practices: Workers, Pages, KV, D1, R2 and Durable Objects. Useful when the agent writes worker code or edits wrangler.toml. CX Codex +1 737installs meta-prompt A skill with meta-prompting templates that critique model responses, walk through a solution path and give it a score. Handy when you need to check answer quality. CX Codex +1 736installs localization-l10n localization-l10n guides AI coding assistants through localization best practices. It helps configure translation files, regional Intl formatting, and RTL layouts. CX Codex +1 736installs less-best-practices The less-best-practices skill guides coding assistants on Less architecture, modular project layout, variable scales, and reusable mixins. Keep stylesheet specificity low and maintainable. CX Codex +1 734installs

Project sponsors

Companies that keep this analytics open