Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
86
80%
Does it follow best practices?
Impact
95%
1.25xAverage score across 3 eval scenarios
Passed
No findings from the security scan
PostgreSQL concurrent job queue patterns
SKIP LOCKED worker claim
100%
100%
Multi-row INSERT batch
100%
100%
ON CONFLICT upsert
100%
100%
ANY array batch fetch
100%
100%
Short transaction
100%
100%
Advisory lock with hashtext
0%
100%
Consistent lock ordering
80%
70%
Identity primary key
0%
100%
Partial pending index
100%
100%
Multi-tenant SaaS schema with RLS and least-privilege roles
Identity primary keys
0%
100%
Timestamp column type
100%
100%
String column type
100%
100%
bigint for ID columns
0%
100%
FK indexes present
100%
100%
Lowercase snake_case identifiers
100%
100%
RLS enabled
100%
100%
Force RLS applied
0%
100%
Volatile function wrapping in RLS
0%
100%
RLS policy column indexes
100%
100%
Least-privilege roles
100%
100%
Product catalog SQL schema and query optimization
Generated tsvector column
100%
100%
GIN index on tsvector
100%
100%
to_tsquery for search
100%
100%
ts_rank for relevance
100%
100%
GIN index on JSONB
100%
100%
jsonb_path_ops or expression index
100%
100%
Cursor-based pagination
100%
100%
Multi-column cursor condition
100%
100%
Composite index: equality before range
80%
70%
INCLUDE in covering index
0%
0%
Partial index for active filter
100%
100%
EXPLAIN with ANALYZE and BUFFERS
50%
100%
8331f91
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.