Skip to content
Back to skills

Performance

ASecurity

Use when reviewing code for N+1 queries or memory leaks.

  • 23 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 3, 2026
developmentgodatabasefrontendperformance

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add dean0x/devflow --skill performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dean0x-performance/badge)](https://www.skillsdirectory.com/skills/dean0x-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: performance
description: Use when reviewing code for N+1 queries or memory leaks.
user-invocable: false
allowed-tools: Read, Grep, Glob
---

# Performance Patterns

Detection patterns for performance and bottleneck review. Use with `devflow:review-methodology`.

## Iron Law

> **Measure before optimizing.**
>
> Profile first, optimize second. Every performance claim requires benchmarks. Brendan
> Gregg's USE Method (Utilization, Saturation, Errors) and Tom Wilkie's RED Method
> (Rate, Errors, Duration) are the systematic starting points — not guesswork.
> Gil Tene's coordinated omission warning: averages lie — monitor P99, not mean latency.

Measurement tools: flame graphs for CPU hot paths (widest frames are hottest), HDR histograms for full latency distributions.

## Performance Categories

### 1. Algorithmic Issues

- **N+1 queries**: a database query inside a loop, O(n) round trips. Fix: one batch query, then a Map lookup.
- **O(n²) patterns**: linear search inside a loop (`items.filter(i => selected.includes(i.id))`). Fix: a Set lookup.

### 2. Memory Issues

- **Memory leaks**: resources not cleaned up, hidden by GC until OOM.
- **Cache line false sharing**: hot fields on the same 64-byte line cause inter-core invalidation in high-throughput code.
- **Unbounded caches**: collections that grow forever. Use LRU with a `max` limit.

### 3. I/O Issues

- **Blocking operations**: synchronous I/O (`readFileSync`) in a request path blocks the event loop.
- **Sequential when parallel is possible**: independent awaits run serially, so the total is the sum, not the max. Fix: `Promise.all`.
- **Wrong layer**: CPU micro-tuning on a path bound by disk or network I/O (RAM ~100ns, SSD ~100µs, network ~500µs).

### 4. Database Issues

Missing indexes, SELECT *, OFFSET pagination on large tables, LIKE with leading wildcard. See `references/violations.md`.

### 5. Frontend / Web Vitals

| Metric | Good | Poor | Measures |
|--------|------|------|---------|
| LCP | < 2.5s | > 4s | Largest element load |
| INP | < 200ms | > 500ms | Input responsiveness |
| CLS | < 0.1 | > 0.25 | Layout stability |

Unnecessary re-renders, missing virtualization, missing code splitting. See `references/violations.md`.

## Extended References

| Reference | Content |
|-----------|---------|
| `references/sources.md` | Full bibliography (25 sources) |
| `references/violations.md` | Extended violations |
| `references/patterns.md` | Correct patterns |
| `references/detection.md` | Grep commands, profiling, CI integration |

## Severity Guidelines

| Severity | Examples |
|----------|----------|
| **CRITICAL** | N+1 with unbounded data, memory leaks, blocking I/O in handlers |
| **HIGH** | Sequential async, SELECT *, unbounded caches, LCP > 4s |
| **MEDIUM** | Suboptimal algorithm on small data, missing memoization, INP > 200ms |
| **LOW** | Micro-optimizations, premature optimization candidates |

## Quick Detection

In the diff, search for `await` in a loop or `.forEach(async` (N+1), `readFileSync`/`writeFileSync` (sync I/O) and `SELECT *`.

Files in this skill

  • SKILL.md4.7 KB
  • references/detection.md7.6 KB
  • references/patterns.md13.5 KB
  • references/sources.md4.5 KB
  • references/violations.md11.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.