# SQL Review: Catch Wrong Numbers, Slow Queries & Injection

> Correctness-first SQL reviewer. Catches the bugs that silently produce wrong numbers (join fan-out, NOT IN with NULLs, LEFT JOIN filters, date boundaries, integer division), then performance, security and migration risks. Proves findings with small test queries instead of guessing.

SQL Review: Catch Wrong Numbers, Slow Queries & Injection is a paid AI agent skill on Agensi by Aryan Sharan, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $4.99 (one-time purchase)
- Creator: [Aryan Sharan](https://www.agensi.io/creators/aryan-sharan)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0.0
- Last updated: 2026-12-02
- Security: scan passed (2026-12-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/sql-review-catch-wrong-numbers-slow-queries-injection
- Tags: sql, code-review, data-quality, analytics, performance, security, database, migrations

## What it does

- Identifies logic bugs that cause silent errors like double-counting or missing rows
- Proposes specific index changes or rewrites to speed up slow queries with evidence
- Checks for security risks like SQL injection in your application code
- Flags dangerous database changes that might lock up a busy production table
- Verifies that suggested fixes return the exact same data as your original query
- Tailors every tip to your specific database type like Postgres, MySQL, or SQL Server

## Who it's for

- **Data analysts and report builders:** Stop sending reports with wrong numbers caused by hidden duplicates or date calculation errors. Try: "Check if this dashboard query is double-counting sales when it joins the refunds table."
- **Founders and technical leads reviewing code:** Review database changes and new queries for security risks or slow-downs before they hit production. Try: "Review these new dbt models and tell me if they are safe to ship to the warehouse."
- **Developers using databases like PostgreSQL or MySQL:** Find out exactly why your query is slow and get a verified, faster version that works for your database. Try: "This SQL query takes 10 seconds to run. Look at this plan and tell me how to make it faster."

## About this skill

When your database query gives you a number that "feels" wrong, or your app slows to a crawl, finding the cause is frustrating. This skill reviews your SQL queries like a senior database expert. It focuses on correctness first, catching the quiet bugs that create wrong numbers, like accidental duplicates after a join or dates that miss the last day of the month. It supports all major databases, from local ones like SQLite to cloud giants like Snowflake and BigQuery.

**How it works**

1. Paste your SQL query or a file containing database code into the chat.
2. Tell your AI agent which database you use, like PostgreSQL, MySQL, or BigQuery.
3. This skill scans the code for logic errors, slow spots, and security holes.
4. It provides a table of findings from "Blocker" to "Minor" with clear proof for each one.
5. You get the corrected code and a way to verify the fix actually works.

**What you get:** A detailed report showing exactly what is wrong with your SQL and a verified, safer version of the code.

## Requires

- Optional: Python 3.10+
- Optional: sqlglot Python package (for the checking script)

## Known limitations

Cannot promise specific speed-up percentages. Requires you to provide the database type for the most accurate results. Cannot run code on your database without your permission.

## Technical details

Built for multi-dialect SQL auditing including PostgreSQL, MySQL, SQL Server, Oracle, BigQuery, Snowflake, and more. It utilizes a Python static analysis script (sqlglot-based) to flag candidates for join fan-out, NULL handling errors, and non-sargable predicates. The skill follows a structured multi-pass workflow: Correctness, Performance, Security, and Migrations. It generates small test queries for DuckDB/SQLite to prove findings and includes equivalence checks to ensure rewrites preserve data integrity.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the SQL Review: Catch Wrong Numbers, Slow Queries & Injection skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What kind of problems can this skill find in my database code?

This skill identifies hidden logic errors that cause reports to show wrong numbers, such as double-counting during joins or missing data at month-end. It also checks for slow performance, security risks like SQL injection, and whether database changes are safe to run on live systems.

### What do I need to give my agent to start a review?

You only need to provide the SQL query or the file containing your database code, along with the name of the database you use. If you are using a tool like dbt or writing code in languages like Python or JavaScript that generates SQL, you can provide those files for review as well.

### What will the final results look like?

You receive a detailed report that categorizes findings from Blocker to Minor, including evidence for each issue. It provides corrected versions of your code and a specific way to verify that the fix works as expected.

### Which database systems does this skill support?

This skill covers all major database engines including PostgreSQL, MySQL, SQL Server, Oracle, and SQLite, as well as cloud platforms like BigQuery, Snowflake, and Redshift. It uses a helper script to verify syntax and check for common risks across these different dialects.

### Are there any situations where I should not use this skill?

It is not meant for writing brand-new queries from scratch or for general database administration tasks like server tuning and backups. It also avoids reviewing non-SQL data stores or giving performance guarantees without evidence from a query plan.

### How do I tell my agent to use this skill?

You can ask your agent to audit, debug, optimize, or check a specific query for errors. For example, you might ask why a certain report is returning duplicate numbers or if a new database migration is safe to run.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
