postgres-patterns

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

27|4|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/skateddu/claude-code-python-setup --skill postgres-patterns-skateddu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/skateddu/claude-code-python-setup/tree/main/.claude/skills/postgres-patterns
Command: npx skills add https://github.com/skateddu/claude-code-python-setup --skill postgres-patterns-skateddu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.

Core Features & Use Cases

  • Indexing patterns: guidance on when to use B-tree, BRIN, GIN, and partial indices to speed up queries.
  • Schema design: recommended data type choices, normalization strategies, and table structuring to balance performance and maintainability.
  • Security & RLS: patterns for access control and row-level security configurations.
  • Use Case: When designing a new multi-tenant app, apply these patterns to optimize queries and isolate data securely.

Quick Start

Start by auditing your current PostgreSQL schemas and queries, then apply the patterns to a representative workload to measure improvements.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
What are the best PostgreSQL indexing patterns for query optimization?

PostgreSQL indexing patterns guide when to use B-tree, BRIN, GIN, and partial indices to speed up queries. Selecting the correct index type based on data distribution and query structure significantly reduces execution time and improves overall database performance.

How do I configure row-level security (RLS) for a multi-tenant PostgreSQL database?

Row-level security (RLS) patterns provide configurations for access control and data isolation. Applying these patterns during schema design ensures secure data separation in multi-tenant applications by enforcing tenant-specific access policies directly at the database layer.

What data types should I choose for PostgreSQL schema design?

PostgreSQL schema design patterns recommend specific data type choices and normalization strategies to balance performance and maintainability. Choosing appropriate data types minimizes storage overhead and prevents type-conversion bottlenecks during complex queries.

When should I use partial or composite indexes in PostgreSQL?

Use partial or composite indexes in PostgreSQL when queries frequently filter on specific column subsets or require non-null constraints. These indexing patterns speed up targeted queries by indexing only the relevant rows, reducing index size and maintenance overhead.

Can I apply Supabase best practices to an existing PostgreSQL project?

You can apply Supabase best practices to an existing PostgreSQL project by auditing current schemas and queries. Implementing these configuration defaults and patterns on a representative workload allows you to measure improvements and align with best practices.