postgres-patterns

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

Updated May 9, 2026
One-click install
npx skills add https://github.com/kk20300113-png/my-claude-skills --skill postgres-patterns-kk20300113-png
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/kk20300113-png/my-claude-skills/tree/main/postgres-patterns
Command: npx skills add https://github.com/kk20300113-png/my-claude-skills --skill postgres-patterns-kk20300113-png

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the common pain points of slow PostgreSQL query performance, poorly optimized database schemas, missing critical indexes, and misconfigured security settings that lead to application downtime, data bloat, and unauthorized data access.

Core Features & Use Cases

  • Query & Index Optimization: Provides cheat sheets for selecting the correct index type for common query patterns, plus guidance on composite index ordering, covering indexes, and partial indexes to eliminate slow queries and reduce unnecessary table lookups.
  • Schema & Data Type Best Practices: Outlines correct data type selections for IDs, timestamps, monetary values, and boolean flags to avoid common schema design mistakes that waste storage and degrade query performance.
  • Security & Operational Patterns: Includes optimized Row Level Security policy templates, connection pool configuration defaults, queue processing patterns, and anti-pattern detection queries to identify unindexed foreign keys, slow queries, and table bloat. Use Case: For example, if you are building a multi-tenant e-commerce application, use this Skill to design efficient product and order table schemas, set up RLS policies to isolate tenant data, and create indexes that keep product search query latency under 100ms even as your catalog grows to millions of items.

Quick Start

Use the postgres-patterns skill to review your existing PostgreSQL database schema and active query logs to identify missing indexes, inefficient data types, and unoptimized RLS policies that are hurting performance and security.

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 queries and identify missing indexes?

You can optimize slow PostgreSQL queries by applying reference patterns for index selection, composite index ordering, covering indexes, and partial indexes. Additionally, anti-pattern detection queries help identify unindexed foreign keys and table bloat.

What are the best PostgreSQL data types for schema design to avoid performance issues?

For efficient schema design, use correct PostgreSQL data types for IDs, timestamps, monetary values, and boolean flags. Following these data type best practices prevents storage waste and degradation of query performance.

How do I implement Row Level Security policies for multi-tenant applications in PostgreSQL?

To implement Row Level Security for multi-tenant applications, apply optimized RLS policy templates provided by the skill. These patterns isolate tenant data securely and prevent unauthorized data access in your PostgreSQL database.

Can I use PostgreSQL patterns for cursor pagination and queue processing?

Yes, PostgreSQL patterns support cursor pagination and queue processing. These reference patterns provide efficient data retrieval and background job handling mechanisms for application development and operations teams.

Why does my PostgreSQL database have table bloat and unindexed foreign keys?

Your PostgreSQL database may have table bloat and unindexed foreign keys due to poor schema design and missing indexes. You can identify these operational issues using anti-pattern detection queries to troubleshoot slow query performance.