sql-review

sql-review is a skill for Claude Code from skilletmd/skillet. It costs 45 tokens per session (769 once invoked), scanned A, original, Apache-2.0.

A review guide for SQL, the language used to read and change data in databases. It checks queries and database changes for incorrect results, slow operations, and risky writes.

In plain words
What is it for?
Use it when writing complex queries, reviewing database migrations, or preparing UPDATE and DELETE statements for production data.
Why use it?
It helps catch mistakes such as changing the wrong rows, multiplying results through joins, mishandling missing values, or locking a table during a migration.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit Use it when writing complex queries, reviewing database migrations, or preparing UPDATE and DELETE statements for production data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skilletmd/skillet/sql-review
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add skilletmd/skillet --skill sql-review
Clone the repo
git clone --depth 1 https://github.com/skilletmd/skillet

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-review

README.md
[![agentmods](https://agentmods.dev/badge/skills/skilletmd/skillet/sql-review/github.svg)](https://agentmods.dev/skills/skilletmd/skillet/sql-review)
Your own site
<a href="https://agentmods.dev/skills/skilletmd/skillet/sql-review"><img src="https://agentmods.dev/badge/skills/skilletmd/skillet/sql-review/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-review

Your own site · 80×15
<a href="https://agentmods.dev/skills/skilletmd/skillet/sql-review"><img src="https://agentmods.dev/badge/skills/skilletmd/skillet/sql-review.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 769 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.00769
Opus 5.5 $0.00018 $0.00308
Sonnet 5.5 $0.00009 $0.00154
Haiku 4.5 $0.00005 $0.00077

Measured 1mo ago against content hash c329da7bf582, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sql-review scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/sql-review/SKILL.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

sql-review

The dangerous SQL is the SQL that runs fine in dev and wrong in prod: a DELETE that matches every row, a JOIN that fans out, a migration that locks a table for ten minutes. This skill catches those before they ship.

When to use

Writing a non-trivial query, reviewing a migration, or about to run a write statement against real data.

Before any UPDATE or DELETE

Run the WHERE clause as a SELECT first. The count it returns is the number of rows you are about to change.

-- Don't run this yet:
DELETE FROM orders WHERE status = 'cancelld';   -- typo: matches 0 rows, or the wrong ones

-- Run this first:
SELECT count(*) FROM orders WHERE status = 'cancelld';

If the count surprises you, stop. The count is a sanity check, not a lock — rows can change between the SELECT and the write. The transaction is what lets you back out:

BEGIN;
DELETE FROM orders WHERE status = 'cancelled';
-- read the row count it reports, then:
COMMIT;   -- or ROLLBACK; if it's wrong

Correctness

  • NULL is not a value. col = NULL is never true — use IS NULL. NOT IN (subquery) returns nothing if the subquery yields a single NULL.
  • JOIN fan-out. A one-to-many JOIN multiplies rows, and now your SUM is wrong. Check the grain before you aggregate.
  • GROUP BY. Every non-aggregated column in the SELECT must be in the GROUP BY.
  • Implicit casts. Comparing a string column to a number can scan the whole table or match nothing.

Performance

EXPLAIN ANALYZE <your query>;

EXPLAIN ANALYZE runs the query to get real timings — on an UPDATE, DELETE, or INSERT that means it actually writes. Use plain EXPLAIN for those, or wrap it in a transaction you ROLLBACK.

Read it for:

  • Seq Scan on a large table where you expected an index — the WHERE column isn't indexed, or a function wraps it (WHERE lower(email) = ... can't use a plain index on email).
  • Nested loops over large row counts — usually a missing index on the join key.
  • SELECT * in anything that runs often — name the columns you need.
  • No LIMIT on a query that feeds a UI.

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 67 lines · 45 tokens per session scan A c329da7bf582

Subscribe to this mod's changes

sql-review is a skill published in the GitHub repository skilletmd/skillet (3 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 45 tokens to every session and 769 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories