Supabase postgres best practices

From seaworld008/Commonly-used-high-value-skills · View interactive version

Supabase postgres best practices is an AI agent skill from the GitHub repository seaworld008/Commonly-used-high-value-skills. Use when writing or reviewing Postgres schemas, queries, indexes, RLS policies, connection settings, or migrations with Supabase guidance; applicable to Postgres on any hosting platform.

How to use this skill

Skill file

Supabase Postgres Best Practices

Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.

When to Apply

Reference these guidelines when:

Rule Categories by Priority

| Priority | Category | Impact | Prefix |

|----------|----------|--------|--------|

| 1 | Query Performance | CRITICAL | query- |

| 2 | Connection Management | CRITICAL | conn- |

| 3 | Security & RLS | CRITICAL | security- |

| 4 | Schema Design | HIGH | schema- |

| 5 | Concurrency & Locking | MEDIUM-HIGH | lock- |

| 6 | Data Access Patterns | MEDIUM | data- |

| 7 | Monitoring & Diagnostics | LOW-MEDIUM | monitor- |

| 8 | Advanced Features | LOW | advanced- |

How to Use

Read individual rule files for detailed explanations and SQL examples:

references/query-missing-indexes.md
references/query-partial-indexes.md
references/_sections.md

Each rule file contains:

References

<!-- LOCAL-QUALITY-SUPPLEMENT:START -->

Review Workflow

Select only the rule files that match the task. Start with correctness and

access control, then measure performance before proposing tuning changes.

  1. Identify the database version, hosting constraints, workload shape, and

whether the task changes data or only reviews SQL.

  1. Read the relevant query-, conn-, security-, schema-, lock-,

data-, or monitor- references; avoid loading the full rule set by default.

  1. Preserve existing RLS and privilege boundaries. Treat disabling RLS,

broadening grants, destructive DDL, and production writes as separate,

explicitly authorized actions.

  1. For performance claims, capture the query shape and an EXPLAIN or

EXPLAIN (ANALYZE, BUFFERS) result in a safe environment. Do not infer an

improvement from the presence of an index alone.

  1. Verify migrations on a representative schema, including rollback or a

forward-fix path, lock duration, and compatibility with concurrent traffic.

Acceptance Evidence

same parameters and representative data distribution.

storage, and maintenance overhead.

service-role success is not proof that end-user policies work.

statement compatibility, connection limits, and saturation behavior.

recovery procedure before production rollout.

Boundaries

explicitly safe transaction and authorization; plain EXPLAIN is the safer

default for uncertain statements.

replication health, or zero-downtime migration behavior.

<!-- LOCAL-QUALITY-SUPPLEMENT:END -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.