A developer published a small collection of Playwright skills on DEV.to this week, aimed at fixing a problem that's becoming increasingly common as AI coding assistants proliferate in development workflows: agents that write tests you'd immediately reject in code review. The project provides guidance patterns that reshape how these assistants approach browser automation.
The Real Problem With Agent-Written Tests
Without explicit instruction, coding agents default to the path of least resistance when writing end-to-end tests. They grab CSS selectors like await page.click('.btn-login-submit') and paper over timing issues with arbitrary delays—await page.waitForTimeout(2000) being a notorious example. These patterns work in isolation but crumble under real-world conditions: class names change during refactors, network latency varies, and tests that seemed stable suddenly flake in CI pipelines. The author describes this as a workflow bottleneck. Rather than manually correcting test after test, they invested upfront time creating skills that encode their testing philosophy directly into the agent's behavioral patterns. The result is fewer review cycles and more PRs merged on first pass.
What These Skills Actually Do
The skill set nudges agents toward semantic locators instead of implementation details. Instead of targeting .btn-login-submit, agents trained on these patterns reach for page.getByRole('button', { name: 'Submit' }). This shift has cascading benefits: role-based queries align with accessibility standards, survive CSS class renaming, and make tests self-documenting about the UI's intended behavior rather than its current implementation. The skills also discourage arbitrary timeout usage in favor of proper wait strategies—waiting for elements to reach specific states rather than guessing how long operations should take. This approach handles variable network conditions gracefully without introducing artificial delays that slow down test suites unnecessarily.
Why Developer Experience Matters Here
This project reflects a broader shift in how developers manage AI tooling. Early adopters often treat coding agents like interns: give them vague instructions, then spend time fixing their output. The more mature approach is to invest in better onboarding—skills, documentation, and guardrails that align agent behavior with team standards from the start. The author notes these skills benefit themselves as much as any AI assistant. When working across multiple projects or returning to a codebase after context has faded, having codified testing patterns ensures consistency even without an active agent session running.
Key Takeaways
- CSS selectors tied to class names create fragile tests that break on UI refactors
- Arbitrary timeout waits (
waitForTimeout) mask timing issues rather than solving them - Semantic role-based locators align tests with accessibility and make intent clear
- Investing in agent skills reduces review cycles more than correcting outputs manually
The Bottom Line
If you're using coding agents for test automation, stop hoping they'll guess your preferences—teach them. This developer's skill set is a practical template for anyone tired of rejecting waitForTimeout(2000) in their reviews.