| name | review-performance |
| description | Performance review skill. Detects N+1 queries, missing indexes, blocking in async contexts, unbounded data fetching, unnecessary computation, inefficient data structures, and missing caching opportunities. |
| argument-hint | Invoked by Review Coordinator - do not call directly |
review-performance - Performance Review Skill
This skill is invoked by the Review Coordinator as a subagent. It detects performance anti-patterns across 7 categories, focusing on algorithmically significant issues rather than micro-optimizations.
Input contract (received via subagent prompt):
- Read this SKILL.md file for review instructions.
- Read the specification file for any performance NFRs (Section 10.1).
- Read the WP file to identify what was implemented and scope the review.
- Discover and read all implementation code relevant to this WP. Use
#tool:search/usages to trace hot-path function call chains. Use #tool:search/searchSubagent to find WP-scoped files efficiently.
- Evaluate each checklist item below against the discovered code.
- Write structured findings to the specified output path.
- Return a brief summary (counts of PASS/WARN/FAIL/N/A).
Constraint: Do NOT modify any source code, the WP file, or the spec file. Only write to the specified output path (FR-028).
Performance Checklist
Category 1: N+1 Query Patterns (FR-044.1)
Category 2: Missing Database Indexes (FR-044.2)
Category 3: Blocking in Async Contexts (FR-044.3)
Category 4: Unbounded Data Fetching (FR-044.4)
Category 5: Unnecessary Computation in Hot Paths (FR-044.5)
Category 6: Inefficient Data Structures (FR-044.6)
Category 7: Missing Caching (FR-044.7)
Severity Guidance (FR-045)
WARN (default for all performance findings)
All performance findings default to WARN severity. Performance issues are advisory - they highlight areas for improvement but do not block approval.
FAIL (only for NFR violations)
FAIL severity applies only when a performance issue directly violates a specific performance NFR from the spec's Section 10.1. For example, if the spec states a maximum response time and the detected pattern would make meeting that target impossible.
When issuing a FAIL, cite the specific NFR being violated (e.g., "Violates NFR-001: 30-minute review time").
N/A - Not applicable
Use N/A with justification when a category does not apply. Example justifications:
- "No database access in this WP" for N+1 queries, missing indexes
- "No async code in this WP" for blocking in async contexts
- "No remote API calls in this WP" for missing caching
Output Format
Write findings to the specified output path using the format below. Finding IDs use the PERF- prefix.
---
skill: review-performance
wp: <WP-ID>
spec: <spec-path>
reviewed_at: <ISO-8601-timestamp>
status: completed
finding_counts:
pass: <count>
warn: <count>
fail: <count>
na: <count>
files_reviewed:
- <file-1>
- <file-2>
---
# review-performance Findings for <WP-ID>
## Summary
<Brief overview: files analyzed, performance patterns detected, overall assessment.>
## Findings
### PERF-001 [WARN]
- **Checklist item**: N+1 Query Pattern
- **Requirement**: FR-044 category 1
- **File**: src/api/orders.py#L30-L38
- **Description**: Database query executed inside a loop iterating over user IDs.
- **Expected**: Use a batch query or JOIN to load all related orders in one query.
- **Evidence**:
```python
for uid in user_ids:
orders = db.query(Order).filter(user_id=uid).all()
PERF-002 [N/A]
- Checklist item: Blocking in Async Contexts
- Justification: No async code in this WP. All functions are synchronous.
---
## Quality Checklist
Before completing, verify:
- [ ] N+1 query patterns checked in all database access paths
- [ ] Unbounded data fetching flagged (missing LIMIT/pagination)
- [ ] Blocking calls in async contexts identified
- [ ] Missing indexes cross-referenced with query patterns
- [ ] Caching opportunities evaluated for repeated computations
- [ ] `finding_counts` match actual findings in the output
- [ ] `files_reviewed` lists every file read during this review