postgres-patterns

Provide PostgreSQL optimization, schema design, and security best practices.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/deneb-cygnus-dev/dot-agent --skill postgres-patterns-deneb-cygnus-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/deneb-cygnus-dev/dot-agent/tree/main/skills/postgres-patterns
Command: npx skills add https://github.com/deneb-cygnus-dev/dot-agent --skill postgres-patterns-deneb-cygnus-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common performance bottlenecks and design flaws in PostgreSQL databases, ensuring efficient query execution and robust schema structures.

Core Features & Use Cases

  • Query Optimization: Provides guidance on indexing strategies (B-tree, GIN, BRIN) and composite index ordering.
  • Schema Design: Recommends appropriate data types and patterns for IDs, strings, timestamps, and monetary values.
  • Security: Offers patterns for Row Level Security (RLS) policies.
  • Use Case: Improve the speed of your application's data retrieval by implementing the correct indexes for your most frequent WHERE clauses and JOIN conditions.

Quick Start

Use the postgres-patterns skill to create a composite index on the 'status' and 'created_at' columns of the 'orders' table.

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 with the right indexing strategies?

Optimize PostgreSQL queries by selecting appropriate B-tree, GIN, or BRIN indexes for your WHERE clauses. Implementing correct composite index ordering significantly accelerates data retrieval and resolves slow query bottlenecks.

What are the best PostgreSQL data types for schema design involving IDs and monetary values?

Proper PostgreSQL schema design recommends specific data types for IDs, strings, timestamps, and monetary values. Selecting appropriate types ensures robust data structures, accurate financial calculations, and prevents common design flaws.

How do I set up Row Level Security (RLS) policies in PostgreSQL?

Configure PostgreSQL Row Level Security (RLS) by applying established policy patterns. RLS policies restrict data access at the row level, ensuring robust database security without requiring complex application-level filtering logic.

Why are my PostgreSQL queries slow even with indexes, and how do I detect table bloat?

Slow PostgreSQL queries with indexes often stem from unindexed foreign keys, poor composite ordering, or table bloat. Detecting these anti-patterns early eliminates performance bottlenecks and restores query execution efficiency.

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

Implement cursor pagination and UPSERT operations in PostgreSQL by following dedicated processing patterns. These patterns ensure efficient, safe data modification and stable large dataset retrieval.