Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Postgresql?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/vectora-os-postgresql)
---
name: postgresql
description: PostgreSQL — schema and constraints, index types (B-tree, GIN, BRIN, partial), EXPLAIN ANALYZE, MVCC and vacuum, isolation levels and locks, connection pooling, partitioning, row-level security, JSONB use, replication and backups. Use for Postgres schema, queries and operations (PostgreSQL, Postgres, index, EXPLAIN, vacuum, RLS, partitioning).
metadata:
category: data
---
# PostgreSQL
## Purpose
Use PostgreSQL's guarantees and features correctly for integrity and speed.
**Use when:** Postgres schema, queries, operations.
**Not for:** database choice (`decision-analyst`).
## Inputs
- Schema, queries, workload.
## Outputs
- Schema changes, indexes, plans before/after.
## Read first
- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "postgresql"` for prior decisions, patterns and anti-patterns.
## Steps
1. **Integrity.** Use constraints (FK, unique, check, NOT NULL) to enforce invariants.
Done when invariants are in the schema.
2. **Indexes.** Index for actual query patterns; check with EXPLAIN (ANALYZE, BUFFERS).
Done when plans use intended indexes.
3. **Concurrency.** Choose isolation; use `SELECT … FOR UPDATE SKIP LOCKED` for queues; keep transactions short.
Done when no long transactions.
4. **Operations.** Pooling (PgBouncer), autovacuum tuning, partitioning for large time series.
Done when bloat and pool saturation monitored.
## Best practices
- `CREATE INDEX CONCURRENTLY` in production migrations.
- Use `timestamptz`.
## Common mistakes
- JSONB for relational data.
- Missing FK indexes.
## Example
Partial index `WHERE status='pending'` cut queue polling from 120 ms to 2 ms.
## Reusable prompt
```text
Apply the PostgreSQL skill (.agents/skills/postgresql/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Review the schema and queries: constraints, indexes with plans, concurrency and operational settings.
Return: Schema changes, indexes, plans before/after..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```