Communitygithub.com

PhuongDeveloper/landingpage

由 Supabase 维护的 Postgres 最佳实践指南,适用于任何地方的 Postgres。在编写或修改 Postgres 数据库中的任何内容(创建或修改表与列、模式设计、迁移、RLS 策略、索引、触发器、数据库函数、队列和定时任务、向量/语义搜索以及恢复数据)之前,请加载此技能。同样在诊断慢查询、高 CPU、超时、EXPLAIN 计划、连接耗尽、锁、膨胀或行对错误用户可见时也要加载。这不仅是一份性能指南——模式、迁移、安全和 SQL 编写任务也需要这些规则,即使只改动一列或一条查询。

landingpage 是什么?

该技能是一个全面的 Postgres 数据库最佳实践指南,由 Supabase 维护,适用于任何运行 Postgres 的环境。它涵盖了从查询性能、连接管理、安全与行级安全(RLS)到模式设计、并发与锁、数据访问模式、监控与诊断以及高级特性等八个类别的规则,每个类别按优先级排序并带有明确的前缀标识。开发者可以在编写或修改数据库对象之前加载此技能,以自动指导最佳的 SQL 编写、索引设计、迁移策略和 RLS 策略,从而避免常见陷阱。此外,该技能也适用于诊断性任务,如分析 EXPLAIN 计划、排查连接耗尽、锁竞争或数据可见性问题。技能文档本身引用官方 PostgreSQL 文档和 Supabase 指南,并建议用户单独阅读各个规则文件以获取详细的 SQL 示例和解释。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/PhuongDeveloper/landingpage/tree/HEAD/.agents/skills/supabase-postgres-best-practices

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Supabase Postgres 最佳实践

由 Supabase 维护的全面性能优化指南。涵盖按影响优先排序的 8 个类别的规则,用于指导自动化的查询优化和模式设计。

何时应用

在以下情况下参考这些指南:

  • 编写 SQL 查询或设计模式
  • 实施索引或查询优化
  • 审查数据库性能问题
  • 配置连接池或扩展
  • 优化 Postgres 特定功能
  • 使用行级安全(RLS)

按优先级划分的规则类别

优先级类别影响前缀
1查询性能关键query-
2连接管理关键conn-
3安全与 RLS关键security-
4模式设计高schema-
5并发与锁中高lock-
6数据访问模式中data-
7监控与诊断低中monitor-
8高级特性低advanced-

如何使用

阅读单个规则文件以获取详细解释和 SQL 示例:

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

每个规则文件包含:

  • 简要说明为什么它很重要
  • 带解释的错误 SQL 示例
  • 带解释的正确 SQL 示例
  • 可选的 EXPLAIN 输出或指标
  • 额外的上下文和参考
  • Supabase 特定说明(如适用)

参考资料

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

PhuongDeveloper/landingpage

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

PhuongDeveloper/landingpage

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); debugging and troubleshooting errors or unexpected behavior on Supabase projects (HTTP errors, Postgres errors, RLS surprises, permission denied, schema cache issues, timeouts, Edge Function crashes, Realtime drops, Storage failures) and reading or querying logs (Logs Explorer, ClickHouse).

PhuongDeveloper/landingpage

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

PhuongDeveloper/landingpage

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

相关技能