<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
diegopacheco/agent-skills/presto-performance-agent
──Details
PublishedOctober 24, 2026 at 04:27 AM
Content Hashsha256:a01f6c8f81cfd17e...
Git SHAba9fe1de8bd0
──Files
Files (1 file, 4.2 KB)
SKILL.md4.2 KBactive
SKILL.md · 70 lines · 4.2 KB

version: "1.0.0" name: presto-performance-agent description: 🏎️ Presto Performance night agent. Hunts slow implementations - missing database indexes, N+1 queries, database access in loops, missing pagination, quadratic algorithms, wrong data structures, missing caching, blocking IO, oversized images and assets - then measures, fixes, measures again, runs the tests, and leaves the fixes on their own branch with a report. Use when the user runs /presto-performance-agent, /night-agents presto, or asks to find or fix performance problems.


🏎️ Presto Performance

Find code that is slow for a reason you can name, measure it, fix it, measure it again.

Follow ~/.night-agents/CONTRACT.md. Agent name: presto-performance-agent.

1. Start

Start the run with night-run.sh start presto-performance-agent unless the dispatcher handed you a run, install dependencies and record the baseline (contract steps 1 and 2).

2. Hunt

Read the hot paths first: request handlers, jobs, loops over collections, repository and DAO code, SQL, ORM mappings, render functions, build config, static assets. Look for:

ProblemSignal
Missing indexWHERE, JOIN, ORDER BY or foreign key columns without an index in the schema or migrations. Confirm with EXPLAIN / EXPLAIN QUERY PLAN when a database can run locally
N+1 queriesa query, ORM lazy load or HTTP call inside a loop over rows
Missing paginationlist endpoints or queries that return every row, findAll(), SELECT * without LIMIT
Poor algorithmnested loops over the same collection, includes/indexOf/contains inside a loop, repeated sorting, string building in a loop, recursion without memoization
Wrong data structurelists used for lookups that need a map or a set, arrays shifted as queues
Missing cachingthe same pure computation or the same remote read repeated per request with stable inputs
Blocking IOsynchronous file, network or crypto calls on a request path, sequential awaits that are independent
Over fetchingselecting all columns or whole object graphs to use one field
Heavy assetsimages over 200 KB, PNG photos, missing width/height, no lazy loading, unminified bundles
Memoryunbounded caches, listeners never removed, whole files read when a stream would do

Rank the findings by impact on a real path. Skip micro optimizations nobody would notice.

3. Measure, fix, measure

For every finding you fix:

  1. Write a benchmark that runs the real code path with realistic data sizes (at least 1k rows or

items, more when the path is meant for more). Prefer the project's own benchmark tooling; otherwise a small script under $RUN_DIR/bench/ or a test that times the call. Run it at least 5 times and take the median.

  1. Save the numbers to $RUN_DIR/bench/<finding-id>.txt.
  2. Fix it with the smallest change that removes the cause: an index migration, a batched or joined

query, a LIMIT/OFFSET or cursor with a sane default page size and a maximum, a map or a set, a memo or bounded cache with an invalidation rule, a resized and compressed image.

  1. Run the benchmark again. Keep the fix only when the median improves by at least 10% and the tests

still pass. Otherwise revert it and record it as reported.

  1. Add or keep a test that guards the behavior the fix must not change, such as page size limits,

ordering, or the same result set.

  1. One commit per fix: <project>: presto-performance-agent: batch order item queries.

API changes such as pagination on an existing endpoint must stay backward compatible: default values that return what callers got before for small data, and the change recorded in the report.

4. Verify, document, finish

Contract steps 4 to 7. The report has one section per finding with the cause, the fix, the benchmark command and the before and after medians. Put the numbers in each finding's before and after fields, such as "before": "412ms", "after": "38ms".

Metrics

improvements, reportedOnly, avgSpeedupPct, maxSpeedupPct, indexesAdded, queriesRemoved, bytesSaved. Finding kinds: missing-index, n-plus-one, missing-pagination, poor-algorithm, data-structure, missing-cache, blocking-io, over-fetching, heavy-asset, memory.

All versions