supabase-postgres-best-practices

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

Author

supabase

Install

Hot:5

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-postgres-best-practices&locale=en&source=copy

Supabase Postgres Best Practices - Authoritative Guide to Database Performance Optimization

Skills Overview

Supabase Postgres Best Practices is a comprehensive database performance optimization guide that provides 60+ verified optimization rules across 8 categories. It helps developers quickly identify and resolve Postgres performance bottlenecks.

Use Cases

  • Write and Optimize SQL Queries

  • Automatically detect performance issues in queries during development, such as missing indexes, N+1 queries, inefficient JOIN operations, etc. Get specific optimization recommendations and SQL examples with improvements.

  • Design and Optimize Database Schema

  • In the early stages of a project or during refactoring, choose appropriate index types (B-tree, Hash, GIN, etc.) based on business scenarios. Design table structures that follow best practices and avoid common anti-patterns.

  • Troubleshoot Performance Issues in Production

  • When the database experiences slow queries, connection pool exhaustion, lock waits, and other problems, identify the most critical performance bottlenecks quickly by rule priority and get targeted solutions.

    Core Features

  • Priority-Based Optimization Rules

  • Categorize 60+ optimization rules into 8 groups (query performance, connection management, security and RLS, schema design, etc.). Mark priorities such as CRITICAL, HIGH, MEDIUM based on impact level, helping developers address the most severe issues first.

  • Supabase-Specific Optimization Recommendations

  • In addition to general Postgres best practices, include Supabase-specific advice, such as the performance impact of Row-Level Security (RLS) policies, connection pool configuration, API response optimization, and more.

  • Complete SQL Examples and Explanations

  • Each rule includes a comparison between incorrect and correct examples, along with EXPLAIN output analysis and performance metrics. This way, developers not only know what to do, but also understand why.

    Common Questions

    Is this skill suitable for beginners?

    Yes. The rule documentation provides detailed explanations and SQL examples, so it’s understandable even without deep database background. Start by learning rules marked as CRITICAL and HIGH, as these have the biggest impact.

    How is it different from the official Postgres documentation?

    The official documentation focuses on feature descriptions and syntax references. This skill focuses on hands-on performance optimization, summarizing experience from production environments maintained by Supabase and offering guidance that is more closely aligned with real development scenarios.

    Will the rules be automatically applied to my database?

    No. This is a reference guide—you need to manually modify your SQL or Schema based on the recommendations. You can also use it as part of your code review process to check compliance with best practices when merging PRs.