Ревью производительности

Ищет проблемы производительности: N+1-запросы, работу в горячих циклах, неограниченный рост памяти, отсутствующие индексы, блокирующий I/O в запросе и лишние мелкие сетевые вызовы. Используйте, когда код медленный или нужно проверить изменение на производительность.

Код-ревьюПак: Код-ревью75 строкperformance-review

Установка

Выполните одну команду — она сохранит SKILL.md в папку скиллов агента. Перезапустите агента, и он подхватит скилл сам.

Claude Code — macOS, Linux
mkdir -p ~/.claude/skills/performance-review && curl -fsSL https://anymodel.org/en/skills/code-review/performance-review/SKILL.md -o ~/.claude/skills/performance-review/SKILL.md
Codex, Cursor — macOS, Linux
mkdir -p ~/.agents/skills/performance-review && curl -fsSL https://anymodel.org/en/skills/code-review/performance-review/SKILL.md -o ~/.agents/skills/performance-review/SKILL.md
Claude Code — Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.claude\skills\performance-review" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/code-review/performance-review/SKILL.md -UseBasicParsing -OutFile "$HOME\.claude\skills\performance-review\SKILL.md"
Codex, Cursor — Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.agents\skills\performance-review" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/code-review/performance-review/SKILL.md -UseBasicParsing -OutFile "$HOME\.agents\skills\performance-review\SKILL.md"

Другой агент: сохраните файл в его папку скиллов или дайте ему ссылку на файл: https://anymodel.org/en/skills/code-review/performance-review/SKILL.md

SKILL.md

Исходник

Performance Review

Find the performance problems that matter at realistic scale and ask for measurements before recommending micro-optimizations.

1. Establish the context

Before reading code, find out:

  • What is slow or at risk: latency of one request, throughput, memory, startup, a batch job, a UI frame?
  • What scale is realistic: rows in tables, requests per second, size of inputs, number of users?
  • Is there a measurement already (profiler output, slow query log, APM trace, benchmark)? If yes, start from it.

If there is no number and the user claims "it is slow", ask for a reproduction or add a cheap measurement first (timing log around the suspect, EXPLAIN, a profiler run). Do not guess.

2. Look for the usual big wins

Work from the largest cost down. These beat any micro-optimization:

  • N+1 queries: a query inside a loop over results of another query, or lazy-loaded relations accessed per item. Fix with a join, IN (...) batch, or eager loading.
  • Missing indexes: columns used in WHERE, JOIN, ORDER BY without an index; functions applied to indexed columns; leading wildcard LIKE '%x'. Verify with the database's explain tool.
  • Fetching too much: SELECT *, loading whole tables to filter in memory, no pagination or limit, returning huge payloads.
  • Work inside hot loops: regex compilation, JSON parsing, config reads, object construction or sorting repeated per iteration instead of once outside.
  • Quadratic behavior: nested loops over collections, list.contains or array includes inside a loop (use a set or map), string concatenation in a loop on large data.
  • Unbounded memory: collections, caches or queues that only grow; reading a whole file or response into memory instead of streaming; listeners or timers never removed.
  • Blocking I/O on the request path: synchronous file, network or CPU-heavy work in an event loop or request handler; calls that should be queued or moved to a background job.
  • Chatty network: many small sequential calls where one batch call works; independent calls that could run in parallel; no timeouts or connection reuse.
  • Missing caching of stable, expensive results, or caching without invalidation or a size bound.
  • Frontend: re-rendering large lists without keys or virtualization, large bundles loaded eagerly, layout thrash.

3. Verify, do not assume

For each suspect, state the cost model: "this runs once per row, rows are about 10k, each call is about 2 ms, so about 20 s." If you cannot estimate, mark the finding as unverified and propose the exact measurement.

# examples of cheap measurements
time ./run-job.sh
python -X importtime app.py 2> imports.log
node --cpu-prof script.js
psql -c "EXPLAIN (ANALYZE, BUFFERS) SELECT ..."

Run measurements only on the user's dev data and never against production without asking.

4. Output format

Summary: <what was reviewed, the one biggest risk>

[high] path/to/file.js:57 - N+1 query in order listing
  Cost: <estimate: calls x time at realistic size>
  Evidence: <measured / read from code / unverified>
  Fix: <specific change, with the expected effect>

[medium] ...
[low] ...

Measurements to take: <what to run to confirm or rule out unverified findings>
Leave alone: <things that look slow but are not on a hot path>

Pitfalls

  • Do not micro-optimize (loop style, for vs map, small allocations) without a profile showing it matters.
  • Do not trade readability for a speedup nobody can measure.
  • Do not add caching as a first answer; remove the redundant work first.
  • Do not change query semantics (ordering, null handling) while rewriting for speed; check results are identical.
  • Do not forget the write side: new indexes slow inserts and take disk; say so.
  • Before and after numbers belong in the report if you changed anything; if you did not measure, say that explicitly.

Source: AnyModel skills catalog · License: CC BY 4.0

Подключить через AnyModel API

Скилл работает на той модели, которую использует агент. Подключите Claude Code, Codex или Cursor к AnyModel и запускайте его на Claude, GPT, Gemini и других моделях по одному ключу — оплата за токены, без подписки.

Ещё из пака Код-ревью

Ревью пул-реквеста

Ревьюит PR, ветку или незакоммиченные изменения: сначала ошибки в логике, потом дизайн; замечания по важности, с файлом и строкой. Используйте, когда просят проверить PR, ветку или diff.

Ревью безопасности

Проверяет изменение на инъекции, сломанную авторизацию, утечки секретов, SSRF, path traversal, небезопасную десериализацию, слабую криптографию и отсутствие rate limit, прослеживая недоверенный ввод до опасных мест. Используйте, когда просят аудит безопасности изменения.

Ответы на комментарии ревью

Разбирает комментарии ревьюера к PR: проверяет каждое утверждение по коду, исправляет то, что верно, возражает с доказательствами там, где неверно, и готовит ответ на каждый комментарий. Используйте, когда пользователь прислал комментарии ревьюера, которые нужно отработать.

Самопроверка перед PR

Проходит чек-листом по вашему же diff перед открытием PR: отладочный мусор, мёртвый код, секреты, тесты, нейминг, выход за рамки задачи, влияние на миграции и конфиг. Используйте, когда вы собираетесь открыть PR или работа закончена.