Schema-Grounded SQL Queries: Plain English to SQL
September 13, 2026

Schema-Grounded SQL Queries is an AI skill that turns a question like "which users signed up in the last 30 days and had at least five sessions?" into a working SQL query — written against your tables, not invented ones. It starts from your database schema, confirms which SQL dialect you use, and hands back the query with a plain-English explanation of what it does.
| Type | AI skill |
| Category | Data & analytics · Developer tools |
| What's inside | 1 skill · no connectors, no database access, no API keys |
| Published on Taku by | Brian Kim |
| Source | phuryn/pm-skills on GitHub |
| Cost to use | Free |
What it does
The usual failure when you ask an AI for SQL isn't bad syntax. It's a confident query against column names that don't exist. This skill is built around avoiding that, in four steps:
1. It reads your schema first. Give it a schema file, a SQL dump, documentation, or a plain description of your tables. It pulls out the database schema — table names, columns, data types, and relationships, including primary keys, foreign keys, and indexes — before writing anything.
2. It pins down the request. It clarifies exactly what data you want, confirms your dialect, and asks about filters, aggregations, and sorting. PostgreSQL and BigQuery don't handle dates or many functions the same way, so this step matters more than it sounds.
3. It writes a commented query. The SQL uses your actual structure, explains complex logic in comments, flags performance considerations for large tables, and offers an alternative approach where there's more than one reasonable way.
4. It explains and helps you test. You get the logic in plain English and suggestions for validating the result. On request, it also writes a test script with sample data.
Supported dialects, per the original: BigQuery, PostgreSQL, MySQL, Snowflake, and SQL Server.
A worked example
Describe two tables — users with an id, email, and signup date, and sessions with an id, user id, timestamp, and duration — and ask for average session duration per user in January. The result looks like this:
-- Average session duration per user, January 2026
SELECT
u.id,
u.email,
AVG(s.duration) AS avg_session_duration
FROM users u
JOIN sessions s ON s.user_id = u.id
WHERE s.timestamp >= '2026-01-01'
AND s.timestamp < '2026-02-01'
GROUP BY u.id, u.email;
Two details are the kind of thing the explanation step exists to surface. The date filter is a half-open range, so sessions late on 31 January aren't silently dropped the way a careless BETWEEN can drop them. And the inner join leaves out users with no January sessions at all — whether that's right depends on your question, which is exactly what step two is there to ask.
What it won't do
- connect to your database or run anything
- see your real data — only the schema and descriptions you provide
- guarantee a query is correct against data it has never seen
Run new queries with a row limit or against a copy first, and spot-check the results by hand. The Taku listing also states that it works only from the materials you supply and labels assumptions and missing information rather than filling gaps silently.
When to reach for it
- You have a business question and know roughly which tables hold the answer
- You're a product manager or analyst who reads SQL better than you write it
- You're exploring an unfamiliar database and want a documented starting query
- You need the same report in a different dialect after a warehouse move
- You want a query explained line by line before you trust it
What's actually inside
One skill file. No connectors, no database access, no API keys. It sits in the data analytics section of a larger public collection of skills for product managers, and it's written for PMs, analysts, and engineers alike.
Setting it up
The GitHub route. The skill is one folder, pm-data-analytics/skills/sql-queries, inside a large repository organised by product-management discipline. Download or clone the repository, find that folder, copy it into the skills directory your AI tool reads from, and restart the tool. Then have your schema to hand — exported from the database or copied from your migration files.
The Taku route. Open it in Taku, give it your schema, and ask your question.
Neither route connects the skill to your database. You still run the query yourself — which, for anything touching production data, is how it should be.
Who made it
Written by Pawel Huryn as part of the pm-skills repository. Pawel Huryn also publishes The Product Compass, which the skill points to for further reading on product analytics. Published to the Taku marketplace by Brian Kim.
If you're not the SQL person on your team
You don't need to understand GitHub, Codex, or Claude Code to use this skill. Those are where most AI skills live, and they assume you're comfortable with repositories and terminals — which usually describes the engineer you were hoping not to interrupt for one query.
Taku is a desktop app built for that gap: find something useful someone already built, open it in your own workspace, and use it without setup. Browse the free app library for more, or see AI data visualization tools for turning query results into charts. Brian Kim also publishes Web App Testing for Taku for checking the app that sits on top of that data.
Download Taku and ask your next data question in plain English. Taku is in Beta, and the Mac app is available now; there's also an experimental, unsigned Windows build for Windows 10 and 11.
FAQ
What does the Schema-Grounded SQL Queries skill do?
It reads your database schema, clarifies your request and SQL dialect, then writes a commented query with a plain-English explanation, performance notes, and optional test data.
Which SQL dialects does it support?
BigQuery, PostgreSQL, MySQL, Snowflake, and SQL Server, according to the original skill.
Does it connect to my database?
No. It works only from the schema and descriptions you provide, and it doesn't run queries. You run them yourself.
Can I use it if I don't know SQL well?
Yes — that's who it was written for, alongside engineers. The explanation step walks through what each part of the query does, so you can check it matches your question.
Is it free?
The skill is free. You need an AI tool that can run it. For what Taku costs, see pricing.
Key points
- Turns plain-English questions into SQL grounded in your actual schema.
- Reads the schema first, then confirms the request and dialect before writing.
- Returns commented SQL, a plain-English explanation, and performance notes.
- Never connects to your database — you run and verify the query.
- Supports BigQuery, PostgreSQL, MySQL, Snowflake, and SQL Server.