Skip to main content
skill CX Codex

playwright-frontend — Claude Code skill: what it does, how to install

playwright-frontend is a Claude Code skill that helps make UI components locatable by Playwright tests and AI agents. It applies while writing or reviewing components.

MIT 426 installs ★ 422 updated 2026-10-12

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

What playwright-frontend does

playwright-frontend guides UI markup for test automation and agent-driven element lookup. Start with semantic HTML and accessible names; add data-testid when roles, labels, and visible text cannot identify an element reliably.

The skill covers naming and uniqueness rules, plus stable domain keys for list items instead of array indexes. Framework examples cover React, Vue, Angular, and Svelte, including centralized IDs and production stripping. Renaming a data-testid already used by a test or agent breaks that dependency.

What it helps with

  • choose a locator for a UI component
  • add data-testid to a custom widget
  • give list items stable, distinct test IDs
  • review component markup before writing tests

Example prompts for the agent

  • Mark up this form component so Playwright can find fields by their accessible labels.
  • Review this list component and suggest stable data-testid values for its rows.
  • Add locators for this widget where roles and text cannot identify it reliably.

How to install playwright-frontend

1Skills CLI (Vercel)

npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a claude-code

2Manually: put the files in place

~/.claude/skills/frontend/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/frontend/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about playwright-frontend

How do I install playwright-frontend in Claude Code?

Run npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a claude-code. The skill file is at ~/.claude/skills/frontend/SKILL.md.

What does playwright-frontend do?

It explains how to mark up UI elements so tests and AI agents can locate them. The guidance prioritizes semantic markup and sets rules for data-testid.

How should data-testid values work for list items?

Use a stable domain key, such as user-row-${user.id}, rather than the array index. Keep the value independent of text, locale, styling, and DOM position.

Source text

SKILL.md · MIT
---
name: playwright-frontend
description: For frontend engineers authoring UI — how to make components reliably locatable by tests and AI agents. Covers the official Playwright locator priority, semantic/accessible markup first, and how to add valid, unique, stable `data-testid` attributes (naming convention, uniqueness in lists, stability rules) for React, Vue, Angular, and Svelte. Use when writing or reviewing components, or when an agent needs durable locators.
license: MIT
metadata:
  author: testdino.com
  version: "1.0.0"
---

# Playwright Frontend (Authoring Locatable Markup)

> Audience: **frontend engineers writing the app** — the counterpart to the test-author guides in `core/`. Your job here is to expose a small, stable, machine-readable contract on the DOM so tests *and* AI agents can locate elements deterministically, without flakiness.

A `data-testid` is a **public API for your UI's automation layer**: once a test or agent depends on it, renaming it is a breaking change. Build accessible markup first, then add deliberate, well-named, unique, stable test IDs where automation needs a durable handle.

## Guide Index

| Topic | Guide |
|---|---|
| `data-testid` conventions (when, naming, uniqueness, stability) | [data-testid-conventions.md](data-testid-conventions.md) |
| Framework patterns (React, Vue, Angular, Svelte) + centralizing IDs + production stripping | [examples.md](examples.md) |

## Golden Rules

1. **Semantic HTML first** — give elements a real role/label/accessible name so `getByRole`/`getByLabel` work; then add test IDs.
2. **Add `data-testid` only where role, label and text fall short** — no-role custom widgets, scope containers, list rows, and dynamic or localized regions. A control `getByRole` already finds uniquely needs none.
3. **Name for global uniqueness** — `feature-component-element[-variant]`, `kebab-case`.
4. **In lists, suffix with a stable domain key, never the array index** — `user-row-${user.id}` ✅ / `user-row-${index}` ❌.
5. **Decouple the value from text, locale, styling, and DOM position** — those change; the test ID must not.
6. **Standardize on one attribute** — `data-testid` is Playwright's default `testIdAttribute`; don't mix `data-test`/`data-qa`.

## Related

- [core/locators.md](../core/locators.md) / [core/locator-strategy.md](../core/locator-strategy.md) — the consumer side: choosing locators when *writing tests*.
- Playwright official docs: [Locators](https://playwright.dev/docs/locators), [Best Practices](https://playwright.dev/docs/best-practices).

© testdino.com · MIT · testdino-hq/playwright-skill

Similar skills

All skills for Frontend and UI →

From the same set8

playwright-skill Supplies the agent with 79 reference guides for Playwright 1.64 across TypeScript and JavaScript. Helps write tests, investigate CI failures, configure mocking, and stabilize flaky suites. CX Codex +1 6,200installs playwright-core playwright-core provides battle-tested Playwright patterns for E2E, API, and component tests in TypeScript and JavaScript. Helps debug flaky runs, configure fixtures, and structure test suites. CX Codex +1 1,100installs playwright-cli playwright-cli is a skill for controlling a browser from the terminal to test your own web apps, inspect pages, capture screenshots, and investigate failures. CX Codex +1 907installs playwright-pom playwright-pom — a skill that hands your coding agent two guides on Page Object Model in Playwright: how to structure page objects and when fixtures or helpers fit better. CX Codex +1 674installs playwright-ci playwright-ci — a skill with ready-made CI/CD configs for Playwright: GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins and Docker. Useful once the tests exist but the pipeline keeps failing. CX Codex +1 604installs playwright-qa playwright-qa organizes QA work around Playwright, from test design and failure triage to manual-case migration and test review. CX Codex +1 463installs playwright-migration playwright-migration is a Claude Code skill with step-by-step guides for moving test suites from Cypress and Selenium to Playwright, including command mappings and architecture adjustments. CX Codex +1 454installs

Project sponsors

Companies that keep this analytics open