skills/playwright-best-practices/SKILL.md
Playwright E2E test conventions for this project — AAA pattern, translation-aware selectors, mock auth, staging DB sessions, two-user flows, debugging, and CI setup. Use when authoring or editing any Playwright spec, test helper, or E2E configuration. Do NOT use for unit tests or hook tests — load unit-test-best-practices instead.
npx skillsauth add bkinsey808/songshare-effect playwright-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Requires: file-read, terminal. No network access needed.
Full reference: /docs/testing/playwright-best-practices.md
docs/ai/rules.md for repo-wide constraints.AAA pattern — every test must have // Arrange, // Act, // Assert comments. For multi-step flows, use inline phase comments rather than collapsing everything.
→ full detail
Translation-aware selectors — use data-testid and semantic data-* attributes; never assert on translated text strings.
→ full detail
Mock auth before navigation — call authenticateTestUser(page) before page.goto(); never after.
→ full detail
Separate contexts for multiple users — use browser.newContext() per user; never share a context.
→ full detail
Web-first assertions — use await expect(...).toBeVisible() with a timeout; never waitForTimeout.
→ full detail
Real sessions for Realtime/RLS tests — use storageState with pre-signed cookies instead of mocking /api/me when tests need actual DB rows or Supabase Realtime.
→ full detail
Session expiry — JWT expires after 7 days; re-run the matching e2e:create-session:* command when you see 401 Not authenticated.
→ full detail
Single-spec debugging — use test:e2e:dev:staging-db:file -- <spec> --project=chromium to isolate failures before broadening.
→ full detail
Write code changes directly. After edits, output a brief bullet list of which conventions were applied and which validation commands were run.
npm run lint fails after changes, report verbatim and fix before declaring success.e2e:create-session:* command rather than attempting to fix it in code.npm run lint
unit-test-best-practices or unit-test-hook-best-practices.typescript-best-practices.tools
Zustand state management patterns for this project — store creation, selectors, Immer middleware, async actions with loading states, devtools, persist, and testing. Use when authoring or editing Zustand stores (use*Store files) or components that subscribe to stores. Do NOT use for React component structure or TypeScript-only utilities.
testing
How to write, update, or split skill files in this repo. Use when creating a new SKILL.md, updating an existing one, or deciding whether to put content in a skill vs. docs/.
development
Complete guide for testing React hooks — renderHook, Documentation by Harness, installStore, fixtures, subscription patterns, lint/compiler traps, and pre-completion checklist. Read docs/testing/unit-test-hook-best-practices.md for the full reference.
development
Vitest unit test authoring for this repo — setup, mocking, API handler testing, and common pitfalls for non-hook code. Use when the user asks to add, update, fix, or review unit tests for utilities, components, API handlers, or scripts. Do NOT use for React hook tests — load unit-test-hook-best-practices instead.