Supabase postgres best practices

From Asymmetric-al/core · View interactive version

Supabase postgres best practices is an AI agent skill from the GitHub repository Asymmetric-al/core. 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

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.

This repository (Asymmetric-al/core)

When to Apply

Reference these guidelines when:

Do not use this skill 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- |

Workflow (this repo)

  1. Identify the hot path (query latency, lock contention, scan volume, or RLS overhead).
  2. Inspect indexing and query-shape problems first (query-*, schema-*).
  3. Validate RLS and policy cost for protected tables (security-*).
  4. Prefer schema and access-pattern fixes before low-level micro-optimizations.
  5. Verify with realistic query plans and app behavior.
  6. If behavior changes, update relevant backend docs and migration notes.

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:

Checklist

References

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.