supabase avatar

Supabase Postgres Best Practices

A solid reference for anyone working with Postgres, especially on Supabase. Contains 8 categories of performance rules prioritized by impact, from critical query optimization to advanced features. Each rule includes wrong vs. right SQL examples, query plan analysis, and specific performance metrics. The prioritization system is smart - it focuses on the stuff that actually breaks production first (missing indexes, connection pooling) before getting into nice-to-haves. Worth having loaded when reviewing database code or designing schemas, since it catches common Postgres pitfalls that can tank performance.

install copies · 90 days. Times the install command was copied on this site in the last 90 days, bots filtered.
153
skills.sh installs
479.8K
GitHub stars
3K
last updated
Aug 21, 2026

Install

$ npx -y skills add supabase/agent-skills --skill supabase-postgres-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

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:

  • Writing SQL queries or designing schemas
  • Implementing indexes or query optimization
  • Reviewing database performance issues
  • Configuring connection pooling or scaling
  • Optimizing for Postgres-specific features
  • Working with Row-Level Security (RLS)

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Query PerformanceCRITICALquery-
2Connection ManagementCRITICALconn-
3Security & RLSCRITICALsecurity-
4Schema DesignHIGHschema-
5Concurrency & LockingMEDIUM-HIGHlock-
6Data Access PatternsMEDIUMdata-
7Monitoring & DiagnosticsLOW-MEDIUMmonitor-
8Advanced FeaturesLOWadvanced-

How to Use

Read individual rule files for detailed explanations and SQL examples:

Sponsors

Details

Repository
github.com/supabase/agent-skills
Categories
Backend & APIs, Security, Documentation, AI & Agent Building, Debugging, Automation & Workflows, Design & UI/UX, Databases

More from supabase/agent-skills

All 3
1prisma avatarprisma-computeprisma/skillsPrisma Compute deployment and hosting guide. Use whenever the user mentions Prisma Compute, `prisma.compute.ts`, `defineComputeConfig`, deploying or hosting a P399.3Kskills.sh installs
2firebase avatarfirebase-hosting-basicsfirebase/agent-skillsDeploys and configures classic Firebase Hosting for static websites, single-page apps (SPAs), and microservices. Use when deploying static sites/SPAs, setting u177.5Kskills.sh installs
3firebase avatarfirebase-firestorefirebase/agent-skillsSets up, manages, queries, and configures Cloud Firestore databases (Standard/Enterprise edition), including data modeling, security rules, indexes, and SDK int142.8Kskills.sh installs
4firebase avatarfirebase-remote-config-basicsfirebase/agent-skillsManages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates128.4Kskills.sh installs
5autonnel avatarserver-side-conversion-trackingautonnel/autonnel-skillsSet up server-side conversion tracking so purchases are reported accurately to Facebook, TikTok, Google and Bing despite iOS restrictions, ad blockers and cooki120Kskills.sh installs
6convex avatarconvex-authconvex/agent-skillsAdd authentication (passkeys/OAuth) to the current Convex app, including the auth.config.ts wiring.41.4Kskills.sh installs