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
npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a claude-codeWhat 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-testidto 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-testidvalues 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-code2Manually: put the files in place
~/.claude/skills/frontend/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/frontend/
1Skills CLI (Vercel)
npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a codex2Manually: put the files in place
.agents/skills/frontend/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a cursor2Manually: put the files in place
.cursor/skills/frontend/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install testdino-hq/playwright-skill frontend2Manually: put the files in place
.github/skills/frontend/SKILL.md1Skills CLI (Vercel)
npx skills add testdino-hq/playwright-skill --skill playwright-frontend -a gemini-cli2Platform CLI
gemini skills install https://github.com/testdino-hq/playwright-skill --path frontendManually: put the files in place
.devin/skills/frontend/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add testdino-hq/playwright-skill --skill playwright-frontend -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-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