Agent skill · data analytics · borghei

sql-database-assistant

This skill should be used when the user asks to "optimize SQL queries", "explore database schemas", "generate migration SQL", "analyze query performance", or "document database structure".

Why this skill is useful

Adds 3 executable scripts for SQL query optimization, schema exploration, and migration generation that provide capabilities not commonly found in public documentation.

What it needs

Requires python installed locally. About 4k tokens when loaded. Last updated 2026-07-21. 462 stars on the source repository.

What this skill does

SQL Database Assistant Category: Engineering Domain: Database Development & Optimization Overview The SQL Database Assistant skill provides tools for analyzing SQL query performance, exploring database schemas from DDL files, and generating migration SQL from schema differences. It helps teams write efficient queries, maintain clean schemas, and manage database evolution safely. Clarify First Before analyzing or generating, confirm these inputs. If any is unknown or vague, ASK — do not assume: [ ] Task — query optimization / schema documentation / migration generation (selects the script) [ ] SQL input — the query, the DDL file, or the from/to schema pair to operate on (the script's actual input) [ ] Target database / dialect — Postgres / MySQL / etc. (changes index recommendations and migration SQL syntax) Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact. Quick Start Tools Overview queryoptimizer.py Analyzes SQL queries for performance issues and optimization opportunities. Feature Description --------- ------------- SELECT detection Flags queries selecting all columns Missing index hints Identifies WHERE/JOIN columns likely needing indexes N+1 detection Flags correlated subquery patterns Full table scan Detects queries without WHERE clauses on large tables JOIN analysis Checks join conditions and types LIKE optimization Flags leading wildcard LIKE patterns schemaexplorer.py Generates documentation from SQL DDL (CREATE TABLE) files. Feature Description --------- ------------- Table catalog Lists all tables with column counts Column details Documents types, nullability, defaults Index listing Catalogs indexes and their columns Relationship mapping Identifies foreign key relationships Markdown output Generates schema documentation migrationgenerator.py Generates migration SQL by comparing two schema DDL files. …

How to use it

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

@skills borghei/sql-database-assistant

View the source on GitHub

Browse the @skills marketplace