๐ Data AnalysisNew this weekintermediate
Schema-Grounded SQL Generator (with Tests and Explanations)
Generate correct SQL from plain-English questions by grounding the model in your real schema โ with dialect awareness, assumptions, a query explanation, sanity checks and optional test data.
What it produces
The prompt
๐
Unlock this prompt
~280 words, copy-paste ready. Pro members get this and every other prompt โ plus a new drop each week.
How to use it
- Paste the prompt with your real schema (e.g. from
\d+ tablein psql or your warehouse's information_schema). - Run the sanity-check queries before trusting the numbers.
- In Claude Code with the Postgres MCP server (read-only mode), the agent can inspect the schema and run the checks itself.