A PostgreSQL development skill from GitHub's awesome-copilot collection: JSONB, arrays, window functions, full-text search, index strategy, EXPLAIN ANALYZE and pg_stat_statements, with an optimization checklist.
Supabase Postgres Best Practices Skill
Supabase's official Postgres skill — eight rule categories ranked by impact, each with wrong-vs-right SQL and EXPLAIN output, for schema, RLS, indexing and query work on Postgres anywhere.
Install
Other ways to install
About
- Eight rule categories ranked from critical to low impact
- Each rule pairs incorrect SQL with the corrected version and an EXPLAIN plan
- Covers RLS policies and the tests that verify tenant isolation
- Diagnostic rules for slow queries, locking, bloat and connection exhaustion
- Applies to Postgres anywhere, with Supabase-specific notes called out separately
- Includes pgvector, pgmq and pg_cron guidance
Supabase maintains this skill for Postgres generally, not only Postgres on Supabase. Its instruction is to load before touching anything that lives in a database — creating or altering a table, picking a column type, writing a migration or a declarative schema file, adding an RLS policy, an index, a trigger, a database function, a queue or a pg_cron job, setting up pgvector search, or restoring a dump.
It is equally the skill to load when something is already wrong: slow queries, high CPU, timeouts, connection exhaustion, locking, bloat, an EXPLAIN plan you cannot read, or rows visible to the wrong tenant.
How the rules are organised
Eight categories, ordered by impact, each with a rule-file prefix:
- Query performance (
query-) — critical - Connection management (
conn-) — critical - Security and RLS (
security-) — critical - Schema design (
schema-) — high - Concurrency and locking (
lock-) — medium-high - Data access patterns (
data-) — medium - Monitoring and diagnostics (
monitor-) — low-medium - Advanced features (
advanced-) — low
Every rule file follows the same shape: why it matters, an incorrect SQL example with an explanation of the damage, the corrected version, EXPLAIN output or a metric where one is illuminating, and Supabase-specific notes where the managed platform changes the answer.
That structure is what makes it useful to an agent rather than a human reading a blog post — a rule is retrievable by prefix, and the wrong/right pair gives the model a concrete pattern to match against the SQL in front of it.
Version 1.1.1, MIT licensed.
Try it
Once installed, ask your agent something like:
Use the supabase-postgres-best-practices skill to review this migration before I run it — check the index choices, the RLS policy and whether the column types will scale.
SKILL.md
The instructions your agent loads, as published by Supabase.
Related Skills
See all Supabase Postgres Best Practices alternativesA PostgreSQL code-review skill from GitHub's awesome-copilot collection: checks schemas, JSONB and array usage, PL/pgSQL functions, extensions and Row Level Security against PostgreSQL-specific anti-patterns.
Supabase's official skill covering Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron and Queues — with a hard rule to verify against the live changelog before writing code.
A PostgreSQL schema design checklist for agents: primary keys, data types to prefer and avoid, constraints, B-tree/GIN/GiST/BRIN indexes, partitioning and JSONB, with PostgreSQL-specific gotchas and worked DDL.