tokens&
BrowseFor enterprises
Submit an offer
  1. Home
  2. Agent Skills
  3. Postgres best practices

Postgres best practices

Tune queries, RLS, connection pooling, and schema choices before a build slows down.

By SupabaseMIT · License identifiedView source

Install in your agent

npx skills add 'https://github.com/supabase/agent-skills/tree/main/skills/supabase-postgres-best-practices' --skill 'supabase-postgres-best-practices' --agent 'codex'

Run from your repo. Project location: .agents/skills/supabase-postgres-best-practices/

Needs Node.js, npm and Git. Review the install prompt, then start a new agent session.

Read skill instructions

Snapshot from 2026-09-04. The install command fetches the upstream package, which may have changed since this snapshot.

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
Source & package details

Vendor-authored source · Source snapshot: 2026-09-04. This listing does not verify installation, security, vendor participation, or product use.

Installs the complete skill directory, including its supporting files. A skill package does not set up an MCP server connection.

Raw SKILL.md
Skill name
supabase-postgres-best-practices
Trigger conditions
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.
Declared license
MIT
Version
1.1.1
Author
supabase
Organization
Supabase
Project idea & related offer

Tokens& curated build recipe

A private project tracker

Build a small project tracker with Supabase Auth and Postgres. Give each signed-in builder access only to their own projects, and use the Postgres skill to review the schema, queries, and row-level security.

  1. 1. Check the free tier

    Supabase free backend tier

    The Free plan is available for experiments and hobby projects. Database, storage, and egress quotas apply; inactive projects can pause after one week.

    Read Supabase terms
  2. 2. Use the vendor skill

    Postgres best practices

    Review the source and install instructions, then use the skill in your own project.

    See install instructions
  3. 3. Build and show the result

    Save the Build Packet, then attach a demo or repository with tests proving two users cannot read or modify each other's projects.

    Start this Build Packet

Public resources selected by Tokens&. Terms reviewed 2026-09-05; the provider decides eligibility and current limits. This recipe is a suggested project, not a vendor partnership or a completed build.

More from Supabase
  • Supabase platform guide
tokens&

Find tools, check provider offers, save a build plan, and share your work when you’re ready.

For buildersFor enterprises

For builders

  • Startup credits and perks
  • Agent Skills
  • Publish a project

For enterprises

  • Start free company workspace
  • Submit a tool, product, or perk

Community

  • Community
  • Newsletter
  • Events
Xin

© 2026 tokensand, LLC. All rights reserved.

  • Terms
  • Privacy
  • Security
  • Data Processing
  • Status