sql-review

A pre-merge review tool for SQL, the language used to query databases. It checks syntax, common problem patterns, readability, performance concerns, and possible SQL-injection risks.

In plain words
What is it for?
Use it to review queries or database-model files, inspect changed SQL, assign an A-to-F quality grade, find anti-patterns, validate syntax, and check for injection threats.
Why use it?
It helps catch unsafe, hard-to-read, or error-prone queries before SQL changes are committed or merged.

Skill for Claude CodeCodex

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/altimateai/altimate-code/sql-review
Any agent
npx skills add AltimateAI/altimate-code --skill sql-review
Clone the repo
git clone --depth 1 https://github.com/AltimateAI/altimate-code

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 944 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 $0.00041 $0.00944
Opus 5 $0.00020 $0.00472
Sonnet 5 $0.00008 $0.00189
Haiku 4.5 $0.00004 $0.00094

Measured 2d ago against content hash 9de026d5636e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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.

.opencode/skills/sql-review/SKILL.md · 119 lines

How it starts

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

SQL Review

Requirements

Agent: any (read-only analysis) Tools used: altimate_core_check, altimate_core_grade, sql_analyze, read, glob, bash (for git operations)

When to Use This Skill

Use when the user wants to:

  • Review SQL quality before merging a PR
  • Get a quality grade (A-F) on a query or model
  • Run a comprehensive lint + safety + syntax check in one pass
  • Audit SQL files in a directory for anti-patterns

Do NOT use for:

  • Optimizing query performance -> use query-optimize
  • Fixing broken SQL -> use dbt-troubleshoot
  • Translating between dialects -> use sql-translate

Workflow

1. Collect SQL to Review

Either:

  • Read SQL from a file path provided by the user
  • Accept SQL directly from the conversation
  • Auto-detect changed SQL files from git:
git diff --name-only HEAD~1 | grep '\.sql$'

For dbt models, compile first to get the full SQL:

altimate-dbt compile --model <name>

2. Run Comprehensive Check

Call altimate_core_check — this is the single-call code review that composes:

  • Syntax validation: Parse errors with line/column positions
  • Lint (26 anti-patterns): SELECT *, unused CTEs, implicit casts, NULL comparisons, missing WHERE on DELETE/UPDATE, cartesian joins, non-sargable predicates, missing partition filters, and more
  • Injection scan: Tautology attacks, UNION injection, stacked queries, comment injection, Jinja template injection
  • PII exposure: Flags queries accessing columns classified as PII
altimate_core_check(sql: <sql>, schema_context: <schema_object>)

3. Grade the SQL

Call altimate_core_grade to get an A-F quality score with per-category breakdown:

altimate_core_grade(sql: <sql>, schema_context: <schema_object>)

Categories scored:

  • Readability: Naming, formatting, CTE structure
  • Performance: Anti-patterns, index usage, scan efficiency
  • Correctness: NULL handling, join logic, type safety
  • Best Practices: Explicit columns, proper materialization hints

Read the full file on GitHub · 119 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. 2d ago First seen · 119 lines · 41 tokens per session scan A 9de026d5636e

Subscribe to this mod's changes

sql-review is a skill published in the GitHub repository AltimateAI/altimate-code (803 stars, last pushed 2d ago), licensed MIT. It adds 41 tokens to every session and 944 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-30.

Related

Other skills, from other repositories

review-prs

Review a GitHub pull request in the googleapis/mcp-toolbox repo against the team's reviewer checklist: PR title/description conventions, linked issue, logic errors and unhandled edge cases, breaking changes, test coverage, docs updates, security (input handling), and new dependencies. Use whenever a maintainer asks…

googleapis/mcp-toolbox · 162 tokens

fix-failing-tests

Diagnose a failing test in the googleapis/mcp-toolbox repo and land a fix by reasoning from the actual error: read the failure, reproduce it, shrink it until the cause is forced into the open, then fix the cause. Use this whenever a test or CI job is red, a build breaks after a change, many packages fail at once, or a…

googleapis/mcp-toolbox · 87 tokens

stale-sweep

Sweep the googleapis/mcp-toolbox repo for issues and PRs with no real activity in N days (default 60), sort each by whose silence it is (the author's, ours, or nobody's), and draft the nudge or close comment. Use whenever a maintainer asks for a stale sweep, backlog cleanup, or an SLO check, e.g. "stale sweep", "find…

googleapis/mcp-toolbox · 159 tokens

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

data-divergence

Investigate why two datasets that should agree don't — two pipelines writing the same logical table, a rollup vs the detail it aggregates, a dashboard vs its source, one environment vs another. Use when row counts, totals, or date ranges disagree and the question is what happened rather than just what differs. Covers…

andre-salvati/databricks-template · 123 tokens

sql-diagram

Diagram a SQL query and explain what it shows — either its execution steps (mode=plan) or its column lineage (mode=lineage) — then trace it through small data so the defects the picture cannot show become visible. Use when asked to visualize, diagram, explain or review what a query does, how it joins its tables, or…

andre-salvati/databricks-template · 121 tokens