supabase-postgres-best-practices

Apply Supabase-tailored Postgres optimization rules for queries, indexing, partitioning, and RLS.

339|58|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/Heyvhuang/ship-faster --skill supabase-postgres-best-practices-heyvhuang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/Heyvhuang/ship-faster/tree/main/skills/supabase/references/postgres-best-practices
Command: npx skills add https://github.com/Heyvhuang/ship-faster --skill supabase-postgres-best-practices-heyvhuang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill bundles a curated set of Postgres optimization rules and best practices tailored for Supabase users, helping teams diagnose and fix performance and reliability issues in database workloads.

Core Features & Use Cases

  • Query tuning: guidance on indexing strategies (single-column, composite, partial, covering) and index types (btree, gin, brin, hash) to accelerate common queries.
  • Schema design & maintenance: guidance on data types, foreign keys, partitioning, RLS, and access controls to ensure scalable, secure schemas.
  • Operations & monitoring: best practices for VACUUM, ANALYZE, autovacuum tuning, and query analysis to maintain healthy performance over time.
  • Use Case: When dealing with large tables (e.g., >100M rows) or multi-tenant data with RLS, apply these rules to achieve steady performance.

Quick Start

  • Run npm install at the repository root to install dependencies.
  • Validate rules with npm run validate.
  • Build the AGENTS.md document with npm run build.

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 Postgres queries on large Supabase tables?

Optimize Postgres queries on large Supabase tables by applying concrete indexing strategies like composite, partial, and covering indexes. This skill provides tailored rules for btree, gin, and brin index types to accelerate common queries on tables exceeding 100 million rows.

When do I need table partitioning in Supabase Postgres?

Table partitioning in Supabase Postgres is needed when managing large datasets to ensure scalable schemas and steady performance. This skill provides concrete guidelines for implementing partitioning alongside proper data types and foreign keys to maintain reliability.

What's the best way to tune autovacuum and VACUUM settings in Postgres?

The best way to tune autovacuum and VACUUM settings is by applying curated maintenance rules for healthy performance over time. This skill enforces specific VACUUM, ANALYZE, and autovacuum tuning practices to maintain database operations and reliability.

How does Row Level Security (RLS) impact Postgres performance in multi-tenant Supabase apps?

Row Level Security (RLS) impacts Postgres performance by adding query overhead in multi-tenant Supabase apps. This skill enforces concrete guidelines for RLS performance and access controls to ensure scalable and secure schemas without degrading query speed.

Can I use these Postgres optimization rules for databases with over 100 million rows?

Yes, you can use these Postgres optimization rules for databases with over 100 million rows. The skill is specifically designed to apply Supabase-tailored optimization best practices to large tables and multi-tenant data workloads to achieve steady performance.

Why are my Supabase Postgres queries slow despite having indexes?

Supabase Postgres queries may be slow despite indexes due to schema design flaws, outdated statistics, or inefficient RLS policies. This skill diagnoses and fixes performance issues by applying rules for query analysis, VACUUM, ANALYZE, and proper indexing strategies.