postgres-safety

postgres-safety is a skill for Claude Code, Codex from Rohit-ATS/Airlock. It costs 37 tokens per session (1,779 once invoked), scanned A, original, MIT.

A safety guide for PostgreSQL database migrations. PostgreSQL is a database system, and a migration is a change to its tables or other database structure.

In plain words
What is it for?
Use it before writing or reviewing migrations to check the database version, reversibility, locks, and table rewrites.
Why use it?
It helps identify changes that cannot be undone, lock tables for a long time, or copy an entire table and interrupt production work.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rohit-ats/airlock/postgres-safety
Any agent
npx skills add Rohit-ATS/Airlock --skill postgres-safety
Clone the repo
git clone --depth 1 https://github.com/Rohit-ATS/Airlock

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for postgres-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/rohit-ats/airlock/postgres-safety.svg)](https://agentmods.dev/skills/rohit-ats/airlock/postgres-safety)
Your own site
<a href="https://agentmods.dev/skills/rohit-ats/airlock/postgres-safety"><img src="https://agentmods.dev/badge/skills/rohit-ats/airlock/postgres-safety.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,779 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.01779
Opus 5 $0.00018 $0.00890
Sonnet 5 $0.00007 $0.00356
Haiku 4.5 $0.00004 $0.00178

Measured 4d ago against content hash 3ca6c98a5cd2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

postgres-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/postgres-safety/SKILL.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreSQL safety

The rules a migration must obey before AIRLOCK will let anyone see it. Version-specific behaviour is called out because getting it wrong is how a "safe" migration takes a production table offline.

Always establish the server version first (SHOW server_version). Do not reason from memory about lock behaviour; it changed materially at 11, 12 and 13.


1. The three questions

Answer these, in order, for every operation:

  1. Is it reversible? Can I write an inverse that restores the exact prior bytes?
  2. What lock does it take, and for how long? A lock held for 4 seconds on a 1.2M-row table is a 4-second outage for every writer.
  3. Does it rewrite the table? A rewrite means the lock is held for the duration of a full copy, not for a catalog update.

If (1) is no, the change needs a scope certificate, not an undo certificate.


2. Irreversible in principle

No rollback script restores these. Do not claim reversibility.

Operation Why it cannot be undone
DROP TABLE / DROP COLUMN The data is gone. Re-adding the column gives you nulls.
TRUNCATE No row versions retained.
DELETE without a retained copy Ditto, once vacuumed.
UPDATE that loses information See §3 — the important one.
ALTER TYPE narrowing (textvarchar(20), bigintint) Truncation and overflow are lossy.
DROP of a constraint whose violations then land The violating rows now exist.

DROP COLUMN is logically irreversible even though Postgres only marks the column dropped in the catalog. The data is unreachable through SQL. Never present a re-ADD COLUMN as a rollback: it restores the schema, not the data.


3. Lossy arithmetic — the failure people miss

An UPDATE is only reversible if its function is injective (different inputs always give different outputs).

-- NOT reversible: ROUND collapses distinct values onto the same result
UPDATE invoices SET amount_minor = ROUND(amount_minor / 1.0871);

Read the full file on GitHub · 197 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 197 lines · 37 tokens per session scan A 3ca6c98a5cd2

Subscribe to this mod's changes

postgres-safety is a skill published in the GitHub repository Rohit-ATS/Airlock (1 stars, last pushed yesterday), licensed MIT. It adds 37 tokens to every session and 1,779 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

resonate-server-postgres

Run the Resonate protocol inside Postgres itself using resonate-pg — one SQL file of stored procedures, with no server process at all. Covers installing the schema, the pgcron timer dependency and its silent-failure mode, reaching the protocol through resonaterpc, starting workflows with resonate.invoke, the…

resonatehq/resonate-skills · 112 tokens

postgres-patterns

Provides PostgreSQL patterns for query optimization, schema design, indexing strategies, RLS, and security. Use when working with PostgreSQL SQL files or when the user mentions PostgreSQL, Postgres, pgvector, Supabase, or database optimization.

tranhieutt/software_development_department · 53 tokens

prisma-schema-conventions

Data modeling conventions for Prisma + PostgreSQL in multi-tenant systems — workspace isolation, numeric criticality, idempotent recurrence, document versioning by lineage and decoupled audit via a queue in Postgres itself. Use whenever creating or changing schema.prisma, designing new entities, planning migrations or…

JoaoEquer/Oficina · 76 tokens

reweave-operator

Operate a Reweave self-healing web-data fleet — run pipelines, triage structural-drift incidents, review repair proposals, and manage the human approval workflow. Use whenever a monitored source is broken, a heal is pending, or the operator asks about pipeline health or impact.

vnmoorthy/reweave · 62 tokens

postgres-patterns

PostgreSQL database patterns for query optimization, schema design, indexing, and security. Quick reference for common patterns, index types, data types, and anti-pattern detection. Based on Supabase best practices.

mturac/everything-openai-codex · 45 tokens

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens