Curated Category 9 database workflows Updated

Database and Postgres Skills for AI Coding Agents

Database work is not one job. These nine workflows cover domain and Postgres table design, query diagnosis, schema change, Postgres review, analytics transformations, operations, and isolated migration testing.

Each card points to the primary GitHub SKILL.md and its individual skills.sh listing. Existing registry snapshots are dated 2026-08-25 or 2026-08-26; postgresql-table-design was checked against its primary source and the registry on 2026-09-26. The links make each workflow and its install record easy to audit as the registry changes.

Illustration of a stack of database discs with a branch forking off into two smaller stacks

How this list was picked

  • Read at the source. Each card is grounded in the primary SKILL.md path shown in its source link. The copy follows the actual workflow, examples, and database topics in that path. The GitHub URLs point to the file level location, which gives the reader a direct audit trail from the card claim to the repository instructions.
  • Count evidence. Install counts are skills.sh registry evidence, not a quality ranking. Existing cards retain their 2026-08-25 or 2026-08-26 snapshot, while postgresql-table-design was checked on 2026-09-26. Each card carries the exact install command and listing used for that evidence.
  • Distinct jobs. The nine cards map to portable Postgres practice, query diagnosis, schema change, review, domain modelling, Postgres table design, analytics transformation, operations, and branch isolation. Each card has a different expected output rather than repeating an index or migration checklist.
  • Narrow platform boundary. Only neon-postgres-branches depends on a platform. It earns a card because it provides a specific migration-test workflow: choose a normal or schema-only branch, set an expiration, test the change, then clean the branch up. It is not a generic vendor overview.

Choose by the job

  • Ordinary Postgres: portable rulebook for schema design, migrations, RLS, indexes, EXPLAIN, and locking.
  • Slow query: SQL patterns for EXPLAIN, index choices, and pg_stat_statements evidence.
  • Schema change: migration for expand-contract changes, rollback, and checkpoint restore.
  • Postgres-aware audit: code review for Postgres data types, JSONB, arrays, indexes, functions, extensions, RLS, and privileges.
  • New table or data model: table design for domain entities, relationships, constraints, and access paths. Use Postgres table design for Postgres types, indexes, JSONB, and partitioning.
  • Analytics models: dbt transformations for warehouse transformations, tests, and documentation.
  • Postgres service operation: operations for recovery, WAL, replication, monitoring, and connection pools.
  • Isolated Neon migration test: Postgres branches for normal or schema-only disposable environments.

Pick the narrowest useful workflow. Start with the portable rulebook when the task is ordinary Postgres. Move to table design before a new model, SQL optimization after collecting plan evidence, and the migration workflow when deployed state has to change. Analytics, operations, and branch testing each have their own cards because they produce different evidence.

Database workflows at a glance

A comparative index of the top picks. Click any card to navigate directly to its detailed review.

Most counts are a 2026-08-25 or 2026-08-26 skills.sh snapshot; postgresql-table-design was checked on 2026-09-26.

Core Postgres workflows

Start with a portable rulebook, then choose the focused workflow for slow queries, schema change, or a Postgres-aware review.

GitHub repository card for supabase/agent-skills

supabase-postgres-best-practices

369.0K installs Supabase

Best for: Ordinary Postgres projects that need a broad default

This portable Supabase guide applies to Postgres anywhere. Its rule set spans schema design, migrations, row-level security, indexes, EXPLAIN, locking, connection management, and advanced Postgres features. The material is organized by priority, which gives an agent a useful order when a task touches several parts of a database at once.

The examples make the guidance operational. Rules pair incorrect SQL with a corrected version, and many include EXPLAIN output so the agent can connect a query shape to its cost. The coverage includes missing, partial, expression, and covering indexes, connection pooling, lock behavior, and RLS policies. The RLS material includes policy patterns that avoid repeated per-row work, while the locking material gives an agent database-level context before it changes a live schema. Use this as the broad starting rulebook for a Postgres project, then follow the conditional platform link when the task depends on a vendor product or workflow.

  • Portable guidance for Postgres on any host
  • Schema and migration patterns
  • RLS, indexes, and EXPLAIN coverage
  • Locking guidance for safer database changes
Install this skill
$npx skills add https://github.com/supabase/agent-skills --skill supabase-postgres-best-practices
GitHub repository card for wshobson/agents

sql-optimization-patterns

17.3K installs wshobson

Best for: Slow Postgres queries that need evidence before a fix

This SQL optimization reference starts with EXPLAIN so an agent can inspect scans, joins, and plan shape before proposing a change. It explains sequential scans on large tables, index-only scans, and the situations that produce nested-loop, hash, or merge joins. That sequence keeps an index recommendation tied to observed planner behavior.

The index section covers partial indexes for filtered subsets, expression indexes such as LOWER(email), covering indexes with INCLUDE, GIN for JSONB and full text, and BRIN for very large append-only tables. It also names common index blockers, including functions in WHERE clauses and leading-wildcard LIKE patterns. pg_stat_statements and pg_stat_user_tables queries help find expensive, missing, or unused indexes while keeping write overhead in view. The result is a repeatable path from an observed query, through a plan and measured workload, to an index change that can be checked again.

  • EXPLAIN-first query investigation
  • Index selection grounded in query plans
  • pg_stat_statements for slow-query evidence
  • Performance fixes weighed against write cost
Install this skill
$npx skills add https://github.com/wshobson/agents --skill sql-optimization-patterns
GitHub repository card for wshobson/agents

database-migration

15.5K installs wshobson

Best for: Schema changes that need rollback and restore planning

This migration guide uses expand-contract for online schema changes. The agent adds a compatible shape, backfills it, moves application callers across, and removes the old shape after the transition. That sequence gives deployed versions time to coexist during a rename or representation change. The examples cover Sequelize, TypeORM, and Prisma syntax, with a working down migration treated as part of the change.

Recovery is part of the workflow. Transaction-wrapped migrations can roll back when an operation fails, while a checkpoint pattern takes a table snapshot before a risky transformation, verifies the result, and restores the checkpoint when verification fails. A multi-step rename can therefore carry its compatibility period, down path, transaction behavior, and restore checkpoint as one reviewable plan. Reach for this card when the job changes schema state and the recovery path needs to be written alongside the forward migration.

  • Expand-contract workflow for schema changes
  • Down migrations as part of the change
  • Transaction rollback when a migration fails
  • Checkpoint restore for risky transformations
Install this skill
$npx skills add https://github.com/wshobson/agents --skill database-migration
GitHub repository card for github/awesome-copilot

postgresql-code-review

11.9K installs GitHub

Best for: Auditing Postgres code before it reaches production

This review guide focuses on Postgres-specific decisions that general code review often misses: data types, JSONB and arrays, indexes, functions and extensions, row-level security, and privileges. Those areas affect storage shape, query behavior, execution rights, and the boundary between application code and database policy. A useful pass asks whether the chosen type expresses the data, whether JSONB or arrays have an access pattern the indexes support, and whether database code runs with the intended authority.

Use the guide as a focused audit pass over a schema change, query, function, or access-policy change. Review each choice in its Postgres context, record the risk and the reason for the recommendation, and send slow-query investigation to SQL optimization patterns or state changes to database-migration. Its scope makes it a review companion for the other three defaults, especially when a migration also changes indexes, functions, RLS, or privileges.

  • Postgres data types, JSONB, and arrays
  • Indexes, functions, and extensions
  • RLS and privilege review
  • Focused audit for Postgres code changes
Install this skill
$npx skills add https://github.com/github/awesome-copilot --skill postgresql-code-review

Data lifecycle and specialized workflows

The remaining jobs are intentionally narrow: Postgres table design, analytics transformations, database operations, and isolated branch testing.

GitHub repository card for softaworks/agent-toolkit

database-schema-designer

4.1K installs Softaworks

Best for: Designing entities, relationships, constraints, and access paths before implementation

This workflow starts with the domain model rather than a premature table layout. It helps identify entities, relationships, cardinality, ownership, and lifecycle rules, then choose data types and nullability that express those rules. Constraints such as primary keys, foreign keys, uniqueness, and checks make the intended invariants enforceable instead of leaving them to application code.

The design is tied to how the data will be used. It considers read and write access patterns, query boundaries, indexing needs, and the trade-offs between normalization and deliberate denormalization. The result is a durable model that can be translated into an orderly, migration-ready schema and reviewed before implementation changes deployed state.

  • Domain entities and relationship modelling
  • Types, nullability, and enforceable constraints
  • Access patterns connected to schema decisions
  • Migration-ready design before implementation
Install this skill
$npx skills add https://github.com/softaworks/agent-toolkit --skill database-schema-designer
GitHub repository card for dbt-labs/dbt-agent-skills

using-dbt-for-analytics-engineering

834 installs dbt Labs

Best for: Building maintainable dbt transformations with tests and documentation

This skill guides the dbt analytics-engineering workflow: declare sources, build transformations in understandable model layers, and shape trusted outputs for downstream analysis. It keeps staging, intermediate, and final reporting models distinct so joins, business logic, and aggregations have a clear place to live and can be changed without hiding semantics in one large query.

It also treats a dbt project as a convention-driven codebase. Follow the repository's project and model naming patterns, configure models in the expected locations, add tests and documentation alongside the models, and use incremental strategies when the workload requires them. The workflow is for turning warehouse data into maintainable analytics models with reviewable, documented behavior.

  • Sources and layered transformation models
  • Project conventions for maintainable dbt code
  • Tests and documentation alongside models
  • Incremental strategies for larger workloads
Install this skill
$npx skills add https://github.com/dbt-labs/dbt-agent-skills --skill using-dbt-for-analytics-engineering
GitHub repository card for wshobson/agents

postgresql-table-design

26.2K installs wshobson

Best for: Designing or reviewing a Postgres schema before it ships

postgresql-table-design is a Postgres-specific schema workflow for choosing column types, keys, constraints, indexes, partitions, and semi-structured storage. It starts with normalized tables and real query access paths, then covers common Postgres choices such as identity values, TIMESTAMPTZ, JSONB, foreign-key indexes, and NULL-aware uniqueness.

Use it when designing a new Postgres schema, reviewing one before release, or planning a live schema change. Its rules cover workload patterns, indexing, partitioning, and Postgres storage and MVCC behavior, giving a database implementation decision more depth than a dbt model unit test.

  • Postgres types, primary keys, constraints, and access-path indexes
  • Foreign-key indexes, JSONB, and NULL-aware uniqueness
  • Partitioning and workload-specific schema choices
  • Safe Postgres schema design and review before release
Install this skill
$npx skills add https://github.com/wshobson/agents --skill postgresql-table-design
GitHub repository card for planetscale/database-skills

postgres

7.0K installs PlanetScale

Best for: Operating a Postgres service beyond a single query or migration

This card fills the operational gap between application-focused Postgres advice and running a database service. Its generic Postgres references cover connection and process architecture, memory, MVCC transactions, WAL and checkpoints, replication, storage layout, monitoring, and backup and recovery.

The backup material distinguishes logical dumps, physical backups, and point-in-time recovery, and insists on a tested recovery rather than assuming a backup is usable. Reach for this workflow when the work concerns recovery objectives, WAL archiving, replication, vacuum behaviour, pool sizing, or the database's operational health.

  • WAL, checkpoints, MVCC, and vacuum operations
  • Replication, storage, monitoring, and connection pooling
  • Logical, physical, and point-in-time recovery paths
  • Recovery testing treated as a required operation
Install this skill
$npx skills add https://github.com/planetscale/database-skills --skill postgres
GitHub repository card for neondatabase/agent-skills

neon-postgres-branches

2.6K installs Neon

Best for: Testing a risky change against realistic or schema-only data

This is a narrow branching workflow, not a generic Neon product card. It first decides between a normal branch for realistic migration and performance testing and a schema-only branch when production rows cannot be copied. It then verifies the CLI or MCP path, creates the branch, retrieves its connection string, and assigns an expiration so temporary environments do not linger.

The source also covers reset-from-parent, per-PR and per-test-run lifecycles, and preserving a reset state for rollback. Use it only when Neon branching is the available isolation mechanism. It complements the generic migration card by supplying a concrete, disposable environment for validating the plan.

  • Normal versus schema-only branch decision
  • CLI-first creation and connection-string retrieval
  • Per-PR and per-test-run database lifecycles
  • Expiration, reset, and rollback-aware cleanup
Install this skill
$npx skills add https://github.com/neondatabase/agent-skills --skill neon-postgres-branches

Keep them under control with LazySkills

These nine workflows come from seven repositories, and whether each agent on your machine can see them is exactly the kind of thing that fails silently. LazySkills is a terminal UI that scans your machine, shows per-agent visibility, diagnoses broken configurations, and searches the same registry this page uses.

curl -fsSL https://lazyskills.sh/install | sh
More about LazySkills

Frequently asked questions

Which skill should I start with for ordinary Postgres?

Start with supabase-postgres-best-practices. The guide is portable across Postgres hosts and covers schema design, migrations, RLS, indexes, EXPLAIN, locking, connection management, and advanced features. Its incorrect and corrected SQL examples give an agent a practical rulebook for everyday database work. Add a conditional platform skill when the task depends on a vendor product.

Which card fits a slow query, schema change, or database audit?

Use sql-optimization-patterns for a slow query. Start with EXPLAIN, inspect scans and joins, then use pg_stat_statements to find expensive work and choose an index with its write cost in view. Use database-migration for an expand-contract change, down migration, transaction rollback, or checkpoint restore. Use postgresql-code-review for an audit of Postgres data types, JSONB or arrays, indexes, functions, extensions, RLS, and privileges.

Which workflows cover data modelling and analytics?

Use database-schema-designer before a schema change exists: it maps the domain, relationships, constraints, and access patterns into a durable data model. Use postgresql-table-design when a Postgres schema needs types, constraints, indexes, partitioning, and live-schema-change guidance. Use using-dbt-for-analytics-engineering when operational tables become analytics models.

Which card covers Postgres operations, recovery, or isolated migration testing?

Use postgres for the operational database: connection pools, memory, WAL, replication, monitoring, backups, and recovery. The source distinguishes logical backups, physical backups, and point-in-time recovery, with recovery testing as the proof a backup works. Use neon-postgres-branches only when Neon is your isolation mechanism and a migration needs a normal or schema-only branch, an expiration, and an explicit cleanup lifecycle.

How do the nine cards avoid duplication?

Each card has a bounded job: portable Postgres practice, query diagnosis, schema migration, Postgres-aware review, domain modelling, Postgres table design, analytics transformation, database operations, or Neon branch isolation. Several mention indexes or migrations because real database work overlaps, but their output differs: a model, a schema review, a migration plan, an analytics transformation, an operations runbook, or an isolated environment.

Related guides

More curated skill catalogs to keep browsing.

by Alvin