Agent skill · data analytics · affaan-m

postgres-patterns

PostgreSQL database patterns for query optimization, schema design, indexing, and security. Quick reference for common patterns, index types, data types, and anti-pattern detection. Based on Supabase best practices.

Why this skill is useful

Provides specific PostgreSQL query optimization patterns, indexing strategies, and anti-pattern detection that the AI wouldn't reliably generate on its own.

What it needs

About 3k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.

What this skill does

PostgreSQL Patterns Quick reference for PostgreSQL best practices. For detailed guidance, use the database-reviewer agent. When to Activate Writing SQL queries or migrations Designing database schemas Troubleshooting slow queries Implementing Row Level Security Setting up connection pooling Quick Reference Index Cheat Sheet 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) Data Type Quick Reference 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 Common Patterns Composite Index Order: Covering Index: Partial Index: RLS Policy (Optimized): UPSERT: Cursor Pagination: Queue Processing: Anti-Pattern Detection Configuration Template Related Agent: database-reviewer - Full database review workflow Skill: backend-patterns - API and backend patterns Skill: database-migrations - Safe schema changes When to Use This Skill Writing SQL queries Designing database schemas Optimizing query performance Implementing Row Level Security Troubleshooting database issues Setting up PostgreSQL configuration --- Based on Supabase Agent Skills (credit: Supabase team) (MIT License)

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/postgres-patterns

View the source on GitHub

Browse the @skills marketplace