Contextual Review
Perform comprehensive reviews of code changes, implementation plans, and architecture decisions. Analyzes for quality, correctness, security, and adherence to project standards.
First: Read the Base Guidelines
Before reviewing any code, read base-review.md. It establishes:
- Reviewer philosophy (respect existing patterns, burden of proof on changes)
- Core quality standards (type safety, transaction integrity, data access, caching)
- Severity calibration with codebase-specific examples
- Common blind spots that reviewers unfamiliar with this codebase miss
The base guidelines apply to ALL reviews. Area-specific guides add targeted checklists.
When to Use
- Reviewing pull request changes
- Examining workspace diffs before creating a PR
- Getting feedback on code changes
- Identifying potential issues before merging
- Reviewing gameplans and implementation plans before execution
- Validating data model and API design decisions
Area-Specific Guidelines
Based on what files changed, consult the appropriate reference:
| Changed Files |
Reference |
platform/docs/ |
docs-review.md - Documentation review guidelines |
platform/flowglad-next/src/db/schema/, openapi.json, api-contract/ |
api-review.md - Data model and API review |
packages/ |
packages-review.md - SDK package review |
playground/ |
playground-review.md - Example project review |
platform/flowglad-next/ |
platform-review.md - Main platform review |
For reviewing implementation plans before code is written:
| Review Type |
Reference |
| Gameplans / Implementation Plans |
gameplan-review.md - Pre-implementation plan review |
Read the relevant reference file(s) based on the diff to get area-specific checklists and guidelines.
Review Process
0. Checkout PR
Run gh pr checkout <PR> to get the PR code locally. If it fails, continue with the review.
1. Gather Context
First, understand the scope of changes:
# Get the diff statistics to understand what files changed
GetWorkspaceDiff with stat: true
# Then examine individual file changes
GetWorkspaceDiff with file: 'path/to/file'
2. Review Categories
Analyze changes across these dimensions:
| Category |
Focus Areas |
| Correctness |
Logic errors, edge cases, null handling, off-by-one errors |
| Security |
Input validation, injection risks, auth/authz, secrets exposure |
| Performance |
N+1 queries, unnecessary loops, missing indexes, memory leaks |
| Maintainability |
Code clarity, naming, DRY violations, complexity |
| Testing |
Test coverage, edge cases tested, test quality |
| Types |
Type safety, proper typing, avoiding any |
3. Project-Specific Checks
For this codebase, also verify:
- Bun: Using
bun instead of npm or yarn
- Drizzle ORM: Schema changes use
migrations:generate, never manual migrations
- Testing Guidelines:
- No mocking unless for network calls
- No
.spyOn or dynamic imports
- No
any types in tests
- Each
it block should have specific assertions, not toBeDefined
- One scenario per
it with exhaustive assertions
- Security: Check OWASP top 10 vulnerabilities (XSS, injection, etc.)
4. Provide Feedback
Use the DiffComment tool to leave targeted feedback:
DiffComment({
comments: [
{
file: "path/to/file.ts",
lineNumber: 42,
body: "Potential SQL injection vulnerability. Consider using parameterized queries."
}
]
})
Review Checklist
Code Quality
Security
Performance
Testing
TypeScript
Output Format
Provide a structured review with:
- Summary: Brief overview of what the PR does
- Findings: Categorized issues (Critical, High, Medium, Low, Suggestions)
- Positive Notes: Good patterns or improvements noticed
- Recommendation: Approve, Request Changes, or Comment
Severity Levels
- Critical: Security vulnerabilities, data loss risks, breaking changes
- High: Bugs, significant performance issues, missing error handling
- Medium: Code quality issues, missing tests, unclear logic
- Low: Style issues, minor improvements, nitpicks
- Suggestion: Optional improvements, alternative approaches
Example Review
## Summary
This PR adds user authentication using JWT tokens with refresh token support.
## Findings
### Critical
- **src/auth/token.ts:45**: JWT secret is hardcoded. Move to environment variable.
### High
- **src/auth/login.ts:23**: Missing rate limiting on login endpoint.
### Medium
- **src/auth/validate.ts:12**: Token expiration check should use `<=` not `<` to handle exact expiration time.
### Suggestions
- Consider adding request ID to auth logs for debugging.
## Positive Notes
- Good separation of concerns between token generation and validation
- Comprehensive error types for different auth failures
## Recommendation
**Request Changes** - Address the critical security issue before merging.
Workflow
- Attempt to checkout the PR with
gh pr checkout <PR> (continue if it fails)
- Get diff statistics with
GetWorkspaceDiff(stat: true)
- Review changed files systematically
- Use
DiffComment for inline feedback
- Provide overall summary and recommendation
- Offer to help fix any critical issues
1---
2name: contextual-review
3description: Review pull requests for code quality, security vulnerabilities, best practices, and potential issues. Use when reviewing PRs, examining diffs, or providing code review feedback.
4metadata:
5 source: https://skillmd.com/skills/aibot88/contextual-review
6---
7
8# Contextual Review
9
10Perform comprehensive reviews of code changes, implementation plans, and architecture decisions. Analyzes for quality, correctness, security, and adherence to project standards.
11
12## First: Read the Base Guidelines
13
14**Before reviewing any code, read [base-review.md](base-review.md).** It establishes:
15- Reviewer philosophy (respect existing patterns, burden of proof on changes)
16- Core quality standards (type safety, transaction integrity, data access, caching)
17- Severity calibration with codebase-specific examples
18- Common blind spots that reviewers unfamiliar with this codebase miss
19
20The base guidelines apply to ALL reviews. Area-specific guides add targeted checklists.
21
22## When to Use
23
24- Reviewing pull request changes
25- Examining workspace diffs before creating a PR
26- Getting feedback on code changes
27- Identifying potential issues before merging
28- Reviewing gameplans and implementation plans before execution
29- Validating data model and API design decisions
30
31## Area-Specific Guidelines
32
33Based on what files changed, consult the appropriate reference:
34
35| Changed Files | Reference |
36|---------------|-----------|
37| `platform/docs/` | [docs-review.md](docs-review.md) - Documentation review guidelines |
38| `platform/flowglad-next/src/db/schema/`, `openapi.json`, `api-contract/` | [api-review.md](api-review.md) - Data model and API review |
39| `packages/` | [packages-review.md](packages-review.md) - SDK package review |
40| `playground/` | [playground-review.md](playground-review.md) - Example project review |
41| `platform/flowglad-next/` | [platform-review.md](platform-review.md) - Main platform review |
42
43For reviewing implementation plans before code is written:
44
45| Review Type | Reference |
46|-------------|-----------|
47| Gameplans / Implementation Plans | [gameplan-review.md](gameplan-review.md) - Pre-implementation plan review |
48
49Read the relevant reference file(s) based on the diff to get area-specific checklists and guidelines.
50
51## Review Process
52
53### 0. Checkout PR
54
55Run `gh pr checkout <PR>` to get the PR code locally. If it fails, continue with the review.
56
57### 1. Gather Context
58
59First, understand the scope of changes:
60
61```
62# Get the diff statistics to understand what files changed
63GetWorkspaceDiff with stat: true
64
65# Then examine individual file changes
66GetWorkspaceDiff with file: 'path/to/file'
67```
68
69### 2. Review Categories
70
71Analyze changes across these dimensions:
72
73| Category | Focus Areas |
74|----------|-------------|
75| Correctness | Logic errors, edge cases, null handling, off-by-one errors |
76| Security | Input validation, injection risks, auth/authz, secrets exposure |
77| Performance | N+1 queries, unnecessary loops, missing indexes, memory leaks |
78| Maintainability | Code clarity, naming, DRY violations, complexity |
79| Testing | Test coverage, edge cases tested, test quality |
80| Types | Type safety, proper typing, avoiding `any` |
81
82### 3. Project-Specific Checks
83
84For this codebase, also verify:
85
86- **Bun**: Using `bun` instead of `npm` or `yarn`
87- **Drizzle ORM**: Schema changes use `migrations:generate`, never manual migrations
88- **Testing Guidelines**:
89 - No mocking unless for network calls
90 - No `.spyOn` or dynamic imports
91 - No `any` types in tests
92 - Each `it` block should have specific assertions, not `toBeDefined`
93 - One scenario per `it` with exhaustive assertions
94- **Security**: Check OWASP top 10 vulnerabilities (XSS, injection, etc.)
95
96### 4. Provide Feedback
97
98Use the DiffComment tool to leave targeted feedback:
99
100```typescript
101DiffComment({
102 comments: [
103 {
104 file: "path/to/file.ts",
105 lineNumber: 42,
106 body: "Potential SQL injection vulnerability. Consider using parameterized queries."
107 }
108 ]
109})
110```
111
112## Review Checklist
113
114### Code Quality
115- [ ] Clear, descriptive variable and function names
116- [ ] Functions are focused and not too long
117- [ ] No dead code or commented-out code
118- [ ] Error handling is appropriate
119- [ ] Edge cases are handled
120
121### Security
122- [ ] No hardcoded secrets or credentials
123- [ ] Input is validated and sanitized
124- [ ] No SQL injection vectors
125- [ ] No XSS vulnerabilities
126- [ ] Authentication/authorization is correct
127- [ ] Sensitive data is not logged
128
129### Performance
130- [ ] No unnecessary database queries
131- [ ] Appropriate use of indexes
132- [ ] No obvious memory leaks
133- [ ] Pagination for large datasets
134- [ ] Caching where appropriate
135
136### Testing
137- [ ] New code has tests
138- [ ] Tests cover happy path and error cases
139- [ ] Tests are meaningful, not just for coverage
140- [ ] No flaky test patterns
141
142### TypeScript
143- [ ] Proper types used (no `any` without justification)
144- [ ] Type narrowing is correct
145- [ ] Generic types are appropriate
146- [ ] Null/undefined handled properly
147
148## Output Format
149
150Provide a structured review with:
151
1521. **Summary**: Brief overview of what the PR does
1532. **Findings**: Categorized issues (Critical, High, Medium, Low, Suggestions)
1543. **Positive Notes**: Good patterns or improvements noticed
1554. **Recommendation**: Approve, Request Changes, or Comment
156
157### Severity Levels
158
159- **Critical**: Security vulnerabilities, data loss risks, breaking changes
160- **High**: Bugs, significant performance issues, missing error handling
161- **Medium**: Code quality issues, missing tests, unclear logic
162- **Low**: Style issues, minor improvements, nitpicks
163- **Suggestion**: Optional improvements, alternative approaches
164
165## Example Review
166
167```markdown
168## Summary
169This PR adds user authentication using JWT tokens with refresh token support.
170
171## Findings
172
173### Critical
174- **src/auth/token.ts:45**: JWT secret is hardcoded. Move to environment variable.
175
176### High
177- **src/auth/login.ts:23**: Missing rate limiting on login endpoint.
178
179### Medium
180- **src/auth/validate.ts:12**: Token expiration check should use `<=` not `<` to handle exact expiration time.
181
182### Suggestions
183- Consider adding request ID to auth logs for debugging.
184
185## Positive Notes
186- Good separation of concerns between token generation and validation
187- Comprehensive error types for different auth failures
188
189## Recommendation
190**Request Changes** - Address the critical security issue before merging.
191```
192
193## Workflow
194
1951. Attempt to checkout the PR with `gh pr checkout <PR>` (continue if it fails)
1962. Get diff statistics with `GetWorkspaceDiff(stat: true)`
1973. Review changed files systematically
1984. Use `DiffComment` for inline feedback
1995. Provide overall summary and recommendation
2006. Offer to help fix any critical issues