sql-queries skill
✓ VerifiedGenerates optimized SQL queries from natural language descriptions across multiple database dialects using provided schemas.
- GitHub stars
- 27,887
- Files
- 1
- Last commit
- Nov 8, 2026
- License
- MIT
- Allowed tools
- —
What does the sql-queries skill do?
sql-queries generates optimized SQL queries from natural language descriptions across multiple database dialects using provided schemas.
Summary generated from the skill's SKILL.md.
About the sql-queries skill
Translating business questions into production-ready code is what this skill enables for analysts, engineers, and product managers. By reading uploaded schema files, SQL dumps, or documentation, the agent understands table names, column definitions, and relationships to build accurate queries. It functions as a bridge between natural language requirements and technical execution across various database environments.
An agent should load this tool when a user needs to explore a database or build data reports without manual syntax construction. It supports multiple dialects including BigQuery, PostgreSQL, MySQL, Snowflake, and SQL Server. The output includes the optimized SQL code, plain English explanations of the logic, and performance considerations for large datasets. Users can also request additional assets like test scripts or sample data to validate their results.
What an agent can do with it
- 1Generate queries from schema filesCreate a specific data retrieval query by uploading a SQL schema file and describing the desired outcome.
- 2Perform complex multi-dialect analysisDevelop advanced analytical queries for specific platforms like BigQuery to track business metrics.
- 3Convert diagram descriptions to SQLTurn a text-based description of tables and columns into a functional query.
- 4Optimize database performanceReceive suggestions for indexing and partitioning to improve query efficiency.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the sql-queries skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the sql-queries skill in Plugin
/plugin marketplace add phuryn/pm-skills /plugin install pm-data-analytics@pm-skills
Install the sql-queries skill in Claude Code
~/.claude/skills/sql-queries/SKILL.md
$ npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries ~/.claude/skills/sql-queriesInstall the sql-queries skill in Claude Code (project)
.claude/skills/sql-queries/SKILL.md
$ npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries .claude/skills/sql-queriesInstall the sql-queries skill in Codex
~/.agents/skills/sql-queries/SKILL.md
$ npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries ~/.agents/skills/sql-queriesInstall the sql-queries skill in Gemini CLI
~/.gemini/skills/sql-queries/SKILL.md
$ npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries ~/.gemini/skills/sql-queriesInstall the sql-queries skill in Claude.ai
npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries sql-queries && zip -r sql-queries.zip sql-queries # claude.ai → Customize → Skills → + → Create skill → Upload a skill → sql-queries.zip
Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachablephuryn/pm-skills/pm-data-analytics/skills/sql-queries is public and reachablegithub.com/phuryn/pm-skills/tree/HEAD/pm-data-analytics/skil ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-08github.com/phuryn/pm-skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/phuryn/pm-skills/blob/HEAD/pm-data-analytics/skil ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/phuryn/pm-skills/blob/HEAD/pm-data-analytics/skil ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 88 linesgithub.com/phuryn/pm-skills/blob/HEAD/pm-data-analytics/skil ↗Pass
SKILL.md
View on GitHubSQL Query Generator
Purpose
Transform natural language requirements into optimized SQL queries across multiple database platforms. This skill helps product managers, analysts, and engineers generate accurate queries without manual syntax work.
How It Works
Step 1: Understand Your Database Schema
- If you provide a schema file (SQL, documentation, or diagram description), I will read and analyze it
- Extract table names, column definitions, data types, and relationships
- Identify primary keys, foreign keys, and indexing strategies
Step 2: Process Your Request
- Clarify the exact data you need to retrieve or analyze
- Confirm the SQL dialect (BigQuery, PostgreSQL, MySQL, Snowflake, etc.)
- Ask for any additional requirements (filters, aggregations, sorting)
Step 3: Generate Optimized Query
- Write efficient SQL that leverages your database structure
- Include comments explaining complex logic
- Add performance considerations for large datasets
- Provide alternative approaches if applicable
Step 4: Explain and Test
- Explain the query logic in plain English
- Suggest how to test or validate results
- Offer tips for performance optimization
- If you want, generate a test script or sample data
Usage Examples
Example 1: Query from Schema File
Upload your database_schema.sql file and say:
"Generate a query to find users who signed up in the last 30 days
and had at least 5 active sessions"
Example 2: Query from Diagram Description
"Here's my database: Users table (id, email, created_at), Sessions table
(id, user_id, timestamp, duration). Generate a query for average session
duration per user in January 2026."
Example 3: Complex Analysis Query
"Create a BigQuery query to analyze our revenue by region and customer tier,
including year-over-year growth rates."
Key Capabilities
- Multi-Dialect Support: Works with BigQuery, PostgreSQL, MySQL, Snowflake, SQL Server
- File Reading: Reads schema files, SQL dumps, and data documentation
- Query Optimization: Suggests indexes, partitioning, and performance improvements
- Explanation: Breaks down queries for learning and documentation
- Testing: Can generate test queries and sample data scripts
- Script Execution: Create executable SQL scripts for your database
Tips for Best Results
- Provide context: Share your database schema or structure
- Be specific: Clearly describe what data you need and any filters
- Mention database: Specify which SQL dialect you're using
- Include constraints: Mention data volume, time ranges, and performance needs
- Request format: Ask for the query result format if you need specific output
Output Format
You'll receive:
- SQL Query: Production-ready SQL code with comments
- Explanation: What the query does and how it works
- Performance Notes: Optimization tips and considerations
- Test Script (if requested): Sample data and validation queries
Further Reading
Files in this skill
1sql-queries skill questions
How do I install the sql-queries skill in Claude Code?
Run npx degit phuryn/pm-skills/pm-data-analytics/skills/sql-queries ~/.claude/skills/sql-queries. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the sql-queries skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
Which database dialects are supported?
The skill supports multiple dialects including BigQuery, PostgreSQL, MySQL, Snowflake, and SQL Server.
Can I use my own database schema to generate queries?
Yes, you can upload schema files such as SQL dumps, documentation, or diagram descriptions for the agent to analyze.
Does the tool provide explanations for the generated code?
Yes, it provides production-ready SQL code along with an explanation of what the query does and how it works.