Find your next skill
← All skills
Backend

supabase-postgres-best-practices

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres d...

The answer

Postgres best practices maintained by Supabase, for Postgres running anywhere.

Install

npx skills add supabase/agent-skills --skill supabase-postgres-best-practices
# or all skills:
npx skills add supabase/agent-skills

Author's take / 作者点评

Strong Postgres design guidance that applied cleanly on local PostgreSQL 17. Ideal for schema/RLS work before linking Supabase; auth.uid() policies need a real Supabase project.

在本地 PostgreSQL 17 上可完整落库验证,适合先做 schema/RLS;真要用 auth.uid() 仍需 Supabase 项目。

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