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.
Supabase Postgres Best PracticesSkill
Summary
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.
Features
- 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
Install This Skill
Add this skill to your favorite AI agent in a few steps.
Skill Content
Usage Instructions
Learn how to use this skill with different AI agents.
Example Usage
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.
Description
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.
Related Skills
Skill: EF Core Query Optimization
by .NET Team at Microsoft
Make slow Entity Framework Core queries fast — read the generated SQL first, fix N+1s, cartesian Include explosions and non-sargable predicates, then re-measure one change at a time.
Skill: Google Cloud Spanner Basics
by Google Cloud
Google's official Spanner skill: provision instances, design primary keys that do not hotspot, write SQL and client-library code, and diagnose slow queries — with DDL and DML gated behind your approval.
Skill: ClickHouse Best Practices
by ClickHouse Inc
ClickHouse's official agent skill: 31 rules for primary keys, data types, JOINs, batching and partitioning that an agent must check and cite before advising on a schema or query.