sql-review
Skill3 starsChanged 31 days agoMITView on GitHub
Reviews analytical SQL for correctness, safety, performance, maintainability, and business-logic risk. Use when the user asks to review a query, SQL model, migration, or SQL diff.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- Smaui94/ClaudeSkillCollectiontheir own version, first seen Nov 8, 2026
- polardb/polardbx-skillstheir own version, first seen Nov 8, 2026
- Lanqiao-Luca/ai-java-workflowtheir own version, first seen Nov 8, 2026
- z-Zihan/Evirtheir own version, first seen Oct 13, 2026
- GabrielHenriqueCA/cortex-aitheir own version, first seen Oct 11, 2026
- kyle-chalmers/streamsnowtheir own version, first seen Oct 11, 2026
Used with
Projects with it also use code-review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 4 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- Lanqiao-Luca/ai-java-workflow★ 220same name
- kyle-chalmers/streamsnow★ 17same name
- z-Zihan/Evir★ 11same name
- polardb/polardbx-skills★ 8same name
- gmanch94/claude-code-aidlc-template★ 2same name
- Jiplet/transformation-os★ 2same name
- dennisrongo/claude-skills★ 1same name
- GabrielHenriqueCA/cortex-ai★ 1same name
- bt2go/claude-skills★ 0same name
- Smaui94/ClaudeSkillCollection★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- analytics-requirementsSkill
- api-pipelineSkill
- bi-modelSkill
- build-modelSkill
- data-model-reviewSkill
- data-profileSkill
- data-quality-investigationSkill
- dbt-healthSkill
- explain-data-codeSkill
- freshness-investigationSkill
- incremental-modelSkill
- metric-definitionSkill
- migration-planSkill
- model-documentationSkill
- model-testsSkill
- project-profileSkill
- pr-reviewSkill
- refactor-modelSkill
- rename-modelSkill
- semantic-layerSkill
- source-setupSkill
- trace-lineageSkill
- validate-dbtSkill
- yaml-maintenanceSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Do not use as a substitute for incident investigation or full dimensional-model review.
- Distinctive: line 28
Default silently to Work mode and prioritize actionable findings.
- Distinctive: line 33
Read the complete query and directly referenced definitions before judging a fragment.
- Distinctive: line 43
Read-only inspection is allowed.
- Distinctive: line 55
Every BLOCKER/HIGH finding must include concrete evidence: exact location, triggering input or logical path, expected versus actual …
- Distinctive: line 92
Ensure every BLOCKER/HIGH has the required evidence.
- Distinctive: line 93
Check severity consistency and remove duplicates.
- Distinctive: line 99
Never execute mutating SQL, production queries, or expensive scans without explicit approval.
- Distinctive: line 100
Prefer metadata, sampled, bounded, or dry-run evidence.
- Distinctive: line 101
Do not expose credentials, raw sensitive values, or unnecessary row-level data.
- Distinctive: line 106
Do not assume source uniqueness, referential integrity, stable ordering, complete history, UTC, non-null keys, warehouse optimizer …
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Generated by scripts/build_targets.py from src/skills. Edit the source and rebuild; changes made here are overwritten. -->Self-contained install.
<skill-dir>is the directory holding this file: substitute its absolute path in the commands below and run them from the repository root. Read<skill-dir>/references/operating-rules.mdbefore acting; it holds the toolkit's always-on rules, which this install cannot load on its own. This install has no safety hooks, so the approvals those rules describe rest on you and the agent rather than on an enforced gate.
SQL Review
Produce an evidence-based review; do not rewrite or execute SQL unless the user asks.
When to use
- Review SQL files, pasted queries, dbt models, warehouse transformations, or SQL changes.
- Assess correctness, grain, joins, null handling, temporal logic, portability, cost, and readability.
- Do not use as a substitute for incident investigation or full dimensional-model review.
Required context
Obtain, or explicitly mark missing:
- SQL text or diff and SQL dialect/warehouse.
- Intended business result, output grain, keys, and time semantics.
- Source schemas, constraints, representative cardinalities, and materialization context.
- Runtime/query-plan evidence when performance is in scope.
Default silently to Work mode and prioritize actionable findings. In Learn mode, explain reasoning and use progressive hints; show a solution only after attempts and an explicit request. In Assessment mode, evaluate independently without revealing or constructing the answer.
Inspection procedure
- Establish intent, output grain, dialect, and execution context.
- Read the complete query and directly referenced definitions before judging a fragment.
- Trace CTEs and subqueries from sources to output; record grain changes.
- Inspect filters, three-valued logic, type coercion, timestamps/time zones, and boundary conditions. Treat every hard-coded reporting horizon, start date, end date, and rolling window as an output-scope decision: tie it to the stated requirement or flag it for removal or explicit authorization and parameterization.
- Inspect joins for key completeness, fanout, dropped rows, many-to-many behavior, and null matching.
- Inspect aggregations, windows, deduplication, ordering determinism, and metric definitions.
- Inspect incremental logic, late-arriving data, idempotency, and destructive statements when present.
- Assess performance only from defensible signals: scan shape, repeated work, predicates, join strategy, query plan, or runtime.
- Separate verified defects from risks and questions. Consolidate duplicate findings.
- Report using the standard report.
Read-only inspection is allowed. Execution, database access, query-plan generation, connected warehouse use, or edits require an explicit user trigger; any potentially costly or mutating action requires approval immediately before it.
Decision framework
Assign the lowest defensible severity:
- BLOCKER — likely data corruption, destructive behavior, security/privacy exposure, or materially wrong production output across normal inputs; merging/running must stop.
- HIGH — probable material correctness, grain, metric, or reliability defect with significant business impact.
- MEDIUM — bounded correctness, maintainability, portability, or performance risk worth fixing.
- LOW — minor robustness or clarity issue with limited impact.
- INFO — question, observation, or optional improvement; not a defect.
Every BLOCKER/HIGH finding must include concrete evidence: exact location, triggering input or logical path, expected versus actual behavior, impact, and why the severity follows. Without that evidence, lower the severity or state a question. Style alone is never BLOCKER/HIGH.
Failure modes
- Reviewing syntax without validating business grain.
- Assuming keys are unique, joins are one-to-one, or timestamps share a zone.
- Calling a hypothetical edge case a production defect.
- Giving generic performance advice without a plan, runtime, or scan-based rationale.
- Treating dialect-specific valid SQL as invalid.
- Hiding several defects inside one broad finding.
Evidence required
Each finding identifies file/CTE and line or unique snippet, the violated invariant, evidence, impact, and smallest safe remediation. Distinguish:
- Observed: directly shown by SQL, schema, plan, test, or output.
- Inferred: follows from stated constraints.
- Unknown: requires a named check.
BLOCKER/HIGH findings require observed or strongly constrained evidence, never preference.
Output contract
Return # SQL Review with these sections, in order: Summary; Critical Issues; Warnings; Grain & Cardinality; Correctness; Performance; Maintainability; Recommended Changes; Verification Queries; Learning Note.
Within Grain & Cardinality, state Expected grain, Actual/possible grain, and Cardinality risk when evidence permits. Use BLOCKER, HIGH, MEDIUM, LOW, and INFO. A clean review must still state inspected scope and residual uncertainty.
Keep one primary home for each finding and cross-reference it instead of repeating it across sections. Prioritize material correctness over style. Default to the 3–5 verification queries that best distinguish the major risks, each with an expected result. Do not include a full rewritten query unless the user asks for one.
Section count follows the query, not the template. On a short query with nothing to report under a heading, omit the heading rather than printing it empty; ten headings over a twenty-line query is a report about the format, and it buries the one finding that mattered. Summary, and any section carrying a real finding, are never omitted, and a BLOCKER or HIGH always keeps its full evidence. When a formal review was explicitly requested, or the change is a pull request or a published contract, return every section so the reader can see which checks came back clean.
Verification
Before finalizing:
- Re-trace each finding against the actual SQL and intended grain.
- Reconcile every literal date/window restriction with the declared reporting scope; acknowledging a missing requirement is insufficient if the recommendation silently preserves the restriction.
- Ensure every BLOCKER/HIGH has the required evidence.
- Check severity consistency and remove duplicates.
- Confirm suggested SQL matches the declared dialect.
- Label all unexecuted checks and unresolved assumptions.
Safety/privacy
- Never execute mutating SQL, production queries, or expensive scans without explicit approval.
- Prefer metadata, sampled, bounded, or dry-run evidence.
- Do not expose credentials, raw sensitive values, or unnecessary row-level data.
- Redact secrets and protected identifiers in excerpts and reports.
What not to assume
Do not assume source uniqueness, referential integrity, stable ordering, complete history, UTC, non-null keys, warehouse optimizer behavior, acceptable cost, metric definitions, or that passing syntax means correct analytics.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

