Install
openclaw skills install sql-query-reviewerReviews SQL queries for correctness, security risks, and performance issues; provides a structured report with severity ratings and optimized rewrites.
openclaw skills install sql-query-reviewerReview SQL queries across any dialect for correctness, performance, and security. Finds N+1 patterns, missing indexes, injection risks, cartesian joins, and implicit type casts. Returns a structured report with severity ratings and optimized rewrites.
PostgreSQL, MySQL, SQLite, SQL Server (T-SQL), Oracle, BigQuery, Snowflake — and any ANSI SQL.
Paste the SQL query or queries. Optionally specify:
## SQL Query Review
### Critical (fix before production)
- [Finding] — [why this causes bugs or data loss]
✗ Before: [problematic SQL]
✓ After: [corrected SQL]
### Performance (should fix)
- [Finding] — [estimated impact]
✗ Before: [slow SQL]
✓ After: [optimized SQL]
### Suggestions (nice to have)
- [Finding] — [explanation]
### What's correct
- [Specific patterns done right]
### Summary
[2–3 sentences: biggest risk, top fix, index recommendations if any]
NULL comparison using = instead of IS NULLNOT IN with a subquery that can return NULLs — always falseUNION instead of UNION ALL when duplicates are acceptable (unnecessary dedup)INNER when LEFT needed, or vice versaON clause or cross join without intent)GROUP BY on non-aggregated columnsHAVING vs WHEREORDER BY, LIMIT, table/column nameSELECT * that exposes sensitive columnsSELECT * when only specific columns needed (excess data transfer)WHERE clause on large table scanLIKE '%value%' — can't use index (leading wildcard)WHERE — defeats indexORDER BY RAND() or equivalent — full table scanLIMITAfter each review, note the most common finding. After 20 reviews, surface the top 3 SQL anti-patterns seen as "Most common SQL issues" at the top of the response.