postgres

Detect Postgres 16/17/18 anti-patterns in PR diffs for concurrency and indexing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid production-grade Postgres anti-patterns that cause deadlocks, lock escalation, vacuum bloat, or ineffective indexes.

Core Features & Use Cases

  • Transaction and locking safeguards: Flags unsafe FOR UPDATE usage, inconsistent lock ordering, and long-lived transactions caused by external I/O inside transactions.
  • MVCC and isolation tuning: Detects missing retry logic for SERIALIZABLE and highlights retry/behavior concerns around isolation failures.
  • Indexing and query plan correctness: Calls out JSONB indexing mismatches (-> vs ->>), partial index predicate mismatches, and CTE materialization assumptions.
  • Postgres 17/18 feature pitfalls: Reviews MERGE concurrency caveats, virtual generated column indexing issues, and logical replication REPLICA IDENTITY defaults.
  • pgBouncer compatibility: Ensures session-state constructs are not used in transaction pooling mode by requiring safe transaction-scoped alternatives.

Quick Start

Ask an AI to review your PR diff for Postgres-related concurrency, transaction, and indexing anti-patterns and return only evidence-backed fixes.

Frequently Asked Questions about postgres

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

FAQPage Schema
How do I prevent Postgres deadlocks in database migrations?

Prevent Postgres deadlocks by reviewing PR diffs for inconsistent lock ordering and unsafe FOR UPDATE usage. Targeted detection flags long-lived transactions and lock contention to ensure safe concurrency in application code paths.

Why does my JSONB indexing mismatch cause ineffective query plans?

JSONB indexing mismatches occur when using the wrong operator, such as -> instead of ->>. Detecting these mismatches in SQL changes ensures query plans correctly leverage JSONB indexes for efficient data retrieval.

Does pgBouncer transaction pooling work with session-state constructs?

pgBouncer transaction pooling does not work safely with session-state constructs. Reviews enforce safe transaction-scoped alternatives, ensuring your SQL changes avoid session-state dependencies that break pgBouncer compatibility.

What are the MERGE concurrency caveats in Postgres 17?

MERGE concurrency caveats in Postgres 17 involve potential race conditions during concurrent execution. Reviewing MERGE statements in PR diffs detects unsafe concurrency patterns and provides guidance for safe transaction handling.

How do I handle SERIALIZABLE transaction isolation retry logic?

Handling SERIALIZABLE transaction isolation requires retry logic for isolation failures. Reviews detect missing retry mechanisms around SERIALIZABLE transactions to prevent data loss during concurrency conflicts.

When do I need to review logical replication REPLICA IDENTITY defaults?

Review logical replication REPLICA IDENTITY defaults when modifying tables involved in replication. Detection highlights unsafe defaults in Postgres 17/18 feature usage to prevent replication gaps during database migrations.