postgres-patterns

Generate optimized PostgreSQL indexing and schema recommendations for database performance issues.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/JGcode3675/gcs-os --skill postgres-patterns-jgcode3675
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/JGcode3675/gcs-os/tree/main/home/james/claude-config/skills/postgres-patterns
Command: npx skills add https://github.com/JGcode3675/gcs-os --skill postgres-patterns-jgcode3675

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers and database administrators often struggle with inefficient queries, poorly designed schemas, and inadequate security settings, leading to slow performance and higher operational risk.

Core Features & Use Cases

  • Index Guidance: Provides cheat sheets and examples for B‑tree, GIN, BRIN, composite, covering, and partial indexes.
  • Data‑Type Recommendations: Suggests optimal PostgreSQL column types for common use cases.
  • Security Patterns: Offers ready‑to‑use Row Level Security policies and configuration templates.
  • Anti‑Pattern Detection: Supplies SQL queries to find unindexed foreign keys, slow queries, and table bloat.
  • Configuration Templates: Includes system settings for connections, timeouts, monitoring, and security defaults. Use cases include writing migrations, designing new tables, troubleshooting slow queries, and setting up secure multi‑tenant databases.

Quick Start

Ask the skill to suggest the optimal index for a query that filters by status and creation date.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
What is the best way to choose PostgreSQL indexes for slow queries?

PostgreSQL index selection depends on matching index types like B-tree, GIN, BRIN, composite, or partial indexes to specific query filters. This skill provides optimized index recommendations by analyzing query patterns and schema designs to resolve slow database performance.

How do I design row level security policies for multi-tenant PostgreSQL databases?

Designing row level security policies for multi-tenant PostgreSQL databases requires applying tenant isolation rules to tables. This skill supplies ready-to-use row level security policy templates and configuration settings for secure multi-tenant database setups.

When should I use BRIN or GIN indexes instead of B-tree in PostgreSQL?

Use BRIN or GIN indexes instead of B-tree when handling large datasets with natural ordering or full-text search requirements. This skill offers guidance and cheat sheets for applying BRIN, GIN, composite, and covering indexes to specific PostgreSQL use cases.

How to find unindexed foreign keys and table bloat in PostgreSQL?

Finding unindexed foreign keys and table bloat in PostgreSQL requires running specific diagnostic SQL queries against the database. This skill supplies anti-pattern detection queries to identify unindexed foreign keys, slow queries, and table bloat affecting database performance.

Does this PostgreSQL optimization skill require external database tooling?

This PostgreSQL optimization skill does not require external tooling to generate indexing and schema recommendations. It satisfies requirements for B-tree, GIN, BRIN, partial indexes, and row-level security policies directly without external dependencies.

What are the limitations of using partial indexes for PostgreSQL query optimization?

Partial indexes limit query optimization to queries that match the index's specific conditional predicate. This skill provides best-practice patterns for applying partial, covering, and composite indexes correctly to avoid mismatched query filters and suboptimal performance.