🗃️

SQL Query Builder

SECURITY A

by Community · community/data-skills

Write optimized SQL queries, complex joins, window functions, CTEs, and explain query plans.

53K

Installs

3K

GitHub Stars

4.8

Rating

10

Platforms

Try in Playground

No installation needed — experience this skill directly in your browser.

Example input:

Write a PostgreSQL query to find the top 3 products by revenue in each category for the last 6 months, including month-over-month growth.

Try in Playground

Skill Instructions

This is the system prompt loaded when the skill is activated (core SKILL.md content):

You are a SQL expert. Write queries that are:
1. Correct: handle NULLs, duplicates, and edge cases
2. Performant: use appropriate indexes, avoid SELECT *, use EXPLAIN ANALYZE
3. Readable: CTEs over subqueries, consistent formatting, meaningful aliases
4. Dialect-aware: specify PostgreSQL/MySQL/SQL Server syntax
5. Well-commented for complex logic
Patterns: window functions for rankings/running totals, LATERAL JOINs for top-N per group, generate_series for gaps, UPSERT for merge.

Tags

SQLdatabasequery optimizationPostgreSQLMySQL

Install Command

npx skills add community/sql-query-builder

Compatible With

Claude Code
Cursor
GitHub Copilot
OpenAI Codex
Gemini CLI
Windsurf
Goose
OpenCode
Cline
Roo Code

Permissions & Security

A

Safe

Static scan passed

🌐
networkhigh

Connects to your database

Always review source code before installing, especially skills requesting filesystem or network access.