Postgres Best Practices

作者: Supabase

来自 Supabase 的 Postgres 性能优化与最佳实践。在编写、审查或优化 Postgres 查询、模式设计或数据库配置时使用此技能。

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

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

相关技能

azure-storage
microsoft
统一访问Azure blob存储、文件共享、队列、表格和数据湖服务。支持五种存储服务类型:用于对象和备份的Blob存储、用于SMB访问的文件共享、用于异步消息传递的队列存储、用于NoSQL键值数据的表格存储,以及用于大数据分析的数据湖。MCP服务器工具支持列出存储账户、容器和blob,并直接下载和上传blob内容。可配置访问层(热、冷、冷、归档)和...
awsdevelopmentdatabase
firestore-rules-creation
firebase
设计、编写、重构并强化适用于生产环境的 Cloud Firestore Security Rules(firestore.rules)。重要:如果你的环境支持子代理委派,且提供 firestore-rules-author 子代理,请将 firestore.rules 的编写工作委派给该子代理。如果无法使用子代理委派(例如 IDE 中未启用)、未安装 firestore-rules-author,或你正在 firestore-rules-author 中运行,请直接遵循此技能。
developmentsecuritydatabase
Frontend Design
Anthropic
生成独特且达到生产级水准的前端界面,避免千篇一律的AI美学风格。
developmentfeatured
neon
neondatabase
Neon平台概述,涵盖Postgres、Auth、Data API以及新服务:对象存储、计算函数和AI网关。当提到“Neon”时,用于概述如何与Neon协作及如何入门。否则,各项独立功能为触发点:“对象存储”或“S3兼容存储”、“无服务器函数”、“后台任务”或“在数据库附近运行代码”、“AI网关”、“LLM代理”、“模型路由”或“调用LLM”→...
apidevelopmentdatabase
neon-realtime
neondatabase
Neon Realtime 可让任何 SQL 查询实时更新。基于 Lakebase Postgres,使用实时 SQL 查询和响应式原语构建实时响应式应用和智能体。当应用 UI 或智能体状态必须根据数据库行实时更新时(如仪表板、信息流、协作、多用户或多设备同步),用于乐观变更,或替代轮询及其他实时同步系统。触发词包括“live query”、“subscribe”、“sync engine”、“useLiveQuery”、“TanStack DB”、“optimistic updates”、“@neon/realtime”……
apidevelopmentdatabase
prisma-orm-setup
prisma
在应用中设置 Prisma ORM、连接其数据库,或排查现有 Prisma 6、7 或 8 应用的连接问题。新应用默认使用 Prisma ORM 8,并加载由软件包提供的 prisma-8 skill;现有 Prisma 6/7 应用则继续使用原版本,并提供 PostgreSQL、MySQL、SQLite、SQL Server、CockroachDB、MongoDB 和 Prisma Postgres 的提供程序参考。
developmentdatabase
prisma-postgres-upgrade
prisma
将 PostgreSQL 应用从 Prisma ORM 6 或 7 一次性直接升级到 Prisma 8,同时保留现有的 schema.prisma、数据库和数据。适用于使用 Prisma 6 或 7、希望升级到 Prisma 8 的 Postgres 项目,包括在将其部署到 Prisma Compute 之前;Prisma Compute 仅运行 Prisma 8。以下情况可触发此技能:"upgrade prisma 6 to 8"、"upgrade prisma 7 to 8"、"upgrade to prisma 8 postgres"、"prisma7Schema"、"migrations/app"、"move off @prisma/client"、"Console says move to Prisma 8"。
developmentdatabase
React Best Practices
Vercel
来自 Vercel 工程团队的 React 和 Next.js 性能优化指南。在编写、审查或重构 React/Next.js 代码时使用此技能,以确保采用最佳性能模式。适用于涉及 React 组件、Next.js 页面、数据获取、打包优化或性能改进的任务。
developmentfeatured