postgres-patterns

Review PostgreSQL migrations and optimize query performance with SQL patterns.

Updated Dec 22, 2025
One-click install
npx skills add https://github.com/CJHarmath/claude-agents-skills --skill postgres-patterns-cjharmath
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/CJHarmath/claude-agents-skills/tree/main/skills/postgres-patterns
Command: npx skills add https://github.com/CJHarmath/claude-agents-skills --skill postgres-patterns-cjharmath

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL migrations and query workloads often suffer from performance pitfalls that are hard to spot without a structured pattern library. This skill provides practical patterns to review Alembic migrations, design efficient indexes, and analyze query performance to ensure scalable databases.

Core Features & Use Cases

  • Index design patterns: create efficient indexes, including partial indexes and JSONB indexes, aligned to common query shapes.
  • Migration review templates: safe naming, named constraints, and upgrade strategies to minimize downtime.
  • Query performance templates: explain plan guidance and concrete tuning steps for typical application workloads.
  • Use case: When optimizing a slow migration and a frequently filtered query, apply these patterns to reduce runtime and improve read throughput.

Quick Start

Get started by applying the index review pattern to your next migration and running an EXPLAIN ANALYZE on a slow query to identify bottlenecks.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I review Alembic migrations to minimize PostgreSQL downtime?

Review Alembic migrations using safe naming and named constraints to minimize PostgreSQL downtime. These migration-review patterns provide concrete upgrade strategies that ensure scalable database deployments across typical application workloads.

What is the best way to design partial and JSONB indexes for PostgreSQL?

Design partial and JSONB indexes by aligning index structures to common query shapes. This approach provides concrete, ready-to-apply SQL patterns that improve read throughput and ensure efficient filtering for typical PostgreSQL workloads.

How do I analyze PostgreSQL query plans to tune performance?

Analyze PostgreSQL query plans using EXPLAIN ANALYZE guidance to identify bottlenecks. The skill provides concrete query performance templates and tuning steps to reduce runtime and improve read throughput for slow queries.

Can I apply these SQL patterns to optimize existing PostgreSQL workloads?

Yes, you can apply these SQL patterns to optimize existing PostgreSQL workloads. The patterns provide index design and query optimization steps that reduce runtime and improve read throughput for typical application database operations.

When should I use partial indexes instead of standard indexes in PostgreSQL?

Use partial indexes instead of standard indexes when optimizing frequently filtered PostgreSQL queries. These index design patterns target specific query shapes, reducing storage overhead and improving read throughput for typical application workloads.