supabase-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.
- License 许可
- MIT
- 最近更新
- 2026-10-22
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- supabase-postgres-best-practices
- license
- MIT
- metadata
- { "author": "supabase", "version": "1.0.0" }
- description
- Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
02 资源文件 35
- 参考文档AGENTS.md43.9 KB
- 参考文档README.md3.1 KB
- 参考文档rules/_contributing.md4.0 KB
- 参考文档rules/_sections.md1.6 KB
- 参考文档rules/_template.md1.0 KB
- 参考文档rules/advanced-full-text-search.md1.4 KB
- 参考文档rules/advanced-jsonb-indexing.md1.4 KB
- 参考文档rules/conn-idle-timeout.md1.3 KB
- 参考文档rules/conn-limits.md1.3 KB
- 参考文档rules/conn-pooling.md1.3 KB
- 参考文档rules/conn-prepared-statements.md1.5 KB
- 参考文档rules/data-batch-inserts.md1.3 KB
- 参考文档rules/data-n-plus-one.md1.3 KB
- 参考文档rules/data-pagination.md1.3 KB
- 参考文档rules/data-upsert.md1.4 KB
- 参考文档rules/lock-advisory.md1.5 KB
- 参考文档rules/lock-deadlock-prevention.md1.8 KB
- 参考文档rules/lock-short-transactions.md1.3 KB
- 参考文档rules/lock-skip-locked.md1.3 KB
- 参考文档rules/monitor-explain-analyze.md1.4 KB
- 参考文档rules/monitor-pg-stat-statements.md1.4 KB
- 参考文档rules/monitor-vacuum-analyze.md1.5 KB
- 参考文档rules/query-composite-indexes.md1.4 KB
- 参考文档rules/query-covering-indexes.md1.3 KB
- 参考文档rules/query-index-types.md1.4 KB
- 参考文档rules/query-missing-indexes.md1.2 KB
- 参考文档rules/query-partial-indexes.md1.3 KB
- 参考文档rules/schema-data-types.md1.4 KB
- 参考文档rules/schema-foreign-key-indexes.md1.6 KB
- 参考文档rules/schema-lowercase-identifiers.md1.7 KB
- 参考文档rules/schema-partitioning.md1.5 KB
- 参考文档rules/schema-primary-keys.md1.8 KB
- 参考文档rules/security-privileges.md1.5 KB
- 参考文档rules/security-rls-basics.md1.3 KB
- 参考文档rules/security-rls-performance.md1.5 KB
03 SKILL.md 正文
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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Query Performance | CRITICAL | query- |
| 2 | Connection Management | CRITICAL | conn- |
| 3 | Security & RLS | CRITICAL | security- |
| 4 | Schema Design | HIGH | schema- |
| 5 | Concurrency & Locking | MEDIUM-HIGH | lock- |
| 6 | Data Access Patterns | MEDIUM | data- |
| 7 | Monitoring & Diagnostics | LOW-MEDIUM | monitor- |
| 8 | Advanced Features | LOW | advanced- |
How to Use
Read individual rule files for detailed explanations and SQL examples:
rules/query-missing-indexes.md
rules/schema-partial-indexes.md
rules/_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)
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
04 同仓库更多 Skills
testing-best-practices
Laravel test design and review. Use when selecting coverage, naming or structuring tests, choosing assertions or test data, isolating dependencies, testing HTTP or security boundaries, improving suite performance, or reviewing test value. Use framework guidance or search-docs for Pest and PHPUnit syntax.
tailwindcss-development
Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS.
laravel-best-practices
Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns.
infer-conventions
Use this skill to analyze how a Laravel application is actually written and record its conventions as shared rules. Trigger when the user wants to detect, infer, document, or standardize project conventions or coding style, set up or grow `.ai/rules`, resolve mixed or conflicting patterns (e.g. "are we using Form Requests or inline validation?"), or onboard agents and teammates to "how we do things here". Covers: a systematic sweep of ~49 Laravel convention dimensions (validation, models, architecture, testing, frontend, database, console), open-ended house-pattern discovery, conflict reporting, and recording rules scoped to the right paths via the Boost `record-rule` MCP tool. Only run this skill when the user explicitly asks for it; never start a sweep as part of another task. Do not use for one-off code review, enforcing formatting a linter already handles, or editing `.ai/rules` files by hand.
inertia-react-development
Develops Inertia.js v2 React client-side applications. Activates when creating React pages, forms, or navigation; using <Link>, <Form>, useForm, or router; working with deferred props, prefetching, or polling; or when user mentions React with Inertia, React pages, React forms, or React navigation.
deploying-to-cloud
Deploys and manages Laravel applications on Laravel Cloud using the `cloud` CLI. Use when the user wants to deploy an app, ship to Cloud, create or manage applications, environments, databases, caches, object storage, queues, domains, instances, background processes, secrets, compute, scheduled tasks, or Laravel Cloud infrastructure; or check billing, usage, or spend. Triggers on deployment, shipping, Cloud management, environment setup, database provisioning, billing or usage queries, the `cloud` CLI, and Laravel Cloud deployment troubleshooting.