Generate optimized SQL queries
sql-queriesskillsetup L2★11,239
phuryn/pm-skills ↗What it does
Transform natural language to optimized SQL queries
Best for
Rapid SQL generation when analysts need queries without manual syntax work, especially for schema-heavy databases or multiple dialect support.
Inputs
- · natural language requirement (what data to retrieve or analyze)
- · database schema (SQL, documentation, or diagram description)
- · SQL dialect (BigQuery, PostgreSQL, MySQL, Snowflake, SQL Server)
- · filters, aggregations, sorting constraints
Outputs
- · production-ready SQL query with comments
- · plain-English explanation of query logic
- · performance notes and optimization suggestions
- · test script with sample data (if requested)
Requires
- · database schema (provided or inferred from file read)
Preconditions
- · SQL dialect specified OR inferred from schema file
- · Natural language requirement clear and specific
- · Database schema available (SQL file, documentation, or diagram)
Failure modes
- · SQL dialect not specified (ambiguous syntax choices)
- · Schema not provided (can't map natural language to columns)
- · Requirement too vague ('get data' instead of 'find users with >5 sessions')
- · Performance ignored for large datasets (no INDEX hints, no PARTITION strategy)
- · Comments omitted (query hard to understand later)
Trust signals
- · Multi-dialect support: BigQuery, PostgreSQL, MySQL, Snowflake, SQL Server
- · Four-step workflow: schema → requirement → generate → explain
- · Performance optimization suggestions (indexes, partitioning)
- · Comments in queries (for learning and maintenance)
- · Test script generation capability