DuoMDuoM
DuoM: MCP servers, skills and rules for your agent, checked before installContact: studo.doum@gmail.comDocsFor makersReportTermsPrivacy
MCPSkillsStacksRulesDocs
Sign in

Supabase Postgres Best PracticesSkill

@c9be0e9
by supabaseRepository ↗ReportSkill folder ↗

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.

Original work bysupabaseingithub.com/supabase/agent-skills ↗· MIT. DuoM only lists and checks it; installs copy the license with it.
DatabasesLicense: MITRepo ★ 3,19236 filesUpdated 2 months agoskill/supabase/agent-skills/supabase-postgres-best-practices

Install

Run in your project folder (DuoM CLI: risk check, then write; undo with npx duom@1 undo)
npx duom@1 add skill/supabase/agent-skills/supabase-postgres-best-practices --client claude-code

Writes to .claude/skills/supabase-postgres-best-practices/ in your project (where Claude Code reads it). Add --global to install it for every project (~/.claude/skills). The license file comes with it.

Manual: copy the folder from GitHub (pinned commit) into .claude/skills/supabase-postgres-best-practices/, with the repository's LICENSE.

SKILL.md

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

    • https://www.postgresql.org/docs/current/
    • https://supabase.com/docs
    • https://wiki.postgresql.org/wiki/Performance_Optimization
    • https://supabase.com/docs/guides/database/overview
    • https://supabase.com/docs/guides/auth/row-level-security
    Files (36)
    • CHANGELOG.md
    • SKILL.md
    • references/_contributing.md
    • references/_sections.md
    • references/_template.md
    • references/advanced-full-text-search.md
    • references/advanced-jsonb-indexing.md
    • references/conn-idle-timeout.md
    • references/conn-limits.md
    • references/conn-pooling.md
    • references/conn-prepared-statements.md
    • references/data-batch-inserts.md
    • references/data-n-plus-one.md
    • references/data-pagination.md
    • references/data-upsert.md
    • references/lock-advisory.md
    • references/lock-deadlock-prevention.md
    • references/lock-short-transactions.md
    • references/lock-skip-locked.md
    • references/monitor-explain-analyze.md
    • references/monitor-pg-stat-statements.md
    • references/monitor-vacuum-analyze.md
    • references/query-composite-indexes.md
    • references/query-covering-indexes.md
    • references/query-index-types.md
    • references/query-missing-indexes.md
    • references/query-partial-indexes.md
    • references/schema-constraints.md
    • references/schema-data-types.md
    • references/schema-foreign-key-indexes.md
    • references/schema-lowercase-identifiers.md
    • references/schema-partitioning.md
    • references/schema-primary-keys.md
    • references/security-privileges.md
    • references/security-rls-basics.md
    • references/security-rls-performance.md

    Risk signals No signals

    DuoM read every file of this skill for hidden text, instructions to send secrets out, and code downloaded and run. No signals does not mean safe: read what the skill tells the agent to do.