Agent skill · data analytics · alirezarezvani

sql-database-assistant

Write, fix and speed up SQL: slow queries, EXPLAIN plans, indexes, ORM migrations (Prisma, Drizzle, SQLAlchemy). Load whenever a query is slow or wrong, the user needs SQL written, or an ORM migration.

Why this skill is useful

Adds 3 executable scripts for query optimization, migration generation, and schema exploration that enhance database interaction capabilities.

What it needs

Requires python installed locally. About 9k tokens when loaded. Last updated 2026-08-05. 23,939 stars on the source repository.

What this skill does

SQL Database Assistant - POWERFUL Tier Skill Overview The operational companion to database design. While database-designer focuses on schema architecture and database-schema-designer handles ERD modeling, this skill covers the day-to-day: writing queries, optimizing performance, generating migrations, and bridging the gap between application code and database engines. Core Capabilities Natural Language to SQL — translate requirements into correct, performant queries Schema Exploration — introspect live databases across PostgreSQL, MySQL, SQLite, SQL Server Query Optimization — EXPLAIN analysis, index recommendations, N+1 detection, rewrite patterns Migration Generation — up/down scripts, zero-downtime strategies, rollback plans ORM Integration — Prisma, Drizzle, TypeORM, SQLAlchemy patterns and escape hatches Multi-Database Support — dialect-aware SQL with compatibility guidance Tools Script Purpose -------- --------- scripts/queryoptimizer.py Static analysis of SQL queries for performance issues scripts/migrationgenerator.py Generate migration file templates from change descriptions scripts/schemaexplorer.py Generate schema documentation from introspection queries --- Natural Language to SQL Translation Patterns When converting requirements to SQL, follow this sequence: 1. Identify entities — map nouns to tables 2. Identify relationships — map verbs to JOINs or subqueries 3. Identify filters — map adjectives/conditions to WHERE clauses 4. Identify aggregations — map "total", "average", "count" to GROUP BY 5. Identify ordering — map "top", "latest", "highest" to ORDER BY + LIMIT Common Query Templates Top-N per group (window function) Running totals Gap detection UPSERT (PostgreSQL) UPSERT (MySQL) See references/querypatterns.md for JOINs, CTEs, window functions, JSON operations, and more. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills alirezarezvani/sql-database-assistant--864f8c

View the source on GitHub

Browse the @skills marketplace