跳到正文
Skillpedia
测试29k · #9478

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/playwright-pro/skills/pw-review/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.ts for project settings
  • List all *.spec.ts / *.spec.js files 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):

  1. waitForTimeout() usage
  2. Non-web-first assertions (expect(await ...))
  3. Hardcoded URLs instead of baseURL
  4. CSS/XPath selectors when role-based exists
  5. Missing await on Playwright calls
  6. Shared mutable state between tests
  7. 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 /batch for 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').

repo: alirezarezvani/claude-skills

热度

GitHub 星标
29k
排名
#9478
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能