postgres-patterns

Provide PostgreSQL patterns for query optimization, schema design, indexing, and security.

70|42|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/tranhieutt/software_development_department --skill postgres-patterns-tranhieutt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/tranhieutt/software_development_department/tree/main/.claude/skills/postgres-patterns
Command: npx skills add https://github.com/tranhieutt/software_development_department --skill postgres-patterns-tranhieutt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL workloads often suffer from slow queries, bloated indexes, and insecure policies without a concise reference for schema design, indexing strategies, and configuration defaults.

Core Features & Use Cases

  • Index Cheat Sheet: Helps select the right B-tree, GIN, BRIN, or composite index for equality, range, JSONB, and full-text queries.
  • Common Patterns & Anti-Patterns: Covers covering indexes, partial indexes, UPSERT idioms, RLS policies, and anti-pattern checks for unindexed foreign keys, slow queries, and table bloat.
  • Configuration Templates: Recommends connection limits, memory settings, timeouts, monitoring extensions, and security hardening steps tailored to Supabase-style deployments.

Quick Start

Ask postgres-patterns to review your SQL query, schema, or migration so indexes, policies, and configuration follow Supabase best practices.

Frequently Asked Questions about postgres-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right PostgreSQL index for query optimization?

PostgreSQL query optimization requires deterministic index selection, matching B-tree, GIN, or BRIN indexes to equality, range, and JSONB query patterns. Using covering and partial indexes prevents slow queries and reduces table bloat.

What are common PostgreSQL schema design anti-patterns to avoid?

Common PostgreSQL schema design anti-patterns include unindexed foreign keys, bloated tables, and inefficient UPSERT idioms. Detecting these anti-patterns early ensures reliable policy enforcement and prevents performance degradation.

How do I configure Row Level Security policies in a Supabase database?

Configuring Row Level Security policies in a Supabase database involves enforcing deterministic RLS rules during schema design. This approach safely isolates tenant data and enforces access control directly at the database layer.

What are the recommended PostgreSQL connection limits and memory settings for Supabase?

Recommended PostgreSQL configuration templates for Supabase-style deployments include specific connection limits, memory settings, and timeouts. Applying these configurations alongside monitoring extensions ensures stable database performance under load.

When should I use a BRIN index instead of a B-tree index in PostgreSQL?

Use a BRIN index instead of a B-tree index in PostgreSQL for large tables with naturally ordered data, such as time-series workloads. B-tree indexes remain preferable for exact equality lookups and complex range queries.