postgres-patterns

Provide PostgreSQL optimization patterns for indexing, schema design, and security.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Rx-K8/my-claude-code --skill postgres-patterns-rx-k8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/Rx-K8/my-claude-code/tree/main/japanese/skills/postgres-patterns
Command: npx skills add https://github.com/Rx-K8/my-claude-code --skill postgres-patterns-rx-k8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides best practices and quick reference guides for optimizing PostgreSQL databases, ensuring efficient query performance, robust schema design, and secure data handling.

Core Features & Use Cases

  • Query Optimization: Guidance on indexing strategies (B-tree, GIN, BRIN) and composite/covering/partial indexes.
  • Schema Design: Recommendations for appropriate data types and common patterns like UPSERT and cursor pagination.
  • Security: Best practices for Row Level Security (RLS) policies.
  • Troubleshooting: Anti-pattern detection for unindexed foreign keys, slow queries, and table bloat.
  • Configuration: Template snippets for essential PostgreSQL settings.

Quick Start

Use the postgres-patterns skill to find the correct index type for a query filtering on a JSONB column.

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 using the right indexing strategy?

You can optimize PostgreSQL queries by applying indexing strategies like B-tree for standard lookups, GIN for JSONB or array columns, and BRIN for large sorted tables. This approach also covers composite, covering, and partial indexes to ensure efficient query performance.

What is the best way to implement cursor pagination and UPSERT in PostgreSQL schema design?

The best way to implement cursor pagination and UPSERT in PostgreSQL schema design is by using recommended common SQL patterns and selecting appropriate data types. These patterns ensure robust schema design and efficient data handling for large datasets.

How do I configure Row Level Security (RLS) policies for secure PostgreSQL data handling?

To configure Row Level Security (RLS) policies for secure PostgreSQL data handling, apply best practices that restrict data access at the row level. This ensures robust security configurations directly within your database schema management.

Why does my PostgreSQL database have table bloat and unindexed foreign keys?

PostgreSQL database table bloat and unindexed foreign keys occur due to common anti-patterns in schema design. You can troubleshoot these issues by detecting unindexed foreign keys, identifying slow queries, and resolving table bloat through proper optimization patterns.

Does this database optimization approach work with Supabase best practices?

Yes, this database optimization approach works with Supabase best practices, providing PostgreSQL design and optimization patterns specifically based on Supabase standards. It covers query optimization, schema design, indexing, security, and troubleshooting for efficient database management.