Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
Add this skill
npx mdskills install supabase/supabase-postgres-best-practicesComprehensive Postgres optimization guide with clear categorization, detailed examples, and actionable rules
This skill contains Postgres performance optimization references optimized for AI agents and LLMs. It follows the Agent Skills Open Standard.
# From repository root
npm install
# Validate existing references
npm run validate
# Build AGENTS.md
npm run build
Choose a section prefix based on the category:
query- Query Performance (CRITICAL)conn- Connection Management (CRITICAL)security- Security & RLS (CRITICAL)schema- Schema Design (HIGH)lock- Concurrency & Locking (MEDIUM-HIGH)data- Data Access Patterns (MEDIUM)monitor- Monitoring & Diagnostics (LOW-MEDIUM)advanced- Advanced Features (LOW)Copy the template:
cp references/_template.md references/query-your-reference-name.md
Fill in the content following the template structure
Validate and build:
npm run validate
npm run build
Review the generated AGENTS.md
skills/supabase-postgres-best-practices/
├── SKILL.md # Agent-facing skill manifest (Agent Skills spec)
├── AGENTS.md # [GENERATED] Compiled references document
├── README.md # This file
└── references/
├── _template.md # Reference template
├── _sections.md # Section definitions
├── _contributing.md # Writing guidelines
└── *.md # Individual references
packages/skills-build/
├── src/ # Generic build system source
└── package.json # NPM scripts
See references/_template.md for the complete template. Key elements:
---
title: Clear, Action-Oriented Title
impact: CRITICAL|HIGH|MEDIUM-HIGH|MEDIUM|LOW-MEDIUM|LOW
impactDescription: Quantified benefit (e.g., "10-100x faster")
tags: relevant, keywords
---
## [Title]
[1-2 sentence explanation]
**Incorrect (description):**
```sql
-- Comment explaining what's wrong
[Bad SQL example]
```
Correct (description):
-- Comment explaining why this is better
[Good SQL example]
## Writing Guidelines
See `references/_contributing.md` for detailed guidelines. Key principles:
1. **Show concrete transformations** - "Change X to Y", not abstract advice
2. **Error-first structure** - Show the problem before the solution
3. **Quantify impact** - Include specific metrics (10x faster, 50% smaller)
4. **Self-contained examples** - Complete, runnable SQL
5. **Semantic naming** - Use meaningful names (users, email), not (table1, col1)
## Impact Levels
| Level | Improvement | Examples |
|-------|-------------|----------|
| CRITICAL | 10-100x | Missing indexes, connection exhaustion |
| HIGH | 5-20x | Wrong index types, poor partitioning |
| MEDIUM-HIGH | 2-5x | N+1 queries, RLS optimization |
| MEDIUM | 1.5-3x | Redundant indexes, stale statistics |
| LOW-MEDIUM | 1.2-2x | VACUUM tuning, config tweaks |
| LOW | Incremental | Advanced patterns, edge cases |
Install via CLI
npx mdskills install supabase/supabase-postgres-best-practicesSupabase Postgres Best Practices is a free, open-source AI agent skill. Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
Install Supabase Postgres Best Practices with a single command:
npx mdskills install supabase/supabase-postgres-best-practicesThis downloads the skill files into your project and your AI agent picks them up automatically.
Supabase Postgres Best Practices works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.