supabase-postgres-best-practices

Review Postgres queries and schemas against Supabase-aligned best practices for indexes, connections, and RLS security.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/irchamaji/agents --skill supabase-postgres-best-practices-irchamaji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/irchamaji/agents/tree/main/skills/supabase-postgres-best-practices
Command: npx skills add https://github.com/irchamaji/agents --skill supabase-postgres-best-practices-irchamaji

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Slow or unreliable Postgres performance, inefficient query patterns, and unsafe schema/security choices by providing structured, high-impact guidance tailored to Supabase/Postgres workloads.

Core Features & Use Cases

  • Query performance rules: Detect and fix missing indexes, inefficient join/filter patterns, and plan issues using concrete incorrect-vs-correct SQL.
  • Schema & index design: Improve schema durability and speed with guidance on primary keys, composite/covering/partial indexes, foreign key indexing, and partitioning.
  • Connection management & security (RLS): Prevent connection exhaustion and ensure correct, performant row-level security with practical policy patterns and requirements.

Quick Start

Use the skill to review your Postgres query or schema design and return the most important fixes aligned to the rule categories and impact priorities.

Frequently Asked Questions about supabase-postgres-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow Postgres queries in Supabase?

To optimize slow Postgres queries in Supabase, analyze execution plans using EXPLAIN ANALYZE, add missing indexes, and fix inefficient join or filter patterns by applying incorrect-versus-correct SQL examples aligned with Supabase best practices.

What is the best way to design a scalable Postgres schema?

The best way to design a scalable Postgres schema is to use proper primary keys, implement composite, covering, and partial indexes, index foreign keys, and apply table partitioning to improve both durability and query speed.

How does row-level security (RLS) work for multi-tenant access in Postgres?

Row-level security (RLS) for multi-tenant access in Postgres works by enforcing performant policy patterns that restrict data access at the row level, ensuring correct and safe multi-tenant data isolation without relying solely on application logic.

How do I prevent Postgres connection exhaustion in Supabase?

To prevent Postgres connection exhaustion in Supabase, apply connection pooling best practices and tune connection behavior to manage concurrent database connections efficiently, avoiding exhausted connection limits during high traffic.

When do I need partial or covering indexes in Postgres?

You need partial or covering indexes in Postgres when optimizing queries that filter on specific subsets of data or require additional columns without table lookups, significantly improving query performance and reducing I/O overhead.