supabase-postgres-best-practices: Postgres rules for schema, queries, RLS and migrations
This skill is a set of Postgres best practice rules maintained by Supabase. It tells the agent to load the rules before it writes or changes anything in a Postgres database, including tables, migrations, RLS policies, indexes, and functions. The rules cover performance, security, and schema design, so they apply even to a one-column change or a single query.
What problem this skill solves
Schema changes, SQL queries, and RLS policies are often written without checking known Postgres practices. The result can be slow queries, high CPU, timeouts, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant.
With this skill loaded, the agent checks its work against rules grouped into 8 categories, ordered by impact. Each rule explains why it matters and gives incorrect and correct SQL examples, with EXPLAIN output where it applies.
Good for
- Creating or altering tables, columns, or migrations
- Writing or reviewing RLS policies and their tests
- Diagnosing slow queries, EXPLAIN plans, or locking issues
Not for
- Work that does not touch a Postgres database
- Databases other than Postgres
Install this skill
supabase-postgres-best-practices only
npx skills add https://github.com/supabase/agent-skills --skill supabase-postgres-best-practicesThe whole repository
npx skills add https://github.com/supabase/agent-skillsTrend
Growing steadily- Daily installs, last 30 days
- 1,213
- Daily installs, last 30 days vs the 30 days before
- -15.7%
How this skill works
- 1Load the skill before writing or changing anything that lives in a Postgres database.
- 2Find the category that matches the task, starting from query performance and ending with advanced features.
- 3Open the matching rule file, such as `references/query-missing-indexes.md`, for the explanation and SQL examples.
- 4Compare the incorrect and correct SQL examples, and any EXPLAIN output, with the planned change.
- 5Apply the correct pattern from the rule, and follow any Supabase-specific notes in that file.
Related skills in the same repository
| Skill | What it does | Total installs |
|---|---|---|
| supabase | Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); debugging and troubleshooting errors or unexpected behavior on Supabase projects (HTTP errors, Postgres errors, RLS surprises, permission denied, schema cache issues, timeouts, Edge Function crashes, Realtime drops, Storage failures) and reading or querying logs (Logs Explorer, ClickHouse). | 376,400 |
Are you the author of this skill? Add its rank to your GitHub repo
The badge updates every day and links back to this page.
[](https://linkly.ai/skills/s/supabase/agent-skills/supabase-postgres-best-practices)