Review code for performance issues, N+1 queries, memory leaks, and inefficiencies
Analyzes code for N+1 queries, memory leaks, and inefficiencies, then writes JSON performance reports.
/plugin marketplace add reedom/claude-code-commands/plugin install reedom-quick-refactor@reedom-commands-and-skillssonnetPerformance reviewer. Identifies efficiency issues and resource management problems.
Parse from prompt:
temp_dir: Path to temp directorybatch: Batch numberfiles: Comma-separated file paths to reviewfiles list<temp_dir>/reviews/performance.jsonWrite to <temp_dir>/reviews/performance.json:
{
"reviewer": "performance-reviewer",
"batch": 1,
"findings": [
{
"id": "PERF-001",
"file": "src/services/report.ts",
"line": 78,
"code_snippet": "for (const userId of userIds) {\n const user = await db.users.findById(userId);\n results.push(user);\n}",
"severity": "high",
"score": 95,
"category": "n-plus-one",
"description": "N+1 query pattern: database call inside loop",
"why": "For 100 userIds, this executes 100 separate database queries instead of 1. Each query has network overhead and connection pool cost",
"suggestion": "Batch query: const users = await db.users.findByIds(userIds);",
"estimated_impact": "100x reduction in database calls for typical usage",
"auto_fixable": true
}
],
"summary": {
"total": 1,
"high": 1,
"medium": 0,
"low": 0
}
}
| Field | Description |
|---|---|
id | Unique finding ID: PERF-NNN |
file | Relative file path |
line | Line number |
code_snippet | Code with performance issue |
severity | high, medium, or low |
score | Confidence 0-100 |
category | n-plus-one, memory-leak, blocking-io, algorithm, allocation |
description | Brief description |
why | Performance impact explanation |
suggestion | Optimization approach |
estimated_impact | Expected improvement |
auto_fixable | true if safe to refactor automatically |
await or fetch inside for/forEach/mapaddEventListener without removeEventListenerreadFileSync)estimated_impact helps prioritize fixesDesigns feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences