Skip to content
SkillImported

supabase-postgres-best-practices

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 policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

Imported description, not reviewed yet

This item came from its original repository and was only scanned automatically; no editor has written an Arabic description for it yet. Read its content yourself before you rely on it. This page is not indexed by search engines until it is reviewed.

Download

Files: 36 · Size: 62 KB

Download the ZIP

The file carries the license of the original source.

Install

After downloading, run the command in a terminal. unzip asks before it replaces any file that is there.

  • For this project

    It goes in: .claude/skills/supabase-postgres-best-practices/

    mkdir -p .claude/skills && unzip ~/Downloads/supabase-postgres-best-practices.zip -d .claude/skills

  • For your account on the whole machine

    It goes in: ~/.claude/skills/supabase-postgres-best-practices/

    mkdir -p ~/.claude/skills && unzip ~/Downloads/supabase-postgres-best-practices.zip -d ~/.claude/skills

Instructions

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:

references/query-missing-indexes.md
references/query-partial-indexes.md
references/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect SQL example with explanation
  • Correct SQL example with explanation
  • Optional EXPLAIN output or metrics
  • Additional context and references
  • Supabase-specific notes (when applicable)

References

Files

  • folderreferences52 KB
    • _contributing.md4 KB
    • _sections.md1.6 KB
    • _template.md1 KB
    • advanced-full-text-search.md1.4 KB
    • advanced-jsonb-indexing.md1.4 KB
    • conn-idle-timeout.md1.3 KB
    • conn-limits.md1.3 KB
    • conn-pooling.md1.3 KB
    • conn-prepared-statements.md1.5 KB
    • data-batch-inserts.md1.3 KB
    • data-n-plus-one.md1.3 KB
    • data-pagination.md1.3 KB
    • data-upsert.md1.4 KB
    • lock-advisory.md1.5 KB
    • lock-deadlock-prevention.md1.8 KB
    • lock-short-transactions.md1.3 KB
    • lock-skip-locked.md1.3 KB
    • monitor-explain-analyze.md1.4 KB
    • monitor-pg-stat-statements.md1.4 KB
    • monitor-vacuum-analyze.md1.5 KB
    • query-composite-indexes.md1.4 KB
    • query-covering-indexes.md1.3 KB
    • query-index-types.md1.5 KB
    • query-missing-indexes.md1.2 KB
    • query-partial-indexes.md1.3 KB
    • schema-constraints.md1.8 KB
    • schema-data-types.md1.4 KB
    • schema-foreign-key-indexes.md1.6 KB
    • schema-lowercase-identifiers.md1.7 KB
    • schema-partitioning.md1.5 KB
    • schema-primary-keys.md1.8 KB
    • security-privileges.md1.5 KB
    • security-rls-basics.md1.3 KB
    • security-rls-performance.md2.1 KB
  • CHANGELOG.md5.6 KB
  • LICENSE1 KB
  • SKILL.md3.2 KB

Comments (0)

No comments yet. Be the first.

Sign in to comment. Commenting comes at level 1 (Member).

Report

Similar items

  • SkillImported

    alloydb-basics

    Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB MCP tools for automated database operations including AI-powered search and vector capabilities.

    MITFiles: 7

  • SkillImported

    alphafold-database

    Access AlphaFold's 200M+ AI-predicted protein structures. Retrieve structures by UniProt ID, download PDB/mmCIF files, analyze confidence metrics (pLDDT, PAE), for drug discovery and structural biology.

    MITFiles: 2

  • SkillImportedContains scripts

    biorxiv-database

    Efficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature re

    MITFiles: 3

  • SkillImportedContains scripts

    brenda-database

    Access BRENDA enzyme database via SOAP API. Retrieve kinetic parameters (Km, kcat), reaction equations, organism data, and substrate-specific enzyme information for biochemical research and metabolic pathway analysis.

    MITFiles: 5

  • SkillImported

    bullmq-specialist

    BullMQ expert for Redis-backed job queues, background processing, and reliable async execution in Node.js/TypeScript applications. Use when: bullmq, bull queue, redis queue, background job, job queue.

    MITFiles: 1

  • SkillImported

    cc-skill-clickhouse-io

    ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

    MITFiles: 1