Agent skill · data analytics · aiskillstore
sql-expert
Expert SQL query writing, optimization, and database schema design with support for PostgreSQL, MySQL, SQLite, and SQL Server. Use when working with databases for: (1) Writing complex SQL queries with joins, subqueries, and window functions, (2) Optimizing slow queries and analyzing execution plans, (3) Designing database schemas with proper normalization, (4) Creating indexes and improving query performance, (5) Writing migrations and handling schema changes, (6) Debugging SQL errors and query issues
Why this skill is useful
Provides domain-specific knowledge on SQL query optimization, schema design, and complex query patterns that the AI wouldn't reliably generate on its own.
What it needs
Requires mysql-connector-python, psycopg2-binary, pyodbc, sqlite3 installed locally. About 7k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
SQL Expert Skill Expert guidance for writing, optimizing, and managing SQL databases across PostgreSQL, MySQL, SQLite, and SQL Server. Core Capabilities This skill enables you to: Write complex SQL queries with JOINs, subqueries, CTEs, and window functions Optimize slow queries using EXPLAIN plans and index recommendations Design database schemas with proper normalization (1NF, 2NF, 3NF, BCNF) Create effective indexes for query performance Write database migrations safely with rollback support Debug SQL errors and understand error messages Handle transactions with proper isolation levels Work with JSON/JSONB data types Generate sample data for testing Convert between database dialects (PostgreSQL ↔ MySQL ↔ SQLite) --- Supported Database Systems PostgreSQL Best for: Complex queries, JSON data, advanced features, ACID compliance MySQL/MariaDB Best for: Web applications, WordPress, high-read workloads SQLite Best for: Local development, embedded databases, testing SQL Server Best for: Enterprise applications, Windows environments --- Query Writing Basic SELECT with JOINs Subqueries and CTEs Window Functions See examples/complexqueries.sql for more advanced query patterns. --- Query Optimization Using EXPLAIN Quick Optimization Tips For comprehensive optimization techniques, see references/query-optimization.md. --- Schema Design Normalization Principles First Normal Form (1NF): Eliminate repeating groups, use atomic values Second Normal Form (2NF): All non-key attributes depend on entire primary key Third Normal Form (3NF): No transitive dependencies Common Schema Patterns One-to-Many: Many-to-Many: See examples/schemaexamples.sql for more schema patterns. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/sql-expert