NEW Browse AI tools across categories — updated daily. See what's new →

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.

AuthorSupabase
Version1.0.0
LicenseMIT
Token count~1,102
UpdatedJun 5, 2026

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/supabase/agent-skills/tree/main/skills/supabase-postgres-best-practices
Or pick agent:
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent claude-code
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent cursor
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent codex
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent opencode
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent github-copilot
npx skills add supabase/agent-skills --skill "Postgres Best Practices" --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add supabase/agent-skills --skill "Postgres Best Practices"

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/supabase/agent-skills.git
cp -r agent-skills/skills/supabase-postgres-best-practices ~/.claude/skills/
How to use: Once installed, ask your agent to "use the Postgres Best Practices skill" or describe what you want (e.g. "Postgres performance optimization and best practices from Supabase. Use this ski"). Requires Node.js 18+.

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.

Postgres Best Practicesby Supabase

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

npx skills add https://github.com/supabase/agent-skills --skill supabase-postgres-best-practicesDownload ZIPGitHub

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

PriorityCategoryImpactPrefix1Query 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

Related Skills

async-pr-reviewby google-geminiTrigger this skill when the user wants to start an asynchronous PR review, run background checks on a PR, or check the status of a previously started async PR…shopify-liquidby shopifyLiquid is an open-source templating language created by Shopify. It is the backbone of Shopify themes and is used to load dynamic content on storefronts.…aspnet-minimal-api-openapiby githubASP.NET Minimal API endpoints with automatic OpenAPI/Swagger documentation and strong typing. Organize endpoints using MapGroup() , endpoint filters, and feature-based folder structures for scalability Define explicit request/response DTOs with validation attributes; use record types and TypedResults for type safety Leverage .NET 9 built-in OpenAPI support with operation summaries, descriptions, operationIds, and property-level documentation via [Description()] Apply document and schema...pr-referenceby microsoftGenerates PR reference XML containing commit history and unified diffs between branches with extension and path filtering. Includes utilities to list changed…building-ai-agent-on-cloudflareby Cloudflare| Builds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities. Generates production-ready agent code deployed to Workers.

Use when: user wants to "build an agent", "AI agent", "chat agent", "stateful
agent", mentions "Agents SDK", needs "real-time AI", "WebSocket AI", or asks
about agent "state management", "scheduled tasks", or "tool calling".azure-search-documents-dotnetby microsoftBuild search applications with full-text, vector, semantic, and hybrid search capabilities.fluid-prby microsoftUse when creating a pull request in the Fluid Framework repo. Composes a PR title and body following Fluid Framework conventions, proposes them to the user,…shopify-adminby shopifyWrite or explain Admin GraphQL queries and mutations for apps and integrations that extend the Shopify admin. Use when the user wants to understand,…

---

Source: https://github.com/supabase/agent-skills/tree/main/skills/supabase-postgres-best-practices
Author: Supabase
Discovered via**: mcpservers.org

SKILL.md source

---
name: Postgres Best Practices
description: Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
---

# 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.

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

`npx skills add https://github.com/supabase/agent-skills --skill supabase-postgres-best-practices`Download ZIPGitHub

## 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

PriorityCategoryImpactPrefix1Query PerformanceCRITICAL`query-`2Connection ManagementCRITICAL`conn-`3Security & RLSCRITICAL`security-`4Schema DesignHIGH`schema-`5Concurrency & LockingMEDIUM-HIGH`lock-`6Data Access PatternsMEDIUM`data-`7Monitoring & DiagnosticsLOW-MEDIUM`monitor-`8Advanced FeaturesLOW`advanced-`

## 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

## Related Skills
async-pr-reviewby google-geminiTrigger this skill when the user wants to start an asynchronous PR review, run background checks on a PR, or check the status of a previously started async PR…shopify-liquidby shopifyLiquid is an open-source templating language created by Shopify. It is the backbone of Shopify themes and is used to load dynamic content on storefronts.…aspnet-minimal-api-openapiby githubASP.NET Minimal API endpoints with automatic OpenAPI/Swagger documentation and strong typing. Organize endpoints using MapGroup() , endpoint filters, and feature-based folder structures for scalability Define explicit request/response DTOs with validation attributes; use record types and TypedResults for type safety Leverage .NET 9 built-in OpenAPI support with operation summaries, descriptions, operationIds, and property-level documentation via [Description()] Apply document and schema...pr-referenceby microsoftGenerates PR reference XML containing commit history and unified diffs between branches with extension and path filtering. Includes utilities to list changed…building-ai-agent-on-cloudflareby Cloudflare|
Builds AI agents on Cloudflare using the Agents SDK with state management,
real-time WebSockets, scheduled tasks, tool integration, and chat capabilities.
Generates production-ready agent code deployed to Workers.

Use when: user wants to "build an agent", "AI agent", "chat agent", "stateful
agent", mentions "Agents SDK", needs "real-time AI", "WebSocket AI", or asks
about agent "state management", "scheduled tasks", or "tool calling".azure-search-documents-dotnetby microsoftBuild search applications with full-text, vector, semantic, and hybrid search capabilities.fluid-prby microsoftUse when creating a pull request in the Fluid Framework repo. Composes a PR title and body following Fluid Framework conventions, proposes them to the user,…shopify-adminby shopifyWrite or explain **Admin GraphQL** queries and mutations for apps and integrations that extend the Shopify admin. Use when the user wants to **understand,…

---

**Source**: https://github.com/supabase/agent-skills/tree/main/skills/supabase-postgres-best-practices
**Author**: Supabase
**Discovered via**: mcpservers.org

Related skills 6

azure-storage

★ Featured Official

Azure Storage Services including Blob Storage, File Shares, Queue Storage, Table Storage, and Data Lake. Answers questions about storage access tiers (hot, cool, cold, archive), when to use each tier, and tier comparison. Provides object storage, SMB file shares, async messaging, NoSQL key-value, and big data analytics. Includes lifecycle management. USE FOR: blob storage, file shares, queue storage, table storage, data lake, upload files, download blobs, storage accounts, access tiers, stora...

microsoft 338k
Backend & Database

azure-kusto

★ Featured Official

Query and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection.

microsoft 337k
Backend & Database

azure-aigateway

★ Featured Official

Configure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API to MCP, import OpenAPI to gateway.

microsoft 337k
Backend & Database

azure-compute

★ Featured Official

Azure VM and VMSS router for recommendations, pricing, autoscale, orchestration, connectivity troubleshooting, capacity reservations, and Essential Machine Management. WHEN: Azure VM, VMSS, scale set, recommend, compare, server, website, burstable, lightweight, VM family, workload, GPU, learning, simulation, dev/test, backend, autoscale, load balancer, Flexible orchestration, Uniform orchestration, cost estimate, connect, refused, Linux, black screen, reset password, reach VM, port 3389, NSG,...

microsoft 281k
Backend & Database

azure-cloud-migrate

★ Featured Official

Assess and migrate cross-cloud workloads to Azure with reports and code conversion. Supports Lambda→Functions, Beanstalk/Heroku/App Engine→App Service, Fargate/Kubernetes/Cloud Run/Spring Boot→Container Apps. WHEN: migrate Lambda to Functions, AWS to Azure, migrate Beanstalk, migrate Heroku, migrate App Engine, Cloud Run migration, Fargate to ACA, ECS/Kubernetes/GKE/EKS to Container Apps, Spring Boot to Container Apps, cross-cloud migration.

microsoft 271k
Backend & Database

azure-upgrade

★ Featured Official

Assess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code. WHEN: upgrade Consumption to Flex Consumption, upgrade Azure Functions plan, change hosting plan, function app SKU, migrate App Service to Container Apps, modernize legacy Azure Java SDKs (com.microsoft.azure to com.azure), migrate Azure Cache for Redis (ACR/ACRE) to Azure Managed Redis (AMR).

microsoft 201k
Backend & Database