S
supabase-postgres-best-practices
About supabase-postgres-best-practices
A Supabase-maintained guide to Postgres performance optimization for SQL authors and database designers. Its rules span eight categories, prioritize impact, and include incorrect and corrected examples.
Key features
- 01Covers rules across eight optimization categories
- 02Prioritizes guidance by impact
- 03Includes incorrect and corrected SQL examples
- 04Addresses indexes, pooling, and RLS
- 05Links Postgres and Supabase references
Use cases
- 01Write queries or design database schemas
- 02Investigate and optimize database performance
- 03Review indexes, pooling, and RLS configuration
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ fcakyon/ claude-codex-settings --skill supabase-postgres-best-practicesAfter installing, type/supabase-postgres-best-practicesin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
CHANGELOG.mdreferences/_contributing.md_sections.md_template.mdadvanced-full-text-search.mdadvanced-jsonb-indexing.mdconn-idle-timeout.mdconn-limits.mdconn-pooling.mdconn-prepared-statements.mddata-batch-inserts.mddata-n-plus-one.mddata-pagination.mddata-upsert.mdlock-advisory.mdlock-deadlock-prevention.mdlock-short-transactions.mdlock-skip-locked.mdmonitor-explain-analyze.mdmonitor-pg-stat-statements.mdmonitor-vacuum-analyze.mdquery-composite-indexes.mdquery-covering-indexes.mdquery-index-types.mdquery-missing-indexes.mdquery-partial-indexes.mdschema-constraints.mdschema-data-types.mdschema-foreign-key-indexes.mdschema-lowercase-identifiers.mdDetails
From the project READMESupabase 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:
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
Comments
Markdown supported