Communitygithub.com

Supabase Postgres 最佳实践

由 Supabase 维护的 Postgres 最佳实践指南,适用于任何运行 Postgres 的地方。在编写或修改 Postgres 数据库中的任何内容(包括创建或修改表、列、模式设计、迁移、RLS 策略等)之前,请先加载此技能。

Supabase Postgres 最佳实践 是什么?

该技能提供了由 Supabase 维护的全面 Postgres 性能优化和最佳实践指南。它包含 8 个按优先级排序的类别,涵盖查询性能、连接管理、安全与 RLS、模式设计、并发与锁、数据访问模式、监控与诊断以及高级功能,旨在指导自动化查询优化和模式设计。无论你是在编写 SQL 查询、设计数据库模式、实施索引、排查慢查询,还是处理行级安全,该技能都能提供明确的规则、错误的 SQL 示例、正确的 SQL 示例以及 Supabase 特定的说明。它适用于所有 Postgres 部署,不仅限于 Supabase 平台。支持平台包括任何使用 Postgres 的环境,如 Supabase、自托管 Postgres、RDS、Cloud SQL 等。其工作原理是通过按优先级组织的 markdown 规则文件,开发者可以逐步阅读并应用,以提升数据库性能、安全性和可维护性。

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

在你喜欢的 AI 中提问

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

文档

Supabase Postgres 最佳实践 是做什么的?

由 Supabase 维护的全面 Postgres 性能优化指南。包含按优先级排序的 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 6 individual skills — each has its own dedicated page.

Audomsub/Tiktok-Shop

Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\".

Audomsub/Tiktok-Shop

A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

Audomsub/Tiktok-Shop

Implement a piece of work based on a spec or set of tickets.

Audomsub/Tiktok-Shop

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

Audomsub/Tiktok-Shop

Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.

Audomsub/Tiktok-Shop

Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).

相关技能