Skills for Real Engineers. Straight from my .agents directory.
postgres-database-migration
Agent skill fromtimescale/pg-aiguide
Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. **Trigger when user asks to:** - Test a schema migration before applying it to production - Add, remove, or rename columns safely on a live table - Change a column's data type without downtime - Add or drop indexes, constraints, or foreign keys on large tables - Understand which ALTER TABLE operations lock the table - Roll back a failed migration - Plan a zero-downtime migration strategy - Fork a database to test a migration safely **Keywords:** migration, schema change, ALTER TABLE, add column, drop column, rename column, change type, zero downtime, lock, AccessExclusiveLock, concurrent index, forking, rollback, backfill, deploy Covers: lock-level reference for every common DDL operation, safe migration patterns, fork-based testing, zero-downtime column changes, index creation, constraint addition, backfill strategies, pre/post-
How to install postgres-database-migration
npx skills add timescale/pg-aiguide# or add only this skill to Claude Code: copy the folder
skills/postgres-database-migration/
# into
~/.claude/skills/postgres-database-migration/ (all projects)
.claude/skills/postgres-database-migration/ (one project)
1# PostgreSQL Database Migrations23A schema migration that works on an empty dev database can fail, lock, or corrupt data on a production table with millions of rows. This guide covers how to assess risk, test against real data, and execute migrations safely.45## DDL Lock Reference67Every schema change acquires a lock. The critical question is: **does it block reads and writes, and for how long?**89### Fast, Non-Blocking Operations1011These complete in milliseconds regardless of table size. They only hold a brief `AccessExclusiveLock` for the catalog update, not for data rewriting.1213| Operation | Lock Level | Notes |14|-----------|-----------|-------|15| `ADD COLUMN` (nullable, no default) | `AccessExclusiveLock` (brief) | **Fast.** No table rewrite. Metadata-only change. |16| `ADD COLUMN ... DEFAULT x` (PG 11+) | `AccessExclusiveLock` (brief) | **Fast.** Non-volatile defaults stored in catalog, not backfilled. |17| `DROP COLUMN` | `AccessExclusiveLock` (brief) | **Fast.** Column marked invisible; space reclaimed by VACUUM over time. |18| `SET DEFAULT` / `DROP DEFAULT` | `AccessExclusiveLock` (brief) | Metadata change only. Does not touch existing rows. |19| `CREATE INDEX CONCURRENTLY` | `ShareUpdateExclusiveLock` | **Non-blocking.** Allows reads and writes during build. Slower than regular index creation. |20| `DROP INDEX CONCURRENTLY` | `ShareUpdateExclusiveLock` | **Non-blocking.** Waits for queries using the index to finish, then drops. No table-level exclusive lock. |21…
Excerpt shown under the repository's Apache-2.0 license.
More skills in pg-aiguide
Similar skill repositories
An agentic skills framework & software development methodology that works.
Public repository for Agent Skills
Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.
Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Production-grade engineering skills for AI coding agents.
