playwright-codegen-stabilizer
Installation
SKILL.md
Playwright Codegen Stabilizer
Convert codegen output into “production automation”: resilient locators, centralized configuration, deterministic waits, and failure artifacts that let an AI fix breakage quickly with minimal code churn.
Core Principles
- Treat codegen output as a recording, not the final script.
- Prefer intent-based locators (
get_by_role,get_by_label,get_by_test_id) over brittle CSS/XPath. - Make changes config-first: move selectors, timeouts, URLs, and text tokens into a config file so most breakages become config edits.
- Eliminate
sleep-style timing: replace with contracts (assertions /expect(...)) and event-based waits. - When something breaks, always capture artifacts (trace + screenshot + HTML + accessibility snapshot) so fixes are data-driven.
Workflow (Use This Every Time)
- Reproduce the failure
- Run the script once as-is to identify the failing step.
- Record: failing action, expected state, actual state, URL, and whether a popup/new tab/dialog is involved.