sql-database-assistant

Generates SQL queries, migrations, and schema documentation across PostgreSQL, MySQL, SQLite, and SQL Server.

2|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/BryanPinheiro77/FinanceBot-BackEnd --skill sql-database-assistant-bryanpinheiro77
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-database-assistant
Source: https://github.com/BryanPinheiro77/FinanceBot-BackEnd/tree/main/.agents/skills/sql-database-assistant
Command: npx skills add https://github.com/BryanPinheiro77/FinanceBot-BackEnd --skill sql-database-assistant-bryanpinheiro77

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Writing correct, performant SQL and safe schema migrations is error-prone, especially when switching between database dialects or ORMs. This Skill translates natural-language requirements into dialect-aware SQL, statically analyzes queries for performance anti-patterns, and generates reversible migration scripts with rollback plans. ## Core Features & Use Cases - Natural Language to SQL: Translates requirements into queries using JOINs, CTEs, window functions, UPSERTs, and pagination patterns across PostgreSQL, MySQL, SQLite, and SQL Server. - Query Optimization: Static analysis detects SELECT *, non-sargable predicates, cartesian joins, N+1 risks, and missing LIMITs, with EXPLAIN plan reading and index-type guidance. - Migration Generation: Produces up/down migration scripts in SQL, Prisma, or Alembic formats with zero-downtime patterns like expand-contract renames and concurrent index creation. - ORM Integration: Side-by-side patterns for Prisma, Drizzle, TypeORM, and SQLAlchemy covering CRUD, eager loading, transactions, and migration workflows. - Use Case: Ask for a migration to add an email_verified column to a users table, and receive a dialect-specific up/down script with warnings about irreversible operations. ## Quick Start Ask the assistant to generate a PostgreSQL migration that adds an index on orders(status, created_at) and to review your existing query for performance issues.

Frequently Asked Questions about sql-database-assistant

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a database migration from a text description?▼

Run the migration_generator.py script with a --change flag describing the operation, such as "add email_verified boolean to users". It outputs dialect-specific up and down SQL, with optional Prisma or Alembic formatting and warnings for irreversible changes.

How to detect SQL query performance problems automatically?▼

Use the query_optimizer.py script to statically analyze SQL for issues like SELECT *, missing WHERE on UPDATE/DELETE, cartesian joins, non-sargable functions, leading-wildcard LIKE, and NOT IN subqueries. Each issue includes severity, explanation, and a rewrite suggestion.

Does this support both PostgreSQL and MySQL syntax differences?▼

Yes, it covers dialect differences for PostgreSQL, MySQL, SQLite, and SQL Server, including UPSERT syntax, boolean types, auto-increment, JSON handling, and LIMIT/OFFSET variants. Introspection queries and migration output are generated per dialect.

Prisma vs TypeORM vs SQLAlchemy migration workflows?▼

Prisma uses migrate dev with SQL files, TypeORM uses migration:generate producing TypeScript files, and SQLAlchemy uses Alembic with autogenerate producing Python revision files. The references include side-by-side commands and file layouts for each.

Why does my query ignore the index on a date column?▼

Wrapping the column in a function like YEAR(created_at) makes the predicate non-sargable, so the optimizer cannot use the index. Rewrite it as a range comparison such as created_at >= '2025-01-01' AND created_at < '2026-01-01'.

When should I not use offset pagination?▼

Offset pagination degrades on deep pages because the database scans and discards all preceding rows. Use keyset pagination with a WHERE clause on the last seen id or sort key for consistent performance on large tables.