sql-queries
by phurynThe sql-queries skill turns business questions and rough analytics goals into optimized SQL for BigQuery, PostgreSQL, MySQL, and other dialects. It reads schema context, clarifies filters and aggregations, and helps with sql-queries for Data Analysis, reporting, and exploration.
This skill scores 78/100, which means it is a solid listing candidate for directory users who want a natural-language SQL generator with enough operational guidance to be useful. It is clear enough to install with confidence, though users should note the repository is mostly a single SKILL.md and lacks extra support files or a documented install command.
- Strong triggerability: the frontmatter says it generates SQL from natural language and covers common dialects like BigQuery, PostgreSQL, and MySQL.
- Good operational clarity: the workflow breaks the task into schema understanding, request processing, query generation, and explanation/testing.
- Useful agent leverage: it explicitly handles uploaded schemas/diagrams, performance considerations, and alternative approaches.
- No install command or companion files are provided, so adoption is mostly driven by the SKILL.md content alone.
- The excerpt shows examples but not any repository-level scripts, references, or rules, which limits trust signals for edge-case execution.
Overview of sql-queries skill
What the sql-queries skill does
The sql-queries skill turns business questions and rough analytics goals into SQL for common warehouses and databases. It is most useful when you know the outcome you want, but not the exact joins, filters, aggregations, or dialect syntax needed to get there.
Who should use it
Use sql-queries if you are a product manager, analyst, data engineer, or AI user working on reporting, exploration, or ad hoc analysis. It is especially helpful for sql-queries for Data Analysis when you need a query that matches a specific schema instead of a generic template.
Why it is different
This skill is not just “write SQL from a prompt.” It expects schema context, asks for the target dialect, and tries to produce optimized, explainable output. That makes it better when query correctness, performance, and table relationships matter more than speed alone.
How to Use sql-queries skill
Install sql-queries
Install the skill from the repo path with:
npx skills add phuryn/pm-skills --skill sql-queries
For sql-queries install, verify the skill is added under pm-data-analytics/skills/sql-queries and then open the skill file before using it in a workflow.
Start with the right inputs
The best sql-queries usage starts with three things: the question, the SQL dialect, and the schema. A strong prompt says what metric or rows you need, the date range or filters, and any grouping or sorting rules.
Good input:
- “Write a PostgreSQL query to show weekly active users by signup cohort for the last 12 weeks.”
- “Use this BigQuery schema to find top 20 customers by total revenue, excluding refunds.”
Weak input:
- “Make a SQL query for my data.”
Read the repo files first
Open SKILL.md first, then inspect any nearby repository guidance such as README.md, AGENTS.md, metadata.json, or supporting folders if they exist. In this repo, SKILL.md is the main source of truth, so the fastest path is to read the purpose, workflow steps, and example patterns before prompting.
Shape the request for better output
Give the skill enough structure to infer joins and metrics correctly. Include table names if you know them, note whether you want a CTE-based query or a compact one, and say whether the result should be ready to run or heavily commented. If the database is large, mention performance constraints such as limiting scans, avoiding cross joins, or preferring date partition filters.
sql-queries skill FAQ
Is sql-queries only for experienced SQL users?
No. It can help beginners, but the result is much better when you can name the data you want in plain language. If you cannot describe the metric, grain, or date window, the query may need several iterations.
What databases does sql-queries support?
The skill is described for BigQuery, PostgreSQL, MySQL, and other dialects, and it explicitly asks you to confirm the target engine. That dialect check matters because functions, quoting, date handling, and performance patterns differ.
When should I not use sql-queries?
Do not use it if you need a fully validated production query and you cannot provide schema detail, or if the task is closer to database design than query writing. It is also a weaker fit when the question is too vague to translate into a measurable result.
How is this different from a normal prompt?
A normal prompt may produce a plausible query, but the sql-queries skill pushes the workflow toward schema reading, dialect selection, optimization, and testability. That reduces guesswork when the query depends on real table structure.
How to Improve sql-queries skill
Give schema and intent together
The biggest quality boost comes from pairing the business question with table structure. Share column names, relationships, and known edge cases so the skill can choose the right join path and aggregation grain instead of inventing one.
State constraints that change the query
If you care about performance, say so. Mention whether to exclude nulls, deduplicate users, handle refunds, respect time zones, or filter on partitioned dates. These details often change the SQL more than the wording of the question.
Ask for validation on the first pass
A strong sql-queries guide workflow is: generate the query, review the assumptions, then ask for a second version if anything looks off. If the first answer is too broad, ask the skill to simplify joins, explain each CTE, or rewrite for a different dialect.
Use the output as a draft, not a blind final
The skill is best when you treat it as a query accelerator. Review the join keys, grouping level, and filter logic before running it, especially for sql-queries for Data Analysis where a small grain mismatch can distort the result.
