Manage Apple Reminders via the `remindctl` CLI on macOS (list, add, edit, complete, delete)....
npx skills add 404kidwiz/claude-supercode-skills --skill "postgres-pro"
Install specific skill from multi-skill repository
# Description
Use when user needs PostgreSQL database administration, performance optimization, high availability setup, backup/recovery, or advanced PostgreSQL feature implementation.
# SKILL.md
name: postgres-pro
description: Use when user needs PostgreSQL database administration, performance optimization, high availability setup, backup/recovery, or advanced PostgreSQL feature implementation.
PostgreSQL Professional
Purpose
Provides comprehensive PostgreSQL expertise specializing in database administration, performance optimization, and advanced feature implementation. Excels at achieving maximum reliability, performance, and scalability for PostgreSQL deployments with high availability and advanced extensions.
When to Use
- PostgreSQL-specific features needed (JSONB, full-text search, PostGIS, pgvector)
- Setting up streaming or logical replication
- Implementing PostgreSQL extensions
- Troubleshooting PostgreSQL-specific issues
- Optimizing PostgreSQL configuration
- Implementing partitioning and high availability
Quick Start
Invoke this skill when:
- PostgreSQL-specific features needed (JSONB indexing, full-text search, PostGIS, pgvector)
- Setting up streaming replication or logical replication for PostgreSQL
- Implementing PostgreSQL extensions (pg_trgm, PostGIS, timescaledb, pg_partman)
- Troubleshooting PostgreSQL-specific issues (autovacuum, bloat, WAL archiving)
- Optimizing PostgreSQL configuration (shared_buffers, work_mem, vacuum settings)
- Implementing PostgreSQL partitioning (declarative partitioning, constraint exclusion)
- Setting up PostgreSQL high availability (Patroni, repmgr, pgpool-II)
- Designing JSONB schema and query optimization with GIN indexes
Do NOT invoke when:
- General SQL query writing (use sql-pro for ANSI SQL queries)
- Cross-platform database optimization (use database-optimizer for general tuning)
- MySQL or SQL Server specific features (use platform-specific skills)
- Database administration basics (users, permissions - use database-administrator)
- Simple query optimization without PostgreSQL-specific features
- ORM query patterns (use backend-developer with ORM expertise)
Core Capabilities
PostgreSQL Architecture
- Process architecture and memory configuration
- WAL mechanics and MVCC implementation
- Storage layout and buffer management
- Lock management and background workers
Advanced Features
- JSONB optimization with GIN indexes
- Full-text search with tsvector and GIN indexes
- PostGIS spatial queries and indexing
- Time-series data handling and partitioning
- Foreign data wrappers and cross-database queries
- Parallel queries and JIT compilation
Performance Tuning
- Configuration optimization (memory, connections, checkpoints)
- Query optimization and execution plan analysis
- Index strategies and index usage monitoring
- Vacuum tuning and autovacuum configuration
- Connection pooling and parallel execution
Replication Strategies
- Streaming replication and logical replication
- Synchronous setup and cascading replicas
- Delayed replicas and failover automation
- Load balancing and conflict resolution
Backup and Recovery
- pg_dump strategies and physical backups
- WAL archiving and PITR setup
- Backup validation and recovery testing
- Automation scripts and retention policies
Decision Framework
JSONB Index Strategy
JSONB Query Pattern Analysis
β
ββ Containment queries (@> operator)?
β ββ Use GIN with jsonb_path_ops
β CREATE INDEX idx ON table USING GIN (column jsonb_path_ops);
β β’ 2-3x smaller than default GIN
β β’ Faster for @> containment checks
β β’ Does NOT support key existence (?)
β
ββ Key existence queries (? or ?| or ?& operators)?
β ββ Use default GIN operator class
β CREATE INDEX idx ON table USING GIN (column);
β β’ Supports all JSONB operators
β β’ Larger index size
β
ββ Specific path frequently queried?
β ββ Use expression index
β CREATE INDEX idx ON table ((column->>'key'));
β β’ Most efficient for specific path
β β’ B-tree allows range queries
β
ββ Full document search needed?
ββ Combine GIN + expression indexes
β’ GIN for flexible queries
β’ Expression for hot paths
Replication Strategy Selection
| Requirement | Strategy | Configuration |
|---|---|---|
| Read scaling | Streaming (async) | Multiple read replicas |
| Zero data loss | Streaming (sync) | synchronous_commit = on |
| Table-level replication | Logical | CREATE PUBLICATION/SUBSCRIPTION |
| Cross-version upgrade | Logical | Replicate to new version |
| Disaster recovery | Streaming + WAL archive | PITR capability |
| Delayed recovery | Delayed replica | recovery_min_apply_delay |
Quality Checklist
Performance:
- [ ] Query performance targets met (OLTP <50ms, Analytics <2s)
- [ ] EXPLAIN ANALYZE reviewed for all critical queries
- [ ] GIN/GiST indexes used for JSONB, array, full-text queries
- [ ] Partitioning implemented for tables >10GB with time-series data
- [ ] Cache hit ratio >95% (shared_buffers + OS cache)
- [ ] Connection pooling implemented (PgBouncer or application pool)
Configuration:
- [ ] shared_buffers = 25% of RAM
- [ ] effective_cache_size = 75% of RAM
- [ ] work_mem tuned for workload (no temp file spills in EXPLAIN)
- [ ] Autovacuum configured (scale_factor β€0.05 for large tables)
- [ ] max_connections appropriate (or using PgBouncer)
- [ ] WAL archiving enabled for PITR
Replication (if applicable):
- [ ] Replication slots created (prevents WAL deletion)
- [ ] Replication lag <500ms (P95)
- [ ] pg_stat_replication monitored (sync_state, replay_lag)
- [ ] Failover tested (promote replica to primary)
- [ ] pg_hba.conf configured for replication access
Extensions:
- [ ] Required extensions installed (pg_trgm, PostGIS, pgvector, etc.)
- [ ] Extension versions compatible with PostgreSQL version
- [ ] GIN indexes created for JSONB, tsvector, trigrams
- [ ] Full-text search configured with proper language dictionaries
JSONB (if used):
- [ ] GIN indexes created (jsonb_path_ops for containment queries)
- [ ] Expression indexes for frequently queried paths
- [ ] JSONB validation in application (jsonschema or custom)
- [ ] No deeply nested JSONB (>3 levels β consider normalization)
Monitoring:
- [ ] Slow query log configured (log_min_duration_statement = 200ms)
- [ ] pg_stat_statements installed and monitored
- [ ] Autovacuum progress monitored (pg_stat_progress_vacuum)
- [ ] Table bloat monitored (<15% dead tuples)
- [ ] Replication lag alerts configured (<1s threshold)
Additional Resources
- Detailed Technical Reference: See REFERENCE.md
- Code Examples & Patterns: See EXAMPLES.md
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.