29 skills · 8 categories

Claude Code skills for PostgreSQL

PostgreSQL skills that work from real query plans: schema design, indexing, zero-downtime migrations, locking, connection pooling, JSONB, backups and point-in-time recovery. The ORMs and platforms built on Postgres are covered as well.

Start with these

  1. 1

    Postgres Schema Design

    Tables where bad data simply cannot land

    Claude designs tables from the queries they must serve, then picks a precise type for every column: timestamptz over timestamp, integer cents over floats, identity or UUIDv7 keys. Rules go into NOT NULL, CHECK, UNIQUE and foreign keys with an explicit ON DELETE, foreign keys get indexes, and JSONB is reserved for genuinely variable data. Reviews end with a blocking/should-fix note.

  2. 2

    Postgres Indexing

    Every index justified by a plan, every drop by data

    Claude designs the narrowest index that serves a named query: equality columns before range columns, partial predicates for queue and soft-delete tables, INCLUDE columns for index-only scans, trigram GIN for ILIKE search. Builds run CONCURRENTLY with a lock timeout and an invalid-index check, and a diagnostic SQL catalog finds unused, duplicate and FK-missing indexes before any drop.

  3. 3

    Zero-Downtime Migrations

    Change live tables without a maintenance window

    Claude splits risky schema changes into expand, backfill and contract phases that each work with old and new code running side by side. Every ALTER runs with lock_timeout, constraints go in NOT VALID and get validated separately, backfills run as resumable batches outside the DDL, and drops wait for a later deploy and your sign-off. You get a phase-by-phase plan with locks and rollback per step.

All 29 PostgreSQL skills

Grouped by category. Each card opens the full playbook, example prompts and install commands.

Cloud Platforms 4

No. 189

Supabase Backend

Treat the database as the security boundary it is

Claude builds Supabase projects with the CLI and versioned migrations, enables RLS on every exposed table with per-operation policies that are indexed and tested as two different users, and keeps the secret key off clients. Server auth uses @supabase/ssr with verified users, storage paths are scoped by user folder, and types are regenerated after each schema change.

supabase-backend 204 lines
No. 177

AWS RDS and Aurora

Right engine, tested failover, no surprise I/O bill

Guides Claude through running PostgreSQL and MySQL on AWS from measured load: choosing RDS, Aurora, or Serverless v2, sizing for the working set, testing failover, and keeping settings in custom parameter groups. It plans major upgrades as blue/green deployments with the logical-replication and PITR caveats, reduces RDS Proxy pinning, and runs a script that compares Aurora Standard and I/O-Optimized from your bill.

aws-rds-aurora 285 lines · 2 files
No. 187

PaaS Deploys

Render, Railway or Heroku, configured from the repo

Claude picks the platform that fits the stack, then writes render.yaml, railway.json or a Procfile so services, databases and variables live in the repo. Apps bind to $PORT with real health checks, migrations run once in the release phase and stay backward compatible, database pools fit plan limits, and the free-tier traps such as sleeping instances and expiring databases are called out early.

paas-deploys 235 lines
No. 184

Fly.io Apps

Machines, volumes and regions configured on purpose

Claude writes fly.toml with real health checks, request concurrency limits and deliberate auto stop settings, runs at least two Machines for anything that must stay up, and explains that each volume lives on one host and needs its own backups. Migrations run as release commands that are safe during rolling deploys, and rollback is a redeploy of a recorded image.

fly-io 193 lines

Databases 15

No. 205

Postgres Schema Design

Tables where bad data simply cannot land

Claude designs tables from the queries they must serve, then picks a precise type for every column: timestamptz over timestamp, integer cents over floats, identity or UUIDv7 keys. Rules go into NOT NULL, CHECK, UNIQUE and foreign keys with an explicit ON DELETE, foreign keys get indexes, and JSONB is reserved for genuinely variable data. Reviews end with a blocking/should-fix note.

postgres-schema-design 251 lines
No. 203

Postgres Indexing

Every index justified by a plan, every drop by data

Claude designs the narrowest index that serves a named query: equality columns before range columns, partial predicates for queue and soft-delete tables, INCLUDE columns for index-only scans, trigram GIN for ILIKE search. Builds run CONCURRENTLY with a lock timeout and an invalid-index check, and a diagnostic SQL catalog finds unused, duplicate and FK-missing indexes before any drop.

postgres-indexing 204 lines · 2 files
★ No. 209

Zero-Downtime Migrations

Change live tables without a maintenance window

Claude splits risky schema changes into expand, backfill and contract phases that each work with old and new code running side by side. Every ALTER runs with lock_timeout, constraints go in NOT VALID and get validated separately, backfills run as resumable batches outside the DDL, and drops wait for a later deploy and your sign-off. You get a phase-by-phase plan with locks and rollback per step.

schema-migrations 240 lines · 2 files
No. 202

Postgres Full-Text Search

Real search in the database you already run

Claude builds a weighted, stored tsvector column with the right language configuration, indexes it with GIN, and parses user input with websearch_to_tsquery so no query can error. Ranking runs only over the matched set, snippets are generated for the final page only, pg_trgm covers names and typos, and the skill states plainly when Elasticsearch or a hosted engine is the better call.

postgres-full-text-search 185 lines
No. 204

Postgres JSONB

Flexible documents without giving up indexes

Claude decides per attribute whether it belongs in a column, a JSONB document or a child table, then validates documents with CHECK constraints at the database edge. Queries are written with GIN-compatible containment and jsonpath operators, hot keys become indexed expressions or stored generated columns, and expression statistics fix the planner's blind spot for keys inside JSON.

postgres-jsonb 177 lines
No. 208

Postgres Row-Level Security

Tenant isolation the database enforces and tests prove

Claude sets up RLS so it cannot be bypassed by accident: a runtime role without BYPASSRLS that does not own the tables, ENABLE plus FORCE on every tenant table, and tenant context passed per transaction with set_config so poolers never leak it. It closes the side doors through views, SECURITY DEFINER functions and foreign keys, and writes SQL tests that fail when one tenant can see another.

row-level-security 262 lines
★ No. 210

SQL Query Tuning

Find the slow plan node, fix the estimate behind it

Claude stops guessing from SQL text and works from the plan. It ranks queries by total time in pg_stat_statements, captures EXPLAIN ANALYZE with real parameters, finds the node where estimates diverge, then applies the smallest fix in order: statistics, query rewrite, index, scoped config. Every change gets a before/after plan comparison with buffer counts and a short tuning note.

sql-query-tuning 215 lines · 2 files
No. 192

Backup and Restore

Backups count only after a timed restore

Claude starts from agreed RPO and RTO targets and picks the mechanism that meets them: logical dumps, physical backups with WAL archiving for point-in-time recovery, or managed PITR plus off-account copies. It restores to a separate instance by default, verifies restored data with queries and smoke tests, alerts on archive failures and backup age, and records each drill's real recovery time.

backup-restore 243 lines
No. 194

Connection Pooling

Pools sized to database cores, not request counts

Claude writes down every process that connects and sums its maximum connections against the database limit at full autoscale before touching a setting. Pools are sized from database parallelism, PgBouncer transaction mode is configured with its session-state caveats and prepared statement support, serverless platforms get a proxy, and exhaustion is diagnosed from pg_stat_activity and SHOW POOLS.

connection-pooling 173 lines · 2 files
No. 195

Drizzle ORM

Typed SQL, reviewed migrations, zero drift

Claude writes Drizzle schemas as the single source of truth: timezone-aware timestamps, named indexes on every foreign key, types inferred with $inferSelect instead of duplicated interfaces. It keeps push for local prototyping only, reads each generated SQL file for accidental drop-and-add renames, and picks between the core builder and relational queries based on what the result needs.

drizzle-orm 239 lines
No. 213

TimescaleDB Time-Series

Hypertables, rollups and retention sized to your ingest

Claude sizes chunk intervals from ingest volume and memory, picks a columnstore segmentby that matches the dominant filter, and points dashboards at continuous aggregates with refresh windows that cover late data. Retention drops chunks rather than deleting rows, and when TimescaleDB is unavailable it falls back to native range partitioning with BRIN indexes.

timescale-timeseries 214 lines
No. 214

Transactions and Locking

Name the race, pick the lock, prove it under load

Claude names the exact anomaly behind a concurrency bug, such as lost update, write skew or double insert, then applies the cheapest mechanism that prevents it: a unique index, a guarded atomic UPDATE, a version check, FOR UPDATE in key order, or Serializable with retries. Every role gets lock and idle-transaction timeouts, and the fix is proven with a real parallel test.

transactions-locking 237 lines · 2 files
No. 206

Prisma ORM

Read the SQL Prisma writes before it hits prod

Claude treats Prisma as a SQL generator it must supervise. Models get timestamptz and indexed relation fields, every generated migration.sql is read for silent drops and table rewrites, and production only ever sees migrate deploy. Queries select only needed fields with cursor pagination, transactions stay short, and the setup matches your installed Prisma major, including the Prisma 7 driver-adapter client.

prisma-orm 238 lines
No. 211

SQLAlchemy ORM

Typed models, owned sessions, loads you chose on purpose

Makes Claude write SQLAlchemy 2.x the way it is meant to be used: Mapped and mapped_column models with named constraints, one Session per request or task with short transactions, select() queries with deliberate selectinload or joinedload, and lazy="raise" to catch accidental lazy loads. It also reviews Alembic autogenerate output for the renames and enum changes it misses, and sets up rollback-per-test fixtures.

sqlalchemy-orm 350 lines
No. 193

ClickHouse Analytics

Sorting keys that skip 99% of granules

Claude designs ClickHouse tables from the dominant queries: a sorting key that prunes granules, coarse monthly partitions, LowCardinality and codecs, and the right MergeTree variant for upserts or rollups. Ingestion is batched or uses async inserts with wait enabled, dedup queries use FINAL or argMax, and EXPLAIN indexes plus system.parts confirm granules read and part counts.

clickhouse-analytics 235 lines

Architecture 3

Install

Every PostgreSQL skill in one command

Installs into ~/.claude/skills/. Add --project after -- to install into the current repository.

curl -fsSL https://claudeskills.page/install.sh | sh -s -- postgres-schema-design postgres-indexing schema-migrations postgres-full-text-search postgres-jsonb row-level-security supabase-backend sql-query-tuning testcontainers aws-rds-aurora paas-deploys backup-restore connection-pooling drizzle-orm timescale-timeseries transactions-locking cqrs-event-sourcing data-partitioning multi-tenancy prisma-orm sqlalchemy-orm pagination-filtering nix-environments fly-io clickhouse-analytics analytics-sql data-anonymization dimensional-modeling n8n-workflows

PostgreSQL skills FAQ

What is the best Claude Code skill for PostgreSQL?

Start with Postgres Schema Design: Tables where bad data simply cannot land. Then add Postgres Indexing and Zero-Downtime Migrations, which cover the next most common PostgreSQL requests.

How do I install all 29 PostgreSQL skills at once?

Pass every name to the installer in one command: curl -fsSL https://claudeskills.page/install.sh | sh -s -- postgres-schema-design postgres-indexing schema-migrations postgres-full-text-search postgres-jsonb row-level-security supabase-backend sql-query-tuning testcontainers aws-rds-aurora paas-deploys backup-restore connection-pooling drizzle-orm timescale-timeseries transactions-locking cqrs-event-sourcing data-partitioning multi-tenancy prisma-orm sqlalchemy-orm pagination-filtering nix-environments fly-io clickhouse-analytics analytics-sql data-anonymization dimensional-modeling n8n-workflows. Add --project to install them into the current repository's .claude/skills/ folder so your team gets them too.

Do these PostgreSQL skills work outside Claude Code?

Yes. Each skill uses only the portable Agent Skills frontmatter, so the same folder works on claude.ai, through the Claude API and in the Agent SDK. Skills that run bundled scripts need an environment with code execution.

esc