DE//AGENT
Explore

Run the full SQL review pass on a PR

Run the SQL Reviewer agent's full pass over a pull request: read the diff in context, state the grain of every result set, then check the correctness bugs the SQL Review skill targets — fan-out joins, NULL-unsafe NOT IN and = predicates — and emit findings with file:line and a rewritten clause you can verify against the evaluation fixture.

At a glance

When A SQL PR needs a full correctness pass, not a single-issue check; Findings must cite the rule, the failure case, and a rewritten clause
Where SQL
Why A fixed rule order plus a findings format turns ad-hoc SQL review into a pass anyone can repeat.

Learning objectives

  • State the grain of every result set in one sentence
  • Apply the review rules in order and stop at the first violation
  • Emit findings with severity, location, rule, and a rewritten clause

What you need

  • A pull request or a .sql file
  • The target dialect (postgres/duckdb/snowflake)
  • [object Object]

Steps

  1. Read the diff and the file context. (from agent-sql-reviewer )
  2. Establish the grain of every result set. (from agent-sql-reviewer )
  3. State the grain of a result set in one sentence. (from skill-sql-review )
  4. Prove a join cannot fan out before writing it. (from skill-sql-review )
  5. Spot NULL-unsafe `NOT IN` and `=` predicates. (from skill-sql-review )
  6. Emit findings with file:line and a rewritten clause. (from agent-sql-reviewer )

Check yourself

  • On the 12-case fixture of known-bad SQL, findings cite severity, location, rule, and a fix — with 0 false positives.
  • Every SELECT in the PR has a one-sentence grain statement before you judge the query.

Worked example

Install the SQL review skill — from skill-sql-review

npx de-agent-platform add sql-review

The review rules, applied in order — from skill-sql-review

1. Every join states its cardinality (1:1, N:1, N:N) and justifies it.
2. NOT IN (subquery) is banned where the subquery can return NULL - use NOT EXISTS.
3. Comparisons across types must be explicit casts, not implicit.
4. ORDER BY without LIMIT in a view is meaningless - drop it.
5. SELECT * in a persisted model freezes an unstable schema.

What the pass emits — from agent-sql-reviewer

Findings list (severity, location, rule, fix)
Grain statement for each SELECT

Sourced from

Security scan

Last sweep 2026-10-24: 0 finding(s), 0 marked as examples.

Common gotchas

  • NOT IN with a nullable column never compares as you think; use NOT EXISTS.
  • `ORDER BY` without `LIMIT` in a view is meaningless — drop it.
  • `SELECT *` in a persisted model freezes an unstable schema.

Production considerations

  • Keep the 12-case evaluation fixture in CI so regressions resurface.
  • Emit findings with the exact predicate, the failure case, and a rewritten clause reviewers can verify.

Diagram

full review pass
   |
   |- read diff + context --> grain statement per result set
   |
   |- grain stated --> fan-out-proof joins --> NULL-unsafe predicates
   |
   |- emit findings --> file:line + rewritten clause --> verify on fixture

Registry stats

Verification community · Oct 21, 2026
Completeness 81
Trust multiplier ×1.25
Composite 34.15 · adequate
Freshness 3 days since last source check
Difficulty beginner
Version 0.1.0
License CC-BY-4.0
Security flags none