sql-query-reviewlisted
Install: claude install-skill vermapragya/analytics-skill
# SQL Query Review
## When to use this skill
Use when reviewing or improving a SQL query **from its text alone** — no query profile or runtime stats required. Triggers:
- "Review this query"
- "Check my SQL before I ship it"
- "Can this query be written better?"
- "Optimize this query" (when no query_history / profile is available)
- PR review of a `.sql` file
Routing to related skills:
- Runtime stats available (query_history, query profile, spilling)? → `warehouse-query-optimization`
- Suspected **wrong results** (dupes, fanout, missing rows)? → `sql-correctness-review`
- Query is correct and fast but unreadable? → `modular-sql-ctes`
A full review often chains all three: correctness first, then this skill, then runtime profiling if still slow.
## Required inputs
| Input | Why it matters |
|---|---|
| Query text | The thing being reviewed |
| Intent (one sentence) | "What question does this answer?" — catches queries that are fast but wrong |
| Expected output grain | One row per what? Needed to judge joins and aggregates |
| Approx table sizes | A `SELECT *` on 1K rows is fine; on 1B rows it's a finding |
| Run frequency | One-off ad-hoc vs hourly pipeline changes the bar |
If table sizes / frequency are unknown, review anyway and mark size-dependent findings as conditional.
## Workflow
1. **Restate intent and grain.** One sentence each. If you can't infer them from the query, ask — every later judgment depends on this.
2. **Correctness scan first.** Optimizing