database-postgresql

Design PostgreSQL database schemas with constraints, migrations, and RLS security.

15|2|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/d-padmanabhan/agent-engineering-handbook --skill database-postgresql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-postgresql
Source: https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/database-postgresql
Command: npx skills add https://github.com/d-padmanabhan/agent-engineering-handbook --skill database-postgresql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents brittle PostgreSQL database design by providing consistent schema patterns, safe migration workflows, performance-aware indexing, and baseline security practices like parameterization and row-level security.

Core Features & Use Cases

  • Schema design & conventions: Establishes naming standards for tables/columns/keys/constraints and provides opinionated defaults like created_at, updated_at, and deleted_at.
  • Migration best practices: Encourages reversible, version-controlled migrations, safe rollout tactics, and operational guardrails for schema changes.
  • Security & performance fundamentals: Covers SQL safety (parameterized queries), tenant isolation via RLS, and performance tuning through indexing strategies including partial and composite indexes.

Quick Start

Ask for a PostgreSQL schema and migration plan for a multi-tenant app that needs soft deletes, fast lookups by email, secure query patterns, and row-level security policies.

Frequently Asked Questions about database-postgresql

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

FAQPage Schema
How do I design a PostgreSQL schema for a multi-tenant app with row-level security?

Multi-tenant PostgreSQL schema design uses row-level security (RLS) policies to isolate tenant data. Establish consistent naming conventions, explicit constraints, and least-privilege setups to enforce tenant isolation and secure query patterns.

What's the best way to handle reversible PostgreSQL database migrations?

Reversible PostgreSQL migrations require version-controlled workflows, safe rollout tactics, and operational guardrails for schema changes. Apply safe operational patterns during table creation and enumeration updates to prevent destructive database deployment locks.

How do I implement soft deletes and indexing strategies in PostgreSQL?

Soft deletes in PostgreSQL use opinionated default columns like `deleted_at` combined with partial and composite indexing strategies. Implementing these indexing patterns ensures fast lookups by email while maintaining query performance for active records.

When do I need parameterized queries and row-level security in PostgreSQL?

Parameterized queries and row-level security are needed whenever an application handles sensitive or tenant-specific data. They establish SQL safety by preventing injection and enforce baseline security practices including least-privilege access control.

Can I use standard SQL conventions for creating tables and enums in PostgreSQL?

Standard SQL conventions for creating PostgreSQL tables and enums require consistent naming for tables, columns, keys, and constraints. Explicit constraints and opinionated timestamps like `created_at` prevent brittle schemas and maintain structural integrity.

Why does my PostgreSQL database need partial and composite indexes for performance tuning?

PostgreSQL performance tuning needs partial and composite indexes to optimize query performance for specific lookup patterns. Without these targeted indexing strategies, fast lookups degrade and database operations become brittle under heavy load.