performance-reviewer
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "performance-reviewer":https://skillpi.com/zh/skills/deepskill-0f5790acbc4904ec5822aa0f0d4c24a65a42f5bcf49dfc4ecd8190e098da1943。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
检查代码中的性能问题与优化机会:用于排查 N+1 查询、重复渲染、内存泄漏、低效算法、缺失索引和打包体积退化等性能瓶颈并提出优化方向。触发词:性能审查、慢查询、N+1、内存泄漏、打包体积、延迟、优化、重复渲染、大 O 复杂度。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 输入和输出
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: performance-reviewer
description: >-
Review code for performance issues and optimization opportunities. Use when
someone needs to check for N+1 queries, unnecessary re-renders, memory leaks,
inefficient algorithms, missing indexes, or bundle size regressions. Trigger
words: performance review, slow query, N+1, memory leak, bundle size, latency,
optimization, re-render, Big O.
license: Apache-2.0
compatibility: "Works with any codebase. Optional: lighthouse CLI, webpack-bundle-analyzer"
metadata:
author: terminal-skills
version: "1.0.0"
category: development
tags: ["performance", "optimization", "code-review", "profiling"]Performance Reviewer
Overview
This skill analyzes code changes for performance regressions and optimization opportunities. It catches common issues like N+1 database queries, unnecessary re-renders in React components, missing database indexes, unoptimized loops, and bundle size increases before they reach production.
Instructions
Analyzing a Diff or PR
- Get the diff:
git diff main...HEADorgit diff <base>...<head> - For each changed file, evaluate against these performance categories:
Database & Queries:
- Look for queries inside loops (N+1 pattern)
- Check for missing
WHEREclauses or full table scans - Identify missing indexes on columns used in
WHERE,JOIN, orORDER BY - Flag
SELECT *when only specific columns are needed - Watch for unbounded queries without
LIMIT
Frontend & Rendering:
- React: Check for missing
useMemo/useCallbackon expensive computations passed as props - Look for state updates that trigger unnecessary re-renders of large component trees
- Flag inline object/array creation in render (creates new reference every render)
- Check for large bundle imports (
import moment→ suggestdayjs)
Algorithm & Data Structures:
- Flag O(n²) or worse algorithms when O(n log n) alternatives exist
- Look for repeated array searches that should use a Set or Map
- Identify string concatenation in loops (suggest StringBuilder/join)
Memory & Resources:
- Check for missing cleanup in
useEffect(event listeners, intervals, subscriptions) - Look for growing arrays/objects that are never trimmed
- Flag missing connection pool limits or unclosed file handles
Network & I/O:
- Identify sequential API calls that could be parallelized (
Promise.all) - Check for missing pagination on list endpoints
- Flag missing caching for expensive or repeated operations
Output Format
For each issue found, report:
- File and line number
- Category (Database, Frontend, Algorithm, Memory, Network)
- Severity (Critical, Warning, Info)
- What's wrong (specific description)
- Suggested fix (concrete code suggestion)
Severity Guidelines
- Critical: Will cause visible degradation in production (N+1 in a loop, O(n²) on large datasets, memory leak)
- Warning: May cause issues at scale (missing index, unnecessary re-renders, sequential API calls)
- Info: Optimization opportunity, not urgent (bundle size suggestion, minor refactor)
Examples
Example 1: N+1 Query Detection
Input diff:
# api/views.py
def list_orders(request):
orders = Order.objects.filter(user=request.user)
result = []
for order in orders:
items = OrderItem.objects.filter(order=order) # ← query per order
result.append({
"id": order.id,
"total": order.total,
"items": [{"name": i.product.name, "qty": i.quantity} for i in items]
})
return JsonResponse(result, safe=False)
Output:
🔴 Critical — Database N+1 Query
File: api/views.py:5-8
Issue: OrderItem query executes once per order, plus each i.product.name
triggers another query. For 50 orders with 3 items each = 201 queries.
Fix: Use select_related and prefetch_related:
orders = Order.objects.filter(user=request.user).prefetch_related(
Prefetch('items', queryset=OrderItem.objects.select_related('product'))
)
Result: Reduces to 3 queries regardless of order count.
Example 2: React Re-render Issue
Input diff:
function UserList({ users, onSelect }) {
return (
<div>
{users.map(user => (
<UserCard
key={user.id}
user={user}
style={{ padding: 16, margin: 8 }}
onClick={() => onSelect(user.id)}
/>
))}
</div>
);
}
Output:
🟡 Warning — Unnecessary Re-renders
File: components/UserList.jsx:6-7
Issue: Inline object `style={{ padding: 16, margin: 8 }}` and arrow function
`() => onSelect(user.id)` create new references every render, causing
all UserCard components to re-render even when users haven't changed.
Fix:
const cardStyle = useMemo(() => ({ padding: 16, margin: 8 }), []);
const handleClick = useCallback((id) => onSelect(id), [onSelect]);
// Then: style={cardStyle} onClick={() => handleClick(user.id)}
Impact: With 100+ users, prevents ~100 unnecessary DOM diffing operations per parent render.
Guidelines
- Focus on issues introduced by the diff, not pre-existing problems
- Prioritize Critical issues — don't bury them in a list of Info suggestions
- Always provide concrete fix suggestions, not just "optimize this"
- Consider the scale: an O(n²) loop on a 5-element array is fine; on user-generated data it's not
- When suggesting caching, specify what to cache and invalidation strategy
- Don't flag micro-optimizations that harm readability for negligible gain
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供系统化的性能问题检查清单,覆盖数据库、前端、算法、内存、网络等关键维度
- 针对N+1查询、内存泄漏、重复渲染等生产环境常见问题提供具体修复方案
亮点
- 触发词覆盖全面且精准,包含performance review、N+1、memory leak等核心术语
- 边界清晰,明确适用于代码diff或PR审查场景
亮点
- 结构清晰,分五大性能类别组织检查项
- 提供完整的端到端示例,包含具体代码修复建议
- frontmatter完整,包含兼容性说明和元数据
亮点
- 工具来源明确,提供具体的git diff命令和第三方工具建议
- 通过Critical/Warning/Info三级严重性分级帮助用户判断优先级
- 每个问题都提供具体的代码修复建议而非泛泛而谈
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。