Best Practices 11 min read

Best AI Skills for SQL and Database Development [2026]

We installed and scored 13 database skills. These 5 stood out — with 3,000+ lines of Postgres rules, query optimization patterns, and migration playbooks.

We installed 13 SQL and database skills and read every file. Most fell into two categories: vendor-specific setup guides that tell the AI how to configure a particular product, or internal contributor docs repackaged as skills (how to debug Turso’s MVCC implementation, for example — useful if you’re contributing to Turso, not if you’re writing queries). The five skills below contain actual SQL patterns, indexing strategies, schema design rules, and migration playbooks that apply to real database work. We scored each on five dimensions and we’ll show you what’s inside.

How We Scored

Each skill was scored across five dimensions, 0-10 each, for a maximum of 50 points:

  • Relevance — Does it address real SQL/database concerns (query optimization, schema design, migrations)?
  • Depth — How much actual content? Specific SQL patterns, index strategies, not vague advice.
  • Actionability — Can a developer follow the guidance to write better queries or design better schemas?
  • Structure — Is the skill well-organized with clear coverage areas?
  • Adoption — Install count + stars as proxy for real-world validation.

We scored by reading the installed skill files — not descriptions, not README summaries.

Quick Comparison

SkillScoreKey FeatureDatabases / ToolsInstalls
@supabase/supabase-postgres-best-practices45/5033 rule files across 8 priority categoriesPostgreSQL, Supabase, pgvector, RLS5,732
@wshobson/sql-optimization-patterns43/50EXPLAIN analysis + 5 optimization patternsPostgreSQL, MySQL, SQL Server3,370
@planetscale/postgres41/50Full Postgres operations referencePostgreSQL, PlanetScale1,722
@softaworks/database-schema-designer39/50Normalization through deployment pipelineDatabase-agnostic (SQL)2,877
@wshobson/database-migration38/50ORM migrations + zero-downtime strategiesPrisma, Drizzle, TypeORM, Alembic2,604

1. @supabase/supabase-postgres-best-practices — 45/50

Score: 45/50 | Relevance: 10 · Depth: 10 · Actionability: 9 · Structure: 9 · Adoption: 7

The most comprehensive Postgres skill in the registry. Thirty-eight files totaling 1,852 lines, organized into 33 individual rule files across 8 categories ranked by impact: Query Performance (critical), Connection Management (critical), Security & RLS (critical), Schema Design (high), Concurrency & Locking (medium-high), Data Access Patterns (medium), Monitoring & Diagnostics (low-medium), and Advanced Features (low).

Every rule file follows the same structure: why it matters, incorrect SQL with explanation, correct SQL with explanation, optional EXPLAIN output, and Supabase-specific notes. The query-missing-indexes.md file shows the exact EXPLAIN cost difference between a sequential scan (cost=0.00..25000.00) and an index scan (cost=0.42..8.44) on the same query. The schema-partitioning.md file walks through range partitioning with concrete examples of partition creation by month, explains when to partition (tables over 100M rows), and shows how DROP TABLE on a partition is instant versus DELETE taking hours.

The breadth is what separates this skill. It covers connection pooling (conn-pooling.md, conn-limits.md, conn-idle-timeout.md), locking strategies (lock-advisory.md, lock-deadlock-prevention.md, lock-skip-locked.md), RLS performance (security-rls-performance.md), JSONB indexing (advanced-jsonb-indexing.md), full-text search (advanced-full-text-search.md), and N+1 detection (data-n-plus-one.md). Each is a standalone reference the AI can pull in on demand rather than loading everything into context at once.

The priority ranking is the design decision that makes this skill work in practice. An AI agent encountering a slow query will check query-performance rules first, not advanced features. That ordering is baked into the skill structure.

skillsafe install @supabase/supabase-postgres-best-practices

2. @wshobson/sql-optimization-patterns — 43/50

Score: 43/50 | Relevance: 9 · Depth: 9 · Actionability: 9 · Structure: 8 · Adoption: 8

A single 499-line SKILL.md that packs more actionable SQL into one file than most skills manage across a dozen. From github.com/wshobson/agents (374 stars, 3,370 installs) — the highest star count of any database skill in the registry.

The skill opens with EXPLAIN analysis — not just EXPLAIN SELECT, but EXPLAIN (ANALYZE, BUFFERS, VERBOSE) with a breakdown of what each metric means: Seq Scan, Index Scan, Index Only Scan, Nested Loop, Hash Join, Merge Join. It then covers all five PostgreSQL index types (B-Tree, Hash, GIN, GiST, BRIN) with specific use cases and CREATE INDEX examples for each, including partial indexes, expression indexes, covering indexes with INCLUDE, and GIN indexes for JSONB and full-text search.

The five optimization patterns are the core value. Pattern 1 (N+1 queries) shows both the Python anti-pattern and two solutions: JOIN and batch loading. Pattern 2 (pagination) demonstrates why OFFSET fails on large tables and provides cursor-based pagination with composite sorting and the supporting index. Pattern 3 (aggregation) shows how to use pg_class.reltuples for approximate counts instead of COUNT(*). Pattern 4 (subqueries) transforms correlated subqueries into JOINs and window functions. Pattern 5 (batch operations) covers multi-row INSERT, batch UPDATE via temporary tables, and COPY for bulk loading.

The advanced section covers materialized views (including concurrent refresh), range partitioning by date, and query hints. The monitoring section provides ready-to-run queries against pg_stat_statements for finding slow queries, pg_stat_user_tables for missing indexes, and pg_stat_user_indexes for unused indexes.

If you install one SQL skill, this is the one. Dense, practical, and proven by adoption.

skillsafe install @wshobson/sql-optimization-patterns

3. @planetscale/postgres — 41/50

Score: 41/50 | Relevance: 8 · Depth: 9 · Actionability: 8 · Structure: 9 · Adoption: 7

Twenty-three files totaling 1,180 lines, split into three sections: generic Postgres, operations and architecture, and PlanetScale-specific. The generic section alone justifies the install — it covers schema design, indexing, index optimization, partitioning, query patterns, an optimization checklist, and MVCC/VACUUM.

The schema-design.md reference makes specific recommendations that differ from generic advice. It prefers BIGINT GENERATED ALWAYS AS IDENTITY over auto-increment, warns against UUIDv4 as primary keys due to index fragmentation (recommending UUIDv7 instead), advocates CHECK constraints over ENUM types because they’re easier to modify, and insists on indexing every foreign key since PostgreSQL does not auto-create these. The naming convention section ({table}_{column}_idx for indexes, {table}_{column}_{type} for constraints) gives the AI concrete patterns to follow rather than improvise.

The operations references go deeper than most skills attempt. mvcc-transactions.md covers isolation levels and XID wraparound prevention. wal-operations.md explains WAL internals and checkpoint tuning. replication.md covers streaming replication, slots, sync commit, and failover. backup-recovery.md covers pg_dump, pg_basebackup, point-in-time recovery, and WAL archiving. These are DBA-level topics that most developer-facing skills skip entirely.

The PlanetScale-specific section covers connection pooling via PgBouncer (with pool sizing guidance), extensions compatibility, connection troubleshooting, and their Insights feature for slow query analysis. If you’re using PlanetScale, this section is directly useful. If you’re not, the generic Postgres content still stands on its own — about two-thirds of the skill is vendor-agnostic.

skillsafe install @planetscale/postgres

4. @softaworks/database-schema-designer — 39/50

Score: 39/50 | Relevance: 8 · Depth: 8 · Actionability: 8 · Structure: 8 · Adoption: 7

Four files totaling 687 lines, including a 119-line schema design checklist and a SQL migration template. This skill takes a different approach from the optimization-focused entries above — it’s designed to generate complete schemas from natural language descriptions, guiding the AI through a four-phase pipeline: Analysis, Design, Optimize, Migrate.

The anti-patterns table is immediately useful: VARCHAR(255) everywhere (wastes storage, hides intent), FLOAT for money (rounding errors — use DECIMAL(10,2)), missing FK constraints (orphaned data), no indexes on foreign keys (slow JOINs), storing dates as strings (can’t compare or sort), and adding NOT NULL without a default (breaks existing rows). These are the mistakes that actually show up in AI-generated schemas, which makes them particularly relevant for skills that help AI write SQL.

The deep-dive sections cover normalization through 3NF with violation examples, data type selection with sizing guidance, composite index ordering rules (most selective column first), constraint patterns including polymorphic relationships (separate FKs versus type+ID), and NoSQL design for MongoDB (embedding versus referencing decisions based on access patterns, document size, and update frequency).

The schema-design-checklist.md reference file is a 119-line verification checklist organized into seven sections: pre-design requirements, normalization, table design, relationships, indexing, performance, and migrations. Each item is a concrete check — not “think about indexes” but “indexes exist on all foreign keys” and “composite indexes match query patterns.”

The migration template in assets/templates/migration-template.sql provides UP/DOWN blocks wrapped in transactions. Simple, but it means the AI has a concrete format to follow rather than inventing one.

skillsafe install @softaworks/database-schema-designer

5. @wshobson/database-migration — 38/50

Score: 38/50 | Relevance: 8 · Depth: 8 · Actionability: 8 · Structure: 7 · Adoption: 7

A single 403-line SKILL.md focused entirely on database migrations — the one topic that the other skills in this list touch briefly but don’t cover thoroughly. From the same wshobson/agents repo as the SQL optimization skill (82 stars, 2,604 installs, 3 verifications — the only verified skill in this roundup).

The skill covers three major ORMs with complete migration examples: Sequelize (JavaScript), TypeORM (TypeScript), and Prisma (schema DSL). Each section includes the migration file, the up/down methods, and the CLI commands to run and rollback. This is the kind of content that saves 10 minutes of documentation-hunting every time the AI needs to generate a migration.

The schema transformation patterns are where the skill earns its score. Adding columns with defaults, renaming columns with zero downtime (a three-step process: add new column, copy data, remove old column), and changing column types safely (add new typed column, CAST data, drop old, rename). Each pattern includes the full migration code.

The rollback section covers two strategies: transaction-based (wrap everything in a transaction, rollback on error) and checkpoint-based (create backup table before migration, restore from backup on failure). The checkpoint approach is particularly useful for migrations that can’t be wrapped in a single transaction — large data transformations that exceed lock timeout limits, for example.

The zero-downtime section walks through a blue-green deployment strategy in five phases: add backward-compatible column, deploy dual-write code, backfill data, switch reads to new column, drop old column. Each phase is a separate migration file with the Sequelize implementation. The cross-database section handles PostgreSQL-to-MySQL differences (JSONB versus JSON) with dialect detection.

For teams running migrations regularly — especially across different ORMs or with zero-downtime requirements — this skill fills a gap that query optimization skills don’t address.

skillsafe install @wshobson/database-migration

Frequently Asked Questions

What about the Turso database skills with high install counts?

We evaluated six Turso skills (@tursodatabase/mvcc, @tursodatabase/debugging, @tursodatabase/index-knowledge, and others). Despite high install counts (the MVCC skill has 9,977 installs), these are internal contributor documentation for the Turso/libSQL codebase — not general database development guides. The MVCC skill (106 lines) explains Turso’s experimental snapshot isolation implementation. The debugging skill (80 lines) covers bytecode comparison and ThreadSanitizer for Turso’s Rust codebase. The index-knowledge skill is actually a meta-skill for generating AGENTS.md files, not a database indexing guide. If you’re contributing to Turso, they’re useful. For SQL and database development generally, they don’t apply.

Can these skills help with ORM-generated queries?

Yes, but indirectly. The @wshobson/sql-optimization-patterns skill addresses N+1 queries, which are the most common performance issue in ORM-generated code. The @wshobson/database-migration skill covers Sequelize, TypeORM, and Prisma migration patterns directly. The @softaworks/database-schema-designer skill includes ORM integration as an extension point. For Prisma-specific setup guidance, @prisma/prisma-database-setup (3,326 installs) was a candidate but we couldn’t download its latest version during our evaluation. The Supabase skill’s N+1 detection rule (data-n-plus-one.md) and missing index detection (query-missing-indexes.md) both apply directly to queries generated by ORMs.

How do the Supabase and PlanetScale skills compare?

They complement each other more than they overlap. The Supabase skill (@supabase/supabase-postgres-best-practices) is organized as 33 individual rule files prioritized by impact — it’s designed for an AI to pull specific rules on demand during query writing and schema review. The PlanetScale skill (@planetscale/postgres) is organized as topic-based reference documents covering Postgres operations from schema design through backup and recovery — it goes deeper on DBA-level topics like WAL internals, replication, and process architecture. If you’re a developer focused on query performance and schema design, the Supabase skill is more directly useful. If you’re also managing Postgres infrastructure, the PlanetScale skill covers ground the Supabase skill doesn’t touch. Installing both adds about 3,000 lines of non-overlapping Postgres knowledge to your agent’s context.

Conclusion

For query optimization and daily SQL work, start with @wshobson/sql-optimization-patterns — 499 lines of patterns you’ll use immediately, from EXPLAIN analysis to cursor-based pagination. For comprehensive Postgres guidance across security, schema design, connection management, and monitoring, add @supabase/supabase-postgres-best-practices and its 33 prioritized rule files. For teams running database migrations across ORMs, @wshobson/database-migration covers the zero-downtime patterns that the optimization skills skip.

skillsafe install @wshobson/sql-optimization-patterns
skillsafe install @supabase/supabase-postgres-best-practices
skillsafe install @wshobson/database-migration

Related roundups: Browse all Best Of roundups