postgres-migrations

postgres-migrations is a skill for Claude Code, Codex from JayCheng113/skill-retrieval-mcp. It costs 21 tokens per session (221 once invoked), scanned A, original, MIT.

A guide to changing the structure of a live PostgreSQL database, a database system, while the application keeps running. It focuses on changes that do not block readers or writers for long periods.

In plain words
What is it for?
Planning safer PostgreSQL migrations, including adding or removing columns, filling existing rows in batches, validating constraints, and renaming columns across deployments.
Why use it?
Database changes can lock tables and interrupt production traffic, especially on large tables. The guidance breaks risky changes into smaller steps and sets a time limit for waiting on locks.

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/jaycheng113/skill-retrieval-mcp/postgres-migrations
Any agent
npx skills add JayCheng113/skill-retrieval-mcp --skill postgres-migrations
Clone the repo
git clone --depth 1 https://github.com/JayCheng113/skill-retrieval-mcp

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-migrations

README.md
[![agentmods](https://agentmods.dev/badge/skills/jaycheng113/skill-retrieval-mcp/postgres-migrations.svg)](https://agentmods.dev/skills/jaycheng113/skill-retrieval-mcp/postgres-migrations)
Your own site
<a href="https://agentmods.dev/skills/jaycheng113/skill-retrieval-mcp/postgres-migrations"><img src="https://agentmods.dev/badge/skills/jaycheng113/skill-retrieval-mcp/postgres-migrations.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 221 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.1 $0.00021 $0.00221
Opus 5 $0.00010 $0.00111
Sonnet 5 $0.00004 $0.00044
Haiku 4.5 $0.00002 $0.00022

Measured 6d ago against content hash 87c47f7ae7b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

postgres-migrations 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 6d 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.

tests/e2e/corpus/databases/postgres-migrations/SKILL.md · 23 lines

What it actually says

PostgreSQL migrations without downtime

Adding a NOT NULL column to a large table rewrites it under an ACCESS EXCLUSIVE lock, which blocks every reader and writer for the duration. Split it instead:

  1. Add the column as nullable with no default.
  2. Backfill in batches, committing between batches so the lock is never held long.
  3. Add a NOT VALID check constraint, then VALIDATE CONSTRAINT separately — validation takes only a SHARE UPDATE EXCLUSIVE lock.

Dropping a column is metadata-only and safe. Renaming one is not: the old and new name cannot both be live, so deploy a read-both/write-both shim first.

Always set lock_timeout before DDL. Without it a migration that cannot acquire its lock will queue behind a long transaction and block everything behind it too.

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. 6d ago First seen · 23 lines · 21 tokens per session scan A 87c47f7ae7b0

Subscribe to this mod's changes

postgres-migrations is a skill published in the GitHub repository JayCheng113/skill-retrieval-mcp (119 stars, last pushed 9d ago), licensed MIT. It adds 21 tokens to every session and 221 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

database-patterns

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.

yonatangross/orchestkit · 49 tokens

postgresdb

Use when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles, RLS, pooling, vacuum, partitioning, PITR). PG16, ORM-agnostic. NOT portable query logic (that is sql), NOT a managed provider's platform…

ericrisco/rsc-harness · 91 tokens

Drizzle ORM Testing

Testing patterns for Drizzle ORM covering migration testing, query builder testing, transaction testing, and database integration testing with PostgreSQL, SQLite, and MySQL.

PramodDutta/qaskills · 36 tokens

srtd-cli

This skill should be used when the user mentions "srtd", "sql templates", "migrations-templates", "live reload sql", "supabase functions", when working with files in supabase/migrations-templates/, when .buildlog.json or srtd.config.json is detected, or when writing Postgres functions/views/triggers for Supabase.

t1mmen/srtd · 75 tokens

db-migrations

Use when a schema change must ship without downtime — NOT NULL, rename, type change, or backfilling millions of live rows — for the expand-contract sequence and the lock/batching discipline that keeps each step from freezing prod. NOT lock internals or EXPLAIN (that is postgresdb), NOT drizzle-kit mechanics (that is…

ericrisco/rsc-harness · 90 tokens

drizzle-orm

Use when modeling data or querying with Drizzle ORM in TypeScript — pgTable schema in .ts, type-safe select/insert/relational queries, drizzle-kit migrations. NOT Prisma Client or schema.prisma (that is prisma-orm), NOT ORM-agnostic migration strategy (that is db-migrations), NOT Postgres engine tuning or EXPLAIN…

ericrisco/rsc-harness · 96 tokens