supabase-postgres-best-practices: Postgres rules for schema, queries, RLS and migrations

By supabase/agent-skillssupabase/agent-skillsskills.sh

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.

OfficialDevelopmentskills.sh
Total installs
499.6K
skills.sh
Last 7 days
7.8K
▼ 4.1% vs the week before
Best 100 rank
#28
▲ 49 #77 7 days ago
GitHub stars
3.1K
Pushed 2026-11-12

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-practices

The whole repository

npx skills add https://github.com/supabase/agent-skills

Trend

Growing steadily
05K10K15K7.8K08/2809/2510/3011/27
Daily installs, last 30 days
1,213
Daily installs, last 30 days vs the 30 days before
-15.7%

How this skill works

  1. 1Load the skill before writing or changing anything that lives in a Postgres database.
  2. 2Find the category that matches the task, starting from query performance and ending with advanced features.
  3. 3Open the matching rule file, such as `references/query-missing-indexes.md`, for the explanation and SQL examples.
  4. 4Compare the incorrect and correct SQL examples, and any EXPLAIN output, with the planned change.
  5. 5Apply the correct pattern from the rule, and follow any Supabase-specific notes in that file.

Related skills in the same repository

SkillWhat it doesTotal installs
supabaseUse 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

Best Skills #28

The badge updates every day and links back to this page.

[![Best Skills](https://linkly.ai/skills/badge/supabase/agent-skills/supabase-postgres-best-practices.svg)](https://linkly.ai/skills/s/supabase/agent-skills/supabase-postgres-best-practices)
Linkly AI

Maintained by Linkly AI

Linkly AI is the knowledge brain for AI agents. It automatically parses the notes, study materials, bookmarks, knowledge bases, voice memos, meetings, videos and ideas on your computer, so your agent can search and read everything you have.

Download Linkly AI
Or send this line to your agent and it will help you install and connect.

Set up https://linkly.ai/docs/en/agent-setup.md