Skip to content
Back to skills

Postgresql

ASecurity

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).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgosqldatabasesecurity

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill postgresql --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgresql?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgresql
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-postgresql/badge)](https://www.skillsdirectory.com/skills/vectora-os-postgresql)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.