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.

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.

agentmods
npx agentmods add skills/skilletmd/skillet/sql-review
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00023 $0.00385
Sonnet 5 $0.00009 $0.00154
Haiku 4.5 $0.00005 $0.00077

Measured 5d ago against content hash c329da7bf582, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 5d 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. 5d 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 6d ago), licensed Apache-2.0. It adds 45 tokens to every session and 769 once invoked, about $0.0002 per session on Opus 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

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens

cqrs-implementation

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.

wshobson/agents · 35 tokens

projection-patterns

Build read models and projections from event streams. Use when implementing CQRS read sides, building materialized views, or optimizing query performance in event-sourced systems.

wshobson/agents · 36 tokens

database-design

Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

CloudAI-X/claude-workflow-v2 · 57 tokens

architect/data-api-design

Skill "architect/data-api-design" from echoVic/boss-skill, covering 数据模型与api设计方法论, 适用场景, 数据模型设计, 1. 实体识别 and 2. 关系识别.

echoVic/boss-skill · 26 tokens