postgres-patterns

Provide PostgreSQL best practices for query optimization, schema design, and security.

26|1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/BinyaminEden/claude-combine --skill postgres-patterns-binyamineden
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/BinyaminEden/claude-combine/tree/main/skills/postgres-patterns
Command: npx skills add https://github.com/BinyaminEden/claude-combine --skill postgres-patterns-binyamineden

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers and database administrators frequently face slow query performance, inefficient schema designs, insecure database configurations, and a lack of trusted, standardized guidance for common PostgreSQL implementation tasks.

Core Features & Use Cases

  • Query Optimization & Indexing: Provides cheat sheets for selecting optimal index types (B-tree, GIN, BRIN), composite indexes, covering indexes, and partial indexes to boost query speed.
  • Schema & Data Type Best Practices: Guides correct data type selection (e.g., timestamptz over timestamp, bigint for IDs) to avoid performance and data integrity pitfalls.
  • Security & Performance Tuning: Includes optimized Row Level Security policy templates, connection pooling configuration examples, and anti-pattern detection queries to identify unindexed foreign keys, slow queries, and table bloat.
  • Use Case: If you are building a multi-tenant SaaS application, use this skill to design a secure, optimized users table schema with proper indexes and RLS policies to isolate tenant data and speed up common user lookup queries.

Quick Start

Use the postgres-patterns skill to create an optimized orders table schema with a composite index for status and created_at queries, plus an RLS policy that restricts each user to only access their own orders.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I optimize slow PostgreSQL query performance with better indexing?

Optimize slow PostgreSQL query performance by selecting the correct index types, such as B-tree, GIN, or BRIN, and utilizing composite, covering, or partial indexes to target specific query patterns and accelerate data retrieval.

What are the best PostgreSQL data types to use for schema design?

The best PostgreSQL schema design practices recommend using specific data types like timestamptz over timestamp for accurate timekeeping, and bigint for IDs, preventing common data integrity and performance pitfalls.

How do I implement Row Level Security in PostgreSQL for a multi-tenant SaaS application?

Implement Row Level Security in PostgreSQL for multi-tenant SaaS by applying standardized RLS policy templates that isolate tenant data, ensuring users only access their own records and maintaining strict database security.

How can I detect PostgreSQL anti-patterns like unindexed foreign keys and table bloat?

Detect PostgreSQL anti-patterns like unindexed foreign keys and table bloat by running specialized anti-pattern detection queries that identify inefficient schema designs and slow queries requiring troubleshooting.

Does this PostgreSQL best practices guidance align with Supabase configuration guidelines?

Yes, this PostgreSQL best practices guidance provides production-ready configuration templates and schema design rules that are explicitly aligned with Supabase guidelines for optimal database performance and security.

What is the best way to configure PostgreSQL connection pooling for production?

The best way to configure PostgreSQL connection pooling for production involves applying optimized configuration examples and templates that manage database connections efficiently and prevent connection exhaustion under load.