postgres-best-practices
Installation
SKILL.md
PostgreSQL Best Practices
Goal: Design scalable, secure, and performant database schemas and queries, specifically optimized for Supabase/PostgreSQL environments.
1. Schema Design
- Normalization: Aim for 3NF (Third Normal Form) to reduce redundancy.
- Primary Keys: Use
UUID(v7 or v4) orBIGINT(Identity) for primary keys. Avoid simplistic auto-incrementINTif scaling horizontally. - Naming: Use
snake_casefor table and column names. Plural for tables (users,orders). - Foreign Keys: Always define foreign key constraints to ensure data integrity. Index all FK columns.
2. Performance & Indexing
- Indexes:
- B-Tree: Default for equality and range queries.
- GIN: For JSONB and Full-Text Search (
tsvector). - GiST: For Geo-spatial data (
PostGIS).
- Composite Indexes: Create composite indexes for columns frequently queried together (order matters: equality first, then range).
- Explain Analyze: Always check
EXPLAIN ANALYZEon complex queries to verify index usage.
Related skills
More from dokhacgiakhoa/antigravity-ide
ui-ux-pro-max-skill
Premium design and micro-interactions toolkit.
89notion-mcp
Official Notion Model Context Protocol Server for workspace interaction.
33filesystem-mcp
Official Filesystem Model Context Protocol Server for local file operations.
24puppeteer-mcp
Official Puppeteer Model Context Protocol Server for browser automation.
15penetration-tester-master
Ultimate Offensive Security Master Skill.
14postgres-mcp
Official PostgreSQL Model Context Protocol Server for database interaction.
14