postgres-patterns

Optimize PostgreSQL queries and schema with indexing and anti-pattern detection.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/Oruga420/claude-code-skills --skill postgres-patterns-oruga420
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/Oruga420/claude-code-skills/tree/main/postgres-patterns
Command: npx skills add https://github.com/Oruga420/claude-code-skills --skill postgres-patterns-oruga420

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

A concise reference to reduce slow queries, schema inefficiencies, and security misconfigurations in PostgreSQL by providing proven indexing strategies, schema recommendations, and diagnostic queries based on Supabase best practices.

Core Features & Use Cases

  • Indexing guidance for equality, range, composite, GIN, and BRIN use cases to improve query latency.
  • Schema and data-type recommendations to choose appropriate column types and avoid common anti-patterns.
  • Anti-pattern detection queries to locate missing indexes, slow statements, and table bloat.
  • Security and RLS examples showing safe policy patterns for tenant isolation and minimal privilege defaults.
  • Configuration templates and operational tips for connection limits, timeouts, and monitoring extensions.
  • Use Case: Tune an OLTP database for low-latency lookups and design migrations for large tables without causing long locks.

Quick Start

Use the postgres-patterns skill to audit a slow query, recommend an index or schema change, and return the minimal SQL changes needed.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I optimize slow PostgreSQL queries and reduce latency?

PostgreSQL query optimization requires identifying missing indexes and schema inefficiencies. This skill provides diagnostic queries to detect slow statements and recommends specific indexing strategies like GIN or BRIN to improve query latency.

What is the best way to design a Postgres schema for large tables without causing long locks?

Designing Postgres schemas for large tables without long locks requires appropriate data-type choices and migration strategies. This skill provides schema recommendations and operational tips to execute migrations while avoiding long table locks.

How do I set up Row Level Security in Supabase for tenant isolation?

Setting up Row Level Security for tenant isolation in Supabase requires safe policy patterns and minimal privilege defaults. This skill provides RLS policy examples to ensure secure multi-tenant data access and prevent security misconfigurations.

How can I detect missing indexes and table bloat in my PostgreSQL database?

Detecting missing indexes and table bloat in PostgreSQL requires running specific anti-pattern detection queries. This skill supplies diagnostic queries to locate slow statements, identify missing indexes, and find table bloat.

Can I use this skill for connection pooling and configuration tuning on Supabase?

Yes, this skill supports connection pooling and configuration tuning for Supabase and PostgreSQL deployments. It provides configuration templates for connection limits, timeouts, and monitoring extensions to satisfy performance requirements.