OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add affaan-m/ecc --skill postgres-patterns
PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices. Use when designing PostgreSQL schemas, indexes, or RLS policies, or when a query is too slow.
npx skills add affaan-m/ecc --skill postgres-patterns
Quick reference for PostgreSQL best practices. For detailed guidance, use the database-reviewer agent.
| Query Pattern | Index Type | Example |
|---|---|---|
WHERE col = value | B-tree (default) | CREATE INDEX idx ON t (col) |
WHERE col > value | B-tree | CREATE INDEX idx ON t (col) |
WHERE a = x AND b > y | Composite | CREATE INDEX idx ON t (a, b) |
WHERE jsonb @> '{}' | GIN | CREATE INDEX idx ON t USING gin (col) |
WHERE tsv @@ query | GIN | CREATE INDEX idx ON t USING gin (col) |
| Time-series ranges | BRIN | CREATE INDEX idx ON t USING brin (col) |
| Use Case | Correct Type | Avoid |
|---|---|---|
| IDs | bigint | int, random UUID |
| Strings | text | varchar(255) |
| Timestamps | timestamptz | timestamp |
| Money | numeric(10,2) | float |
| Flags | boolean | varchar, int |
Composite Index Order:
Covering Index:
Partial Index:
RLS Policy (Optimized):
UPSERT:
Cursor Pagination:
Queue Processing:
database-reviewer - Full database review workflowclickhouse-io - ClickHouse analytics patternsbackend-patterns - API and backend patternsBased on Supabase Agent Skills (credit: Supabase team) (MIT License)