sqlsure skill
sqlsure checks SQL against declared schema facts and catches join fan-out double-counting before the query runs.
- 99 ★ on the repository
- Last commit
- Apache-2.0
Minimal access
Why this level
- The check is local and offline; SQL and schema are not sent to third-party services.
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add skills/sqlsureDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewMinimal accessThe tool runs nothing and makes no network calls.
- The check is local and offline; SQL and schema are not sent to third-party services.
This is third-party code. Review the repository files before installing.
What it does
sqlsure compares a query with what the team already declared about the schema: dbt unique tests set table grain, relationship tests set join cardinality, and `meta` tags mark which fields are safe to sum. Rules are dictionary lookups, not model calls, so the same query gives the same verdict offline. Rules include FANOUT (sums after a one-to-many join), CHASM, ADDITIVITY (summed rates and averages), JOIN_KEY and CROSS_JOIN. Every rejection carries a machine-readable `fix`, so an agent can repair the query and check it again. The same check runs as a CI gate or an MCP server, and as a skill it connects through a single `SKILL.md`.
Who it is for. Analysts and developers whose agents write SQL against a database or warehouse and may return a plausible but wrong number.
Good fit when
- An agent builds a revenue report joining several tables.
- A pull request needs a gate that blocks double-counted sums.
- A dbt project is audited for wrong join keys.
- Text-to-SQL quality is measured with a metric that sees semantic errors.
Not a fit when
- You need query speed or execution plan checks.
- The schema is not described in dbt or `model.json` and nobody will maintain it.
- You need an SQL style or formatting linter.
Example request
Check this SELECT with sqlsure, show the violations and repair the query using the `fix` hint.Limitations
Verdict quality depends on declared facts: without grain, relationship cardinality and additivity tags the rules stay quiet or answer that they cannot verify. The README marks the ruleset as v0.1 and expects it to grow. For Postgres and MySQL the model is built from `information_schema` in code, with no ready-made wizard. The MCP variant needs an absolute path to `model.json`, and the skill assumes Python runs on the agent's machine.
How to disable. Remove the skill folder or the MCP entry and drop the `python -m sqlsure.cli` step from CI. Uninstall the package with `pip uninstall sqlsure`.
FAQ
What does the check catch?
Double-counted sums after one-to-many joins, sums of non-additive measures such as rates and averages, joins on keys with no declared relationship and joins without a predicate. The README lists the rules in a table.
Does it call a model?
No, the check runs on rules. It reads only schema facts: a dbt manifest, SQLite introspection or a hand-written `model.json`.
How do I run it in CI?
Run `python -m sqlsure.cli --model model.json query.sql`. On violations it exits with code 1 and blocks the merge.
How do I build the schema model?
From a dbt manifest, through SQLite introspection with `sqlsure.introspect.model_from_sqlite` or by hand in `model.json`, following `model.example.json`.
How do I connect it as an MCP server?
Run `claude mcp add sqlsure -- python -m sqlsure.mcp_server --model /abs/path/model.json`. Tools are described in `docs/MCP.md`.
Discussion
No questions or reviews yet.
Related
SkillsReskillSQL analyses failed agent SQL runs and ships query-writing skill versions only after checks on held-out examples.
The SQL client combines terminal database browsing with batch queries for agents using named connections and JSON results.
MCP server and Claude Code plugin for SQL: validation, formatting, linting and injection scanning across eight dialects.
A SQL Server execution plan analyzer with 30 rules, missing index detection and an MCP server so an agent can review plans
Excel analysis skill that profiles a sheet, cleans it, reconciles totals against the sheet's own sums and then releases numbers.
A text-to-SQL MCP server: an agent asks a database in words, gets SQL plus a trace, and a stated refusal when data is missing.
README in short
The page opens with the promise to check SQL before it runs and results on the BIRD and Spider benchmarks, then explains how rules work and three ways to connect: CI, MCP and library. A rules table and trust properties follow.