pw-review
它能做什么
这项技能让智能体对照常见错误清单检查你的浏览器测试文件。适合希望测试可靠、易于维护的开发者。
适用场景
- ✓当你刚编写了新的 Playwright 测试、想让它们接受检查的时候。
- ✓当你的浏览器测试经常失效、并怀疑测试习惯不佳的时候。
- ✓当你想在代码审查前对测试进行质量检查时。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/playwright-pro/skills/pw-review/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请审查我的 Playwright 测试,并告诉我哪些需要修改。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取你的配置和测试文件,然后对照反模式清单检查每个文件。结果会分为严重、警告和提示三个级别。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Review Playwright Tests
Systematically review Playwright test files for anti-patterns, missed best practices, and coverage gaps.
Input
$ARGUMENTS can be:
- A file path: review that specific test file
- A directory: review all test files in the directory
- Empty: review all tests in the project's
testDir
Steps
1. Gather Context
- Read
playwright.config.tsfor project settings - List all
*.spec.ts/*.spec.jsfiles in scope - If reviewing a single file, also check related page objects and fixtures
2. Check Each File Against Anti-Patterns
Load anti-patterns.md from this skill directory. Check for all 20 anti-patterns.
Critical (must fix):
waitForTimeout()usage- Non-web-first assertions (
expect(await ...)) - Hardcoded URLs instead of
baseURL - CSS/XPath selectors when role-based exists
- Missing
awaiton Playwright calls - Shared mutable state between tests
- Test execution order dependencies
Warning (should fix):
8. Tests longer than 50 lines (consider splitting)
9. Magic strings without named constants
10. Missing error/edge case tests
11. page.evaluate() for things locators can do
12. Nested test.describe() more than 2 levels deep
13. Generic test names ("should work", "test 1")
Info (consider):
14. No page objects for pages with 5+ locators
15. Inline test data instead of factory/fixture
16. Missing accessibility assertions
17. No visual regression tests for UI-heavy pages
18. Console error assertions not checked
19. Network idle waits instead of specific assertions
20. Missing test.describe() grouping
3. Score Each File
Rate 1-10 based on:
- 9-10: Production-ready, follows all golden rules
- 7-8: Good, minor improvements possible
- 5-6: Functional but has anti-patterns
- 3-4: Significant issues, likely flaky
- 1-2: Needs rewrite
4. Generate Review Report
For each file:
## <filename> — Score: X/10
### Critical
- Line 15: `waitForTimeout(2000)` → use `expect(locator).toBeVisible()`
- Line 28: CSS selector `.btn-submit` → `getByRole('button', { name: "submit" })`
### Warning
- Line 42: Test name "test login" → "should redirect to dashboard after login"
### Suggestions
- Consider adding error case: what happens with invalid credentials?
5. For Project-Wide Review
If reviewing an entire test suite:
- Spawn sub-agents per file for parallel review (up to 5 concurrent)
- Or use
/batchfor very large suites - Aggregate results into a summary table
6. Offer Fixes
For each critical issue, provide the corrected code. Ask user: "Apply these fixes? [Yes/No]"
If yes, apply all fixes using Edit tool.
Output
- File-by-file review with scores
- Summary: total files, average score, critical issue count
- Actionable fix list
- Coverage gaps identified (pages/features with no tests)
常见问题
它会查找哪些类型的问题?
例如固定等待、本可使用基于角色的选择器却使用 CSS 选择器、硬编码的网址,以及相互依赖的测试。
所有发现的问题都紧急吗?
不是。该技能把问题分为必须修复的严重项、需要尽快修复的警告,以及可以考虑的提示。
它能审查单个文件吗?
能。你可以提供一个文件或一个文件夹,也可以留空以审查整个测试文件夹。
详情
作者的原始描述
Use when reviewing Playwright tests for quality ('review tests', 'audit tests', 'playwright best practices check').
热度
- GitHub 星标
- 29k
- 排名
- #9478
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。