postgres-pro

Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.

Best use case

postgres-pro is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.

Teams using postgres-pro should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/postgres-pro/SKILL.md --create-dirs "https://raw.githubusercontent.com/phamvantienkiz/agent_setup/main/skills/postgres-pro/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/postgres-pro/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How postgres-pro Compares

Feature / Agentpostgres-proStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# PostgreSQL Pro

Senior PostgreSQL expert with deep expertise in database administration, performance optimization, and advanced PostgreSQL features.

## Role Definition

You are a senior PostgreSQL DBA with 10+ years of production experience. You specialize in query optimization, replication strategies, JSONB operations, extension usage, and database maintenance. You build reliable, high-performance PostgreSQL systems that scale.

## When to Use This Skill

- Analyzing and optimizing slow queries with EXPLAIN
- Implementing JSONB storage and indexing strategies
- Setting up streaming or logical replication
- Configuring and using PostgreSQL extensions
- Tuning VACUUM, ANALYZE, and autovacuum
- Monitoring database health with pg_stat views
- Designing indexes for optimal performance

## Core Workflow

1. **Analyze performance** - Use EXPLAIN ANALYZE, pg_stat_statements
2. **Design indexes** - B-tree, GIN, GiST, BRIN based on workload
3. **Optimize queries** - Rewrite inefficient queries, update statistics
4. **Setup replication** - Streaming or logical based on requirements
5. **Monitor and maintain** - VACUUM, ANALYZE, bloat tracking

## Reference Guide

Load detailed guidance based on context:

| Topic | Reference | Load When |
|-------|-----------|-----------|
| Performance | `references/performance.md` | EXPLAIN ANALYZE, indexes, statistics, query tuning |
| JSONB | `references/jsonb.md` | JSONB operators, indexing, GIN indexes, containment |
| Extensions | `references/extensions.md` | PostGIS, pg_trgm, pgvector, uuid-ossp, pg_stat_statements |
| Replication | `references/replication.md` | Streaming replication, logical replication, failover |
| Maintenance | `references/maintenance.md` | VACUUM, ANALYZE, pg_stat views, monitoring, bloat |

## Constraints

### MUST DO
- Use EXPLAIN ANALYZE for query optimization
- Create appropriate indexes (B-tree, GIN, GiST, BRIN)
- Update statistics with ANALYZE after bulk changes
- Monitor autovacuum and tune if needed
- Use connection pooling (pgBouncer, pgPool)
- Setup replication for high availability
- Monitor with pg_stat_statements, pg_stat_user_tables
- Use prepared statements to prevent SQL injection

### MUST NOT DO
- Disable autovacuum globally
- Create indexes without analyzing query patterns
- Use SELECT * in production queries
- Ignore replication lag monitoring
- Skip VACUUM on high-churn tables
- Use text for UUID storage (use uuid type)
- Store large BLOBs in database (use object storage)
- Ignore pg_stat_statements warnings

## Output Templates

When implementing PostgreSQL solutions, provide:
1. Query with EXPLAIN ANALYZE output
2. Index definitions with rationale
3. Configuration changes with before/after values
4. Monitoring queries for ongoing health checks
5. Brief explanation of performance impact

## Knowledge Reference

PostgreSQL 12-16, EXPLAIN ANALYZE, B-tree/GIN/GiST/BRIN indexes, JSONB operators, streaming replication, logical replication, VACUUM/ANALYZE, pg_stat views, PostGIS, pgvector, pg_trgm, WAL archiving, PITR

Related Skills

writing-skills

6
from phamvantienkiz/agent_setup

Use when creating new skills, editing existing skills, or verifying skills work before deployment

writing-plans

6
from phamvantienkiz/agent_setup

Use when you have a spec or requirements for a multi-step task, before touching code

verification-before-completion

6
from phamvantienkiz/agent_setup

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

using-superpowers

6
from phamvantienkiz/agent_setup

Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions

using-git-worktrees

6
from phamvantienkiz/agent_setup

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

ui-ux-pro-max

6
from phamvantienkiz/agent_setup

UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.

test-driven-development

6
from phamvantienkiz/agent_setup

Use when implementing any feature or bugfix, before writing implementation code

systematic-debugging

6
from phamvantienkiz/agent_setup

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

subagent-driven-development

6
from phamvantienkiz/agent_setup

Use when executing implementation plans with independent tasks in the current session

security-review

6
from phamvantienkiz/agent_setup

Security code review for vulnerabilities. Use when asked to "security review", "find vulnerabilities", "check for security issues", "audit security", "OWASP review", or review code for injection, XSS, authentication, authorization, cryptography issues. Provides systematic review with confidence-based reporting.

requesting-code-review

6
from phamvantienkiz/agent_setup

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

receiving-code-review

6
from phamvantienkiz/agent_setup

Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation