What it does
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.
This entry summarizes the public skill for discovery. Prefer the upstream SKILL.md for the full instruction text (we do not paste restricted or lengthy proprietary prompt bodies).
Install & usage
Official installer
npx skills add supabase/agent-skills --skill supabase-postgres-best-practices
# or all skills:
npx skills add supabase/agent-skills
See also: https://supabase.com/docs/guides/getting-started/ai-skills
Best for
Postgres schema, RLS, indexes, and query performance on Supabase or plain Postgres.
Hands-on test
- test_level: fully-tested
- Ran: yes
- When: 2026-11-01T01:23:05+08:00 (Asia/Shanghai)
- Result: Installed/started PostgreSQL 17 locally; applied tenant/uuid/index/RLS schema to skill_site_pg; inserted sample row and SELECT joined tenants/users/docs successfully (body=hello-pg-best).
- Gotchas: psql client alone is not enough — need a running server. Local RLS policies cannot use auth.uid() without Supabase Auth; used app.tenant_id stand-in.
Money-saving tip
Skill is free (MIT). Use free Supabase project tiers for prototypes; load postgres-best-practices before designing schemas to avoid costly rework.
Source & license
- source_repo: supabase/agent-skills
- Source: https://github.com/supabase/agent-skills/tree/main/skills/supabase-postgres-best-practices
- License: MIT — https://github.com/supabase/agent-skills/blob/main/LICENSE
- Restrictions: MIT. Follow Supabase ToS; never commit service-role keys.