AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

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

Original source
supabase
License
MIT
Pinned revision
c9be0e931b7930f7d02126d04774d904c381e7d7

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read supabase--supabase-postgres-best-practices at revision c9be0e931b7930f7d02126d04774d904c381e7d7, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 36

references/_sections.md

Section Definitions

This file defines the rule categories for Postgres best practices. Rules are automatically assigned to sections based on their filename prefix.

Take the examples below as pure demonstrative. Replace each section with the actual rule categories for Postgres best practices.


1. Query Performance (query)

Impact: CRITICAL Description: Slow queries, missing indexes, inefficient query plans. The most common source of Postgres performance issues.

2. Connection Management (conn)

Impact: CRITICAL Description: Connection pooling, limits, and serverless strategies. Critical for applications with high concurrency or serverless deployments.

3. Security & RLS (security)

Impact: CRITICAL Description: Row-Level Security policies, privilege management, and authentication patterns.

4. Schema Design (schema)

Impact: HIGH Description: Table design, index strategies, partitioning, and data type selection. Foundation for long-term performance.

5. Concurrency & Locking (lock)

Impact: MEDIUM-HIGH Description: Transaction management, isolation levels, deadlock prevention, and lock contention patterns.

6. Data Access Patterns (data)

Impact: MEDIUM Description: N+1 query elimination, batch operations, cursor-based pagination, and efficient data fetching.

7. Monitoring & Diagnostics (monitor)

Impact: LOW-MEDIUM Description: Using pg_stat_statements, EXPLAIN ANALYZE, metrics collection, and performance diagnostics.

8. Advanced Features (advanced)

Impact: LOW Description: Full-text search, JSONB optimization, PostGIS, extensions, and advanced Postgres features.