postgresql-skill

ingpoc's avatarfrom ingpoc

This skill provides PostgreSQL-specific patterns for database design, optimization, and transaction management

⭐5stars🔀0forks📁View on GitHub🕐Updated Jan 2, 2026

When & Why to Use This Skill

This Claude skill provides comprehensive PostgreSQL-specific patterns and best practices for database design, performance optimization, and robust transaction management. It helps developers build scalable, reliable, and high-performance relational database systems by offering expert guidance on schema architecture, connection pooling, and efficient query execution.

Use Cases

  • Database Schema Design: Creating normalized and efficient table structures for new applications to ensure long-term scalability.
  • Transaction Safety: Implementing ACID-compliant patterns for complex operations, such as financial transfers, to prevent data corruption.
  • Query Performance Tuning: Identifying and implementing strategic indexing to resolve slow query issues and improve application responsiveness.
  • Resource Management: Configuring connection pooling techniques to handle high-concurrency environments and optimize server resource usage.
namepostgresql-skill
descriptionThis skill provides PostgreSQL-specific patterns for database design, optimization, and transaction management

PostgreSQL Development

Purpose

PostgreSQL is a powerful relational database. This skill documents patterns for safe transactions, optimization, and concurrent access.

When to Use

Use this skill when:

  • Designing database schema
  • Creating migrations
  • Implementing transactions
  • Optimizing queries
  • Managing connections

Key Patterns

1. Transaction Management

Wrap operations in transactions:

async def transfer_funds(self, from_account, to_account, amount):
    async with self.db.transaction():
        await self.db.execute(
            "UPDATE accounts SET balance = balance - ? WHERE id = ?",
            (amount, from_account)
        )
        await self.db.execute(
            "UPDATE accounts SET balance = balance + ? WHERE id = ?",
            (amount, to_account)
        )

2. Connection Pooling

Use connection pools for efficiency:

pool = await asyncpg.create_pool(
    'postgresql://user:password@localhost/db',
    min_size=10,
    max_size=20
)

3. Query Optimization

Use proper indexing:

CREATE INDEX idx_user_email ON users(email);
CREATE INDEX idx_transaction_date ON transactions(created_at);

See Also