expand-contract

expand-contract is a skill for Claude Code, Codex from Rohit-ATS/Airlock. It costs 36 tokens per session (906 once invoked), scanned A, original, MIT.

A database-change pattern that splits a risky, irreversible change into three reversible phases: expand, migrate, and contract.

In plain words
What is it for?
Safely dropping or renaming fields, narrowing data types, backfilling data, adding required fields, or splitting and merging columns.
Why use it?
It keeps old and new application versions working together, so a failed release does not require undoing the database immediately.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Safely dropping or renaming fields, narrowing data types, backfilling data, adding required fields, or splitting and merging columns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rohit-ats/airlock/expand-contract
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.

Any agent
npx skills add Rohit-ATS/Airlock --skill expand-contract
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 expand-contract

README.md
[![agentmods](https://agentmods.dev/badge/skills/rohit-ats/airlock/expand-contract/github.svg)](https://agentmods.dev/skills/rohit-ats/airlock/expand-contract)
Your own site
<a href="https://agentmods.dev/skills/rohit-ats/airlock/expand-contract"><img src="https://agentmods.dev/badge/skills/rohit-ats/airlock/expand-contract/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for expand-contract

Your own site · 80×15
<a href="https://agentmods.dev/skills/rohit-ats/airlock/expand-contract"><img src="https://agentmods.dev/badge/skills/rohit-ats/airlock/expand-contract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 906 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00036 $0.00906
Opus 5 $0.00018 $0.00453
Sonnet 5 $0.00007 $0.00181
Haiku 4.5 $0.00004 $0.00091

Measured 8d ago against content hash 613d73e2890d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

expand-contract 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 8d 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/expand-contract/SKILL.md · 117 lines

How it starts

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

Expand / contract

When a change cannot be proven reversible, do not argue about the risk. Restructure it into three changes that each can be.

The pattern turns one irreversible step into a sequence where every individual step is reversible and every intermediate state is deployable. That is the whole idea: at no point does a rollback of the application require a rollback of the database.


When to reach for it

Use it whenever the honest answer to "can I restore the prior bytes?" is no:

  • dropping a column or a table
  • renaming anything
  • narrowing a type (bigintint, textvarchar(n))
  • a lossy UPDATE (see postgres-safety §3)
  • adding a NOT NULL column to a populated table
  • splitting or merging columns

The three phases

1. EXPAND — add the new shape alongside the old

Additive only. Nothing is removed and nothing is rewritten. The old readers and writers keep working untouched.

ALTER TABLE users ADD COLUMN tier text;    -- brief lock, no rewrite on PG 11+

Backfill in batches, then dual-write from the application so both columns stay correct.

Reversible? Yes — drop the new column. Nothing depended on it.

2. MIGRATE — move the readers

A code change, not a schema change. Readers switch to the new column one deployment at a time. Writers write both. Run a reconciliation query until the two columns agree for every row:

SELECT count(*) FROM users u
  JOIN subscriptions s ON s.user_id = u.id
 WHERE u.tier IS DISTINCT FROM s.plan_tier;    -- must be 0 before phase 3

Reversible? Yes — point the readers back. The old column is still authoritative.

3. CONTRACT — remove the old shape

Only once nothing reads the old column. Prove it, do not assume it:

  • the blast-radius scan returns zero references in any deployed branch
  • pg_stat_statements shows no query touching the column over a full business cycle
  • the dual-write has been on long enough to cover every code path
ALTER TABLE users DROP COLUMN plan_name;

Read the full file on GitHub · 117 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. 8d ago First seen · 117 lines · 36 tokens per session scan A 613d73e2890d

Subscribe to this mod's changes

expand-contract is a skill published in the GitHub repository Rohit-ATS/Airlock (1 stars, last pushed today), licensed MIT. It adds 36 tokens to every session and 906 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

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

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

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

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

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

agent-harness-fault-injection

Use when an agent workflow needs deterministic recovery evidence for sandbox, MCP/tool, worker, checkpoint, memory, or orchestration failures.

sickn33/agentic-awesome-skills · 34 tokens