supabase-postgres-best-practices · openai — Codex skill: Postgres tuning rules
A rule set for Postgres performance, maintained by Supabase. Useful when your agent writes queries, designs schemas or digs into a slow database.
npx skills add openai/plugins --skill supabase-postgres-best-practices -a codexWhat supabase-postgres-best-practices does
The skill hands your agent a reference on Postgres optimization. Rules sit in 8 categories, ordered by impact: query performance, connection management and security with RLS come first, then schema design, locking, data access patterns, monitoring and advanced features. Each category has a filename prefix — query-, conn-, security-, schema-, lock-, data-, monitor-, advanced-.
Files live in references/, for example references/query-missing-indexes.md and references/query-partial-indexes.md. Every rule explains why it matters, shows a bad SQL example next to a good one, and adds EXPLAIN output or metrics. Supabase-specific notes appear where they apply.
Worth installing if you run Postgres or Supabase and want the agent to suggest indexes instead of piling on connections. On a small database with simple queries the reference won't change much.
What it helps with
- spot a query that needs an index
- read an EXPLAIN plan and find the bottleneck
- design a schema with the right types and relations
- size a connection pool for real load
- audit Row-Level Security policies
Example prompts for the agent
- review this query and tell me which indexes are missing
- check the orders and users tables against the schema- rules
- why is this query slow? walk through the execution plan
How to install supabase-postgres-best-practices
1Skills CLI (Vercel)
npx skills add openai/plugins --skill supabase-postgres-best-practices -a codex2Manually: put the files in place
.agents/skills/supabase-postgres-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add openai/plugins --skill supabase-postgres-best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/supabase-postgres-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/supabase-postgres-best-practices/
Manually: put the files in place
.cursor/skills/supabase-postgres-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install openai/plugins supabase-postgres-best-practices2Manually: put the files in place
.github/skills/supabase-postgres-best-practices/SKILL.mdPlatform CLI
gemini skills install https://github.com/openai/plugins --path plugins/supabase/skills/supabase-postgres-best-practicesManually: put the files in place
.devin/skills/supabase-postgres-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set201
The whole set →Other versions of supabase-postgres-best-practices
Similar
Questions about supabase-postgres-best-practices
How do I install supabase-postgres-best-practices in Claude?
Run npx skills add openai/plugins --skill supabase-postgres-best-practices -a codex. The skill lands at .agents/skills/supabase-postgres-best-practices/SKILL.md.
What does supabase-postgres-best-practices do?
It gives the agent Postgres tuning rules covering indexes, connections, RLS, schema and locking, and the agent applies them while writing or reviewing SQL.
Do I need a Supabase project for it to work?
No. It is a text reference — the agent reads the rule files and applies them to whatever Postgres code you have.
Source text
SKILL.md · MIT
--- name: supabase-postgres-best-practices description: 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 metadata: author: supabase version: "1.1.1" organization: Supabase date: January 2026 abstract: Comprehensive Postgres performance optimization guide for developers using Supabase and Postgres. Contains performance rules across 8 categories, prioritized by impact from critical (query performance, connection management) to incremental (advanced features). Each rule includes detailed explanations, incorrect vs. correct SQL examples, query plan analysis, and specific performance metrics to guide automated optimization and code generation. --- # 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: ``` 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 - https://www.postgresql.org/docs/current/ - https://supabase.com/docs - https://wiki.postgresql.org/wiki/Performance_Optimization - https://supabase.com/docs/guides/database/overview - https://supabase.com/docs/guides/auth/row-level-security
© supabase · MIT · openai/plugins