Independent directory — not affiliated with Anthropic. Learn more

SQL Query Builder

Development — Database

Converts natural language to optimized SQL. Supports PostgreSQL, MySQL, SQLite, and BigQuery. Explains query logic, suggests indexes, and warns about N+1 queries before they reach production.

2,300+ downloads
4.9 rating
by official
Updated May 2026
SQL Database PostgreSQL MySQL Data

What it does

SQL Query Builder bridges the gap between plain English and production-ready SQL. Describe what data you need in natural language and the skill generates correct, optimized queries for your target database dialect — whether that is PostgreSQL, MySQL, SQLite, or BigQuery. It reads your schema context when provided, which means it uses real table and column names rather than generic placeholders.

Beyond generation, the skill acts as a query review layer. It annotates the output with a brief explanation of the join strategy chosen, flags any subqueries that could trigger N+1 execution plans, and suggests indexes that would measurably improve performance for the generated query pattern. Every query comes with an estimated complexity label so you understand the potential load before running it.

How to install

bash
npx skills add user/sql-query-builder

How to use

Describe your query goal in plain English. Optionally prefix with the target dialect and paste your schema DDL for precise output:

prompt
# Target: PostgreSQL
Get all users who signed up last month
and have made at least 3 purchases.

The skill produces an annotated SQL block:

sql
-- PostgreSQL · estimated complexity: LOW
SELECT
  u.id,
  u.email,
  u.created_at,
  COUNT(o.id) AS purchase_count
FROM users u
INNER JOIN orders o ON o.user_id = u.id
WHERE
  u.created_at >= DATE_TRUNC('month', NOW() - INTERVAL '1 month')
  AND u.created_at <  DATE_TRUNC('month', NOW())
GROUP BY u.id, u.email, u.created_at
HAVING COUNT(o.id) >= 3
ORDER BY purchase_count DESC;

-- Suggested index: CREATE INDEX ON orders (user_id, created_at);

Tip: Paste your CREATE TABLE DDL before your question and the skill will use your exact column names, respect foreign key relationships, and avoid generating queries that reference non-existent columns.

Supported dialects

  • PostgreSQL — window functions, CTEs, JSONB operators, array types
  • MySQL / MariaDB — dialect-specific date functions, GROUP_CONCAT
  • SQLite — lightweight syntax, no stored procedures
  • BigQuery — partitioned tables, STRUCT/ARRAY types, standard SQL mode