postgres-pro

Analyze PostgreSQL slow queries and suggest indexing strategies.

9|2|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/stephanj/claude-code-collections --skill postgres-pro-stephanj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-pro
Source: https://github.com/stephanj/claude-code-collections/tree/main/skills/postgres-pro
Command: npx skills add https://github.com/stephanj/claude-code-collections --skill postgres-pro-stephanj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the complexity of maintaining high-performance PostgreSQL databases by providing expert-level guidance on query optimization, indexing strategies, and database maintenance.

Core Features & Use Cases

  • Performance Tuning: Analyze slow queries using EXPLAIN ANALYZE and implement appropriate indexing strategies like B-tree, GIN, or BRIN.
  • Advanced Features: Manage JSONB operations, set up streaming or logical replication, and configure extensions like PostGIS or pgvector.
  • Maintenance: Automate vacuuming, monitor database health via pg_stat views, and resolve table bloat issues.

Quick Start

Invoke the postgres-pro skill to analyze the performance of the slow query in the current file and suggest an optimal indexing strategy.

Frequently Asked Questions about postgres-pro

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

FAQPage Schema
How do I optimize slow PostgreSQL queries using EXPLAIN ANALYZE?

To optimize slow PostgreSQL queries, you must analyze the execution plan using EXPLAIN ANALYZE to identify bottlenecks like sequential scans. This skill examines query plans and recommends appropriate indexing strategies, such as B-tree, GIN, or BRIN indexes, to improve data retrieval latency.

What is the best way to manage JSONB operations and configure extensions in PostgreSQL?

Managing JSONB operations and configuring PostgreSQL extensions involves using specialized indexing like GIN for document data. This skill provides guidance on handling JSONB operations efficiently and configuring advanced extensions such as PostGIS or pgvector for geospatial or vector similarity searches.

How do I set up streaming or logical replication for high-availability PostgreSQL databases?

Setting up streaming or logical replication for PostgreSQL databases requires configuring replication slots and managing WAL files. This skill implements replication strategies to satisfy high-availability requirements and ensure low-latency data access across database instances.

Why does PostgreSQL table bloat happen and how do I automate vacuuming to resolve it?

PostgreSQL table bloat happens due to dead tuples left by updates and deletes, which you resolve by automating the vacuuming process. This skill monitors database health via pg_stat views and automates maintenance to resolve table bloat and manage storage efficiently.

When do I need GIN or BRIN indexes instead of standard B-tree indexes in PostgreSQL?

You need GIN or BRIN indexes instead of B-tree indexes when handling JSONB operations or large sorted physical datasets. This skill analyzes query patterns to design appropriate indexing strategies, applying GIN for composite values and BRIN for block-level range scans.