sql-query-review-lens
Review SQL queries for correctness, performance, and safety — index usage, N+1 patterns, injection risk, and EXPLAIN-driven tuning.
Skill by anton-abyzov
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/anton-abyzov-sql-query-review-lens
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/sql-query-review-lens
What's inside
- Skill name
sql-query-review-lens- Description
- Review SQL queries for correctness, performance, and safety — index usage, N+1 patterns, injection risk, and EXPLAIN-driven tuning.
- License
- MIT
- Instructions
- 82 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# sql-query-review-lens A structured checklist for reviewing SQL — whether hand-written, ORM-generated, or produced by another agent. The goal is queries that are correct, fast, and safe. ## Review order Work top-down. Correctness first; a fast wrong answer is still wrong. ### 1. Correctness - Do `JOIN` conditions match on the right keys? A missing condition silently becomes a cross join. - Are `NULL`s handled? `col = NULL` is never true — use `IS NULL`. `NOT IN` with a NULL in the list returns no rows. - Does `GROUP BY` list every non-aggregated selected column? - Are window vs. aggregate semantics what you intend? `COUNT(*) OVER ()` differs from `COUNT(*)` + `GROUP BY`. ### 2. Performance Run `EXPLAIN` (or `EXPLAIN ANALYZE` on Postgres) and read the plan: | Plan node | Usually means | Action | |----------------------|----------------------------------------|--------------------------------| | `Seq Scan` on a big table | no usable index for the predicate | add or fix an index | | `Nested Loop` with high rows | join blowup | check join keys / add index | | `Sort` spilling to disk | `work_mem` too small or huge set | reduce rows early, paginate | | `Hash Join` build huge | building hash over the big side | reorder / filter first | Common fixes: - **Sargable predicates**: `WHERE created_at >= $1` can use an index; `WHERE date(created_at) = $1` cannot. Avoid wrapping the indexed column in a function. - **Covering indexes**: include the selected columns so the engine skips the heap fetch. - **Leading-column rule**: a composite index `(a, b)` helps `WHERE a = ?` and `WHERE a = ? AND b = ?`, but not `WHERE b = ?` alone. - **Pagination**: prefer keyset pagination (`WHERE id > $last ORDER BY id LIMIT 50`) over large `OFFSET`. ### 3. N+1 and round trips Flag application code that runs one query per row of a previous result. Replace with a single `JOIN` or an `IN (...)` batch. In ORMs, look for lazy-loaded associations inside a loop. ### 4. Safety - **Injection**: values must be bound parameters (`$1`, `?`, named binds), never string-concatenated. Identifiers that must be dynamic should be validated against an allowlist. - **Mass updates**: every `UPDATE`/`DELETE` should have a `WHERE`. Run the matching `SELECT` first to confirm the row count. - **Transactions**: multi-statement writes belong in one transaction with a clear isolation level. ## Example review ```sql -- before: non-sargable, no parameter SELECT * FROM orders WHERE YEAR(created_at) = 2026 AND customer_email = '...'; -- after: sargable range + bound params + only needed columns SELECT id, total_cents, status FROM orders WHERE created_at >= $1 AND created_at < $2 AND customer_email = $3; ``` Pair the rewrite with an index on `(customer_email, created_at)`. ## Agent guidance - Always ask for the schema and approximate row counts before judging a plan. - Quote the specific plan node you are worried about; do not say "looks slow." - Recommend at most the indexes the query needs — over-indexing slows writes. - Never approve a query that builds SQL by concatenating untrusted input.
From anton-abyzov/vskill-test-public-skills-826, MIT.
More from anton-abyzov/vskill-test-public-skills-826
- 0.551score
release-evidence-review
anton-abyzov
Review supplied software release receipts and state exactly which source, test, deployment, installation and runtime claims they support.
SkillAFreshness: AClaude Code +9 - 0.551score
private-skill-sharing-review
anton-abyzov
Review a proposed sharing or publishing workflow for a private AI skill using supplied repository visibility and authorization details.
SkillAFreshness: AClaude Code +9 - 0.551score
skill-inventory-drift
anton-abyzov
Compare supplied AI skill inventories from two machines or agents by source identity, version, content hash and installation scope.
SkillAFreshness: AClaude Code +9 - 0.471score
conventional-commits-gatekeeper
anton-abyzov
Enforce and author Conventional Commits messages, validate commit history, and map commit types to semantic-version bumps.
SkillCFreshness: CClaude Code +9 - 0.471score
dockerfile-hardening-guide
anton-abyzov
Harden Dockerfiles for security and size — non-root users, pinned bases, multi-stage builds, minimal layers, and supply-chain hygiene.
SkillCFreshness: CClaude Code +9 - 0.471score
oss-dependency-triage
anton-abyzov
Triage third-party dependencies before adoption — maintenance health, security advisories, supply-chain risk, and a go/no-go scoring rubric.
SkillCFreshness: CClaude Code +9 - 0.471score
http-api-mock-forge
anton-abyzov
Stand up deterministic HTTP API mocks for tests and local dev using MSW, Nock, or Prism — request matching, stateful handlers, and contract fidelity.
SkillCFreshness: CClaude Code +9 - 0.471score
scanner-tripwire-fixture
anton-abyzov
DELIBERATE security-scanner test fixture — contains intentionally dangerous patterns (curl-pipe-bash, env-var exfiltration).
SkillCFreshness: CClaude Code +9 - 0.471score
git-bisect-detective
anton-abyzov
Drive git bisect to find the exact commit that introduced a regression, including automated test scripts and merge-commit handling.
SkillCFreshness: CClaude Code +9 - 0.471score
oss-license-auditor
anton-abyzov
Audit a project's dependency licenses for compatibility and obligations — copyleft detection, license allowlists, and SPDX-based reporting.
SkillCFreshness: CClaude Code +9 - 0.471score
changelog-scribe
anton-abyzov
Generate and maintain a Keep a Changelog style CHANGELOG.md from Conventional Commits, grouped by type with correct semver headings.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 10, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from anton-abyzov
- 0.783score
glossary
anton-abyzov
Build the shared language - interview the user term by term and write GLOSSARY.md with what each term means in the business, the data, the code and the UI.
SkillAFreshness: A★ 167Claude Code +9 - 0.783score
sw-grill-me
anton-abyzov
Interview the user relentlessly, in rounds, until every decision in a plan is settled; facts are your job, decisions are theirs.
SkillAFreshness: A★ 167Claude Code +9 - 0.783score
grill-me
anton-abyzov
Interview the user relentlessly, in rounds, until every decision in a plan is settled; facts are your job, decisions are theirs.
SkillAFreshness: A★ 167Claude Code +9 - 0.783score
sw-glossary
anton-abyzov
Build the shared language - interview the user term by term and write GLOSSARY.md with what each term means in the business, the data, the code and the UI.
SkillAFreshness: A★ 167Claude Code +9 - 0.781score
handoff
anton-abyzov
Hand work to another tool, account or machine and pick it up there, in two words.
SkillAFreshness: A★ 167Claude Code +9 - 0.781score
sw-handoff
anton-abyzov
Hand work to another tool, account or machine and pick it up there, in two words.
SkillAFreshness: A★ 167Claude Code +9
Cite this page
sql-query-review-lens skill. Agent Mart. https://agentmart.dev/skills/anton-abyzov-sql-query-review-lens (last updated 2026-10-24)