Reference guide for PostgreSQL query optimization, schema design, indexing, and security patterns.
- What it does
- This skill is a quick-reference document of PostgreSQL patterns covering index selection, data type choices, common query patterns, anti-pattern detection queries, and configuration templates. It includes SQL snippets for composite, covering, and partial indexes, Row Level Security policies, upserts, cursor pagination, and queue processing, plus diagnostic queries for unindexed foreign keys, slow queries, and table bloat. It produces guidance and example SQL rather than executing anything.
- When to use it
- Use it when writing SQL queries or migrations, designing a database schema, troubleshooting slow queries, implementing Row Level Security, or setting up connection pooling. It is meant as a fast lookup during PostgreSQL work, with a fuller review workflow delegated to a separate database-reviewer agent.
- Requirements
- No scripts or tooling are required; it is instructions and SQL examples only. Applying the configuration and diagnostic snippets assumes a PostgreSQL database, and the monitoring examples reference the pg_stat_statements extension.