review-query
Skill1 starsChanged 2 months agoMITView on GitHub
Review a database or cache access path for correctness and cost — N+1, missing index, unbounded result set, transaction scope, and the Redis/cache-key issues from the review corpus (read key ≠ write key, KEYS on a shared instance, negative tombstones, replica lag on read-your-writes). Use when reviewing a PR that adds a query, when something is slow, or when asked to "check this query".
In this repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-endpointSkill
- design-eventSkill
- design-schemaSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- extract-moduleSkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- bullmqSkill
- kafkaSkill
- sqs-consumerSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Check EXPLAIN; a seq scan on a big table is the tell.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Review a query / cache access
SQL / ORM
- N+1 — a query inside a loop over rows already fetched. Batch it: one
WHERE id IN (…), or the ORM'sinclude/join.refreshUserCache-style helpers in a per-item loop when the rows are in hand → ~2N redundant reads. - Missing index — the
WHERE/ORDER BY/ join column has no index. CheckEXPLAIN; a seq scan on a big table is the tell. - Unbounded result set —
SELECT …with noLIMITon a table that grows. Paginate. SELECT *pulling columns (and big TEXT/JSON blobs) the caller doesn't use.- Transaction scope —
@Transaction/ aBEGINheld across a paginated loop or an external call pins a connection and holds locks. Keep transactions short; don't wrap read-only paginated work in one. - Write-then-read in the same request expecting to see the write — fine on primary, broken if the read goes to a replica.
Redis / cache
- Read key ≠ write key — the key for the index lookup and the key for the loader must be derived identically. Normalize once, use for both.
KEYSon a shared instance — blocks Redis. UseSCAN, or drop the method.- Negative tombstones from a bulk loader written with a different filter than the single-item loader → real records 404. Blocking.
- Read-your-writes on a replica — OTP verify, rate-limit counters, session — replica lag means a stale/missing read. Must hit primary.
multi.exec()result ignored —MULTIdoesn't roll back; scan the result array for errors.- No TTL on a cache entry that should expire, or a TTL so long the data goes stale.
Output
Blocking (tombstone bug, replica on read-your-writes, KEYS on shared) vs
non-blocking (N+1 on a cold path, missing index that's not hot yet — quantify).
Show the mechanism: the query, the call volume, what happens under load.
Anti-patterns
- ❌ "Add an index" with no
EXPLAINand no idea if the path is hot. - ❌ Flagging N+1 on a path called once a day as a blocker.
- ❌ Missing that the read and write keys diverge.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

