postgres

Diagnose and optimize PostgreSQL databases with SQL audit queries and configuration recommendations.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps engineers and DBAs diagnose, optimize, and troubleshoot PostgreSQL databases to improve query performance, reduce resource contention, and ensure reliable backups and replication behavior, with PlanetScale-specific guidance when applicable.

Core Features & Use Cases

  • Schema & Index Guidance: Recommendations for primary keys, data types, composite and partial indexes, and index audit queries to find unused, duplicate, or bloat-prone indexes.
  • Query & Planner Optimization: Advice on query rewrites, EXPLAIN analysis, planner tuning (random_page_cost, effective_cache_size), and pagination best practices to reduce latency and IO.
  • Operations & Reliability: Procedures for MVCC/VACUUM tuning, WAL/checkoutpoint configuration, PITR/backups, replication slot management, checkpoint tuning, and memory/connection pooling strategies including PgBouncer sizing and PlanetScale CLI insights.
  • Monitoring & Runbooks: Key monitoring queries (pg_stat views, pg_stat_statements), host metric checks, and actionable checks for long transactions, XID wraparound, and autovacuum health.
  • Use Case Example: Diagnose a high-write table that is causing WAL bloat and slow checkpoints, then produce index, autovacuum, and WAL/archive recommendations and an actionable rollback plan.

Quick Start

Ask the postgres skill to analyze a specific slow SQL query and return index, configuration, and monitoring recommendations for the target database.

Frequently Asked Questions about postgres

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

FAQPage Schema
How do I optimize slow PostgreSQL queries and analyze the execution plan?

To optimize slow PostgreSQL queries, this skill provides query rewrite advice, EXPLAIN analysis, and planner tuning recommendations like adjusting random_page_cost and effective_cache_size to reduce latency and IO.

How do I fix WAL bloat and tune PostgreSQL checkpoints for high-write tables?

Fix WAL bloat and slow PostgreSQL checkpoints using this skill's procedures for WAL and checkpoint configuration, autovacuum tuning, and actionable rollback plans to manage high-write database operations reliably.

What are the best PostgreSQL monitoring queries to check autovacuum health and transaction ID wraparound?

PostgreSQL monitoring queries for autovacuum health and XID wraparound include checking pg_stat views and pg_stat_statements, which this skill provides alongside host metric checks to identify long transactions.

Does this skill provide PlanetScale-specific guidance for PgBouncer connection pooling?

Yes, it provides PlanetScale-specific guidance for connection pooling scenarios, including PgBouncer sizing strategies and PlanetScale CLI insights to ensure PostgreSQL connection stability.

How do I audit PostgreSQL indexes to find unused, duplicate, or bloat-prone entries?

Audit PostgreSQL indexes using this skill's SQL audit queries to identify unused, duplicate, or bloat-prone indexes, and receive recommendations for composite, partial, and primary key index configurations.

What is the procedure for PostgreSQL point-in-time recovery and managing replication slots?

PostgreSQL point-in-time recovery and replication slot management procedures are provided by this skill, detailing backup configurations, PITR steps, and replication behavior to ensure database reliability.