Skip to content
Agentmart
Submit a tool

sql-review

Use when SQL is written, changed, or reviewed against the database standards — triggers on "/sql-review", "review this SQL", "check this migration", "audit…

Skill by Esequiel378

IndexedMIT
Write a review

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/esequiel378-sql-review

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.

We use your email only for this newsletter. Privacy

About

Use when SQL is written, changed, or reviewed against the database standards — triggers on "/sql-review", "review this SQL", "check this migration", "audit this schema", "does this follow our conventions", when the user asks to write or alter a table, index, view, query, or migration, or when a diff touches sqlc.yaml or sqlc-generated code.

Use cases: backend, security, writing

No 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-review

What's inside

Skill name
sql-review
Description
Use when SQL is written, changed, or reviewed against the database standards — triggers on "/sql-review", "review this SQL", "check this migration", "audit this schema", "does this follow our conventions", when the user asks to write or alter a table, index, view, query, or migration, or when a diff touches sqlc.yaml or sqlc-generated code.
License
MIT
Instructions
321 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# SQL Review

Hold all SQL — new or existing — to the standards below. One checklist drives
both modes: reviewing flags deviations, writing avoids them from the start.

## Modes

**Review mode** — the user hands over existing SQL.

1. If a file path, diff, or migration was named, read it. Otherwise ask the
   user to paste the SQL.
2. Work through every checklist section below.
3. Report findings in the output format at the end.
4. If the SQL is clean, say so explicitly. Do not invent findings.

**Write mode** — the user asks for new or changed SQL.

1. Write the SQL with the checklist as constraints.
2. Self-review the result against every section.
3. Show the SQL. Name any standard you bent and why.

---

## Checklist

### Naming conventions

**Tables**
- [ ] `snake_case` only
- [ ] Plural nouns (`users`, `lab_orders`, not `user` or `labOrder`)
- [ ] No version suffixes (`v2`, `new_`, `_old`)
- [ ] Max 50 characters
- [ ] Business terminology, not source-system terminology

**Columns**
- [ ] `snake_case` only
- [ ] Primary key **must** be named `{table_singular}_id` — `id` is never
      acceptable (e.g. `organizations.organization_id`, `orders.order_id`,
      `ticket_tiers.ticket_tier_id`). Every table using `id` is a HIGH finding.
- [ ] Foreign keys named `{referenced_table_singular}_id`
- [ ] Timestamps use `{event}_at` past-tense format (`created_at`,
      `updated_at`, `deleted_at`)
- [ ] Dates use `{event}_date` format (`order_date`, not `date_order`)
- [ ] Booleans prefixed with `is_` or `has_` (`is_active`, `has_results`)
- [ ] Price/currency fields: decimal format (`19.99`) unless using cents
      suffix (`price_in_cents`)
- [ ] No abbreviations (`uid` → `user_id`, `usr_demo` → `user_demographics`)
- [ ] No reserved words as column names
- [ ] Max 50 characters

**Indexes**
- [ ] Regular indexes: `idx_{table}_{columns}`
- [ ] Unique indexes: `uidx_{table}_{columns}`
- [ ] Max 63 characters total

**Views / Materialized views**
- [ ] Views prefixed `v_`
- [ ] Materialized views prefixed `mv_`

**Named queries** (sqlc `-- name:`, and any other place a query gets a name)
- [ ] `{Entity}{Action}`, entity first — `UsersList`, `UsersGet`, not
      `ListUsers`, not `GetUser`
- [ ] The entity is the table name, in the same plural the table uses:
      `UsersList`, not `UserList`
- [ ] The action is a verb, and may carry a qualifier: `UsersListActive`,
      `OrdersDeleteForCustomer`
- [ ] A query spanning tables takes the entity it reads from, or writes to
      when it writes

Entity first so every query against one table shares a prefix. That is what
makes them sort together in `queries.sql`, in the generated method set, and in
an editor's autocomplete — `Users` shows the whole surface for that table.
Verb-first scatters them: `ListUsers` sorts under L, next to `ListOrders`,
which is a neighbour it has nothing to do with.

---

### Column ordering

Columns appear in this order within a `CREATE TABLE`:

1. IDs (primary key first, then foreign keys)
2. Strings (text, enums, varchars)
3. Numerics (amounts, counts, measurements)
4. Booleans
5. Dates (date-only fields)
6. Timestamps (datetime fields)

---

### Data types

- [ ] All timestamps use `TIMESTAMPTZ`, never bare `TIMESTAMP`
- [ ] Primary keys are UUID (`gen_random_uuid()`), or SERIAL for internal
      lookup tables
- [ ] Categorical / constrained values use a custom `ENUM` type or a `CHECK`
      constraint — not bare `VARCHAR` with no validation
- [ ] ZIP codes: `VARCHAR(5)` with `CHECK (zip_code ~ '^[0-9]{5}$')`
- [ ] States: `us_state_type` enum
- [ ] Gender: `gender_type` enum
- [ ] Flexible structured data: `JSONB`, not `JSON` or `TEXT`

---

### Constraints and integrity

- [ ] Every table has a primary key
- [ ] Foreign keys are explicitly declared (or noted as analytics schema
      where omitted intentionally)
- [ ] NOT NULL applied to columns that must always have a value
- [ ] Default values provided where sensible (`DEFAULT NOW()`,
      `DEFAULT false`)
- [ ] JSON columns have a `CHECK (jsonb_typeof(...) = 'object')` constraint
      where structure matters

---

### Audit fields

From Esequiel378/skills, MIT.

More from Esequiel378/skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Aug 25, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Esequiel378

Cite this page

sql-review skill. Agent Mart. https://agentmart.dev/skills/esequiel378-sql-review (last updated 2026-10-24)