| name | review-pr |
| description | Review a pull request for Playwright test automation using project standards. Use when user asks to review a PR, check a pull request, or mentions a PR number. |
| allowed-tools | Bash(gh:*), Bash(git:*), Read, Grep, Glob |
Pull Request Review
Process
1. Gather PR Information
gh pr view <number> --json title,body,state,additions,deletions,changedFiles,baseRefName,headRefName
gh pr diff <number>
2. Read modified files for context
Use Read tool to view complete files mentioned in the diff.
3. Review Checklist (Production Focus)
Critical Issues (Block Merge)
Test Design & Business Logic
Test Stability & Reliability
Test Independence & Isolation
Test Data Strategy
Code Quality & Architecture
File & Folder Organization:
Consistent structure makes the codebase navigable and predictable.
File naming conventions:
Folder structure:
Red flags to catch:
- File without proper suffix (e.g.,
Checkout.ts instead of checkout.page.ts)
- Page object in wrong folder (e.g., cart page in
product/ folder)
- Component that should be in
components/ but is nested in a page folder
- Test file not following
.spec.ts convention
- Mixed concerns in one folder (pages + utils + types together)
- Missing explicit return types on exported functions (non-exported local/private arrow functions may omit return types when the type is obvious from context)
Naming Conventions:
Over-Engineering:
Method Optimization:
Code Style:
Types & Constants Organization:
This is a tricky area with multiple valid approaches. Flag for discussion when patterns are inconsistent.
Where types should live:
Constants organization:
Recommended structure:
src/ui/
โโโ types/ # Shared types
โ โโโ cart.types.ts # CartItem, OrderItem
โ โโโ user.types.ts # Person, Address
โ โโโ index.ts # Re-exports
โโโ test-data/
โ โโโ constants/ # Test data with derived types
โ โโโ credit-card.ts # CREDIT_CARDS + CreditCard type (OK together)
โ โโโ timeouts.ts # TIMEOUTS
โโโ pages/
โโโ cart/
โโโ cart.page.ts # Imports from types/, no local CartItem
Red flags to catch:
- Same interface/type defined in 2+ files โ extract to shared types
- Type in page file that's imported by another page โ move to types/
- Constants scattered across page files โ consolidate to constants/
- Mixing unrelated constants in one file โ split by domain
Config Organization:
Utils & Helpers:
Reporting & Debugging:
Page Object Quality
CI/CD & Pipeline Considerations
Test Maintainability (6-month test)
Assertion Strategy
Security in Tests
Regression Risk Assessment
Git Hygiene
4. Output Format
Review Style - Senior AQA Mindset:
- Direct, concise, production-focused
- CRITICAL: Re-read ALL changed files before posting - don't review stale code
- Only show sections with issues - skip sections that are fine
- At the end, list areas that are good in one line: "โ
Good: [area1], [area2], [area3]"
- For commits with issues, provide specific rewrite suggestions
- Think long-term: "Will this be maintainable in 6 months?"
- Challenge decisions: "Why this approach? Is it necessary?"
- Consider CI/CD: "Will this work reliably in pipeline?"
- Assess risk: "What could this break? What's not covered?"
- DO NOT include "Test Coverage Analysis" section - this will be handled by a separate agent
Patterns to IGNORE (not issues):
- Duplicate fixture definitions across different fixture files (e.g.,
pages in both fixtures/index.ts and api-fixtures/api-user.fixture.ts) โ these may coexist intentionally for A/B performance comparison between fixture strategies. Do not flag as duplication or suggest mergeTests unless the duplicates have diverged in behavior.
Patterns to flag for extra review (not issues, just note them):
- Public locators used for assertion flexibility
- Generic assertion helpers (e.g.,
assertElementVisible(locator))
- Trade-offs between encapsulation and pragmatism
- Type defined in page file that might be shared later - ask: "Will other pages need this?"
- Constants with derived types - verify
as const is used for type inference
- Helper methods that could be private but are public - intentional or oversight?
- New folder created - does it fit the existing structure? Is it the right location?
- File without standard suffix - intentional (utility) or missing convention?
## PR Review: [Title] (#[Number])
**Changes**: +X / -Y across Z files
---
[ONLY INCLUDE SECTIONS WITH ISSUES - SKIP SECTIONS THAT ARE FINE]
### ๐ด Blockers
Critical issues that must be fixed.
### โ ๏ธ Issues
| File:Line | Issue | Suggestion |
|-----------|-------|------------|
| `file.ts:42` | Description | How to fix |
### ๐ For Your Review
Design decisions that may be intentional - verify they fit your context:
- [pattern] at `file.ts:line` - [brief description]
### ๐ก Discussion Points
Areas with multiple valid approaches - worth a team decision:
- [topic] - Option A: [approach]. Option B: [approach]. Recommendation: [suggestion]
*Common discussion topics: type location (page vs shared), helper extraction timing, assertion granularity*
### ๐ Git Hygiene
**PR title:** `Current` โ `Suggested improvement`
**Commits to improve:**
| Current | Suggested |
|---------|-----------|
| `bad commit msg` | `feat: clear description of change` |
---
โ
**Good:** [list areas with no issues, e.g., "test isolation, factory patterns, step decorator usage"]
**Verdict:** Approved / Changes requested
๐ค Generated with [Claude Code](https://claude.com/claude-code)
5. Automatically Post Review
After generating the review, ALWAYS post it as a comment on the PR:
gh pr review <number> --comment --body "$(cat <<'EOF'
[review content]
EOF
)"
Important: Do not ask the user if they want to post - automatically post the review after completing the analysis.
Reference
See docs/design-docs/core-beliefs.md for detailed testing standards.