add-db-migration

add-db-migration is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 65 tokens per session (662 once invoked), scanned A, original, Apache-2.0.

A guide for changing a database schema, the definition of stored tables, columns, indexes, and rules, through a migration.

In plain words
What is it for?
Use it to add or change tables and columns, indexes, constraints, or backfills, with reversible and scale-conscious migration steps.
Why use it?
It reduces the risk of data loss, locked tables, downtime, or code that cannot work with the changed database.

Skill for Claude CodeCodex

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

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/tmj-90/gaffer/add-db-migration
Any agent
npx skills add tmj-90/gaffer --skill add-db-migration
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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 add-db-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/add-db-migration.svg)](https://agentmods.dev/skills/tmj-90/gaffer/add-db-migration)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/add-db-migration"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/add-db-migration.svg" alt="Measured on agentmods" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 662 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.00065 $0.00662
Opus 5 $0.00032 $0.00331
Sonnet 5 $0.00013 $0.00132
Haiku 4.5 $0.00006 $0.00066

Measured 5d ago against content hash 7b13cfd5cb32, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

add-db-migration 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 5d 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.

runner/skills/add-db-migration/SKILL.md · 48 lines

How it starts

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

Add a database migration

Schema changes are high-risk: they can lock tables, drop data, or break running code. Produce a reversible migration that follows the repo's tooling — and escalate when a human decision is needed.

Steps

  1. Read the lore first. Call search_lore (Memory MCP) for migration conventions: the tool (Flyway/Liquibase/Alembic/Prisma/Knex/…), naming/numbering, whether migrations must be backward-compatible with running code, and any ADR on zero-downtime changes.
  2. Assess the risk. If the change is destructive (drop column/table, narrow a type, non-nullable add without default), rewrites a large table, or could cause downtime or data loss — stop and call mark_ticket_blocked with the specifics. A human decides.
  3. Write a reversible migration using the repo's generator. Provide both up and down (or an explicit, justified note when a true rollback is impossible). Prefer additive, backward-compatible steps; split risky changes into expand → migrate → contract phases.
  4. Make it safe at scale. Add indexes concurrently where the engine supports it; add columns nullable or with a default; backfill in batches, not one statement.
  5. Apply it against a test/dev database (the context packet's DB; never production) and confirm it runs forward and rolls back cleanly. Add/adjust tests for the new schema.
  6. Run tests (run-tests). Evidence the migration file, the apply+rollback output, and test results, then use the record-evidence skill and submit for review.

Rules

  • Every migration must be reversible, or carry an explicit reason it cannot be.
  • Destructive or downtime-risking changes → mark_ticket_blocked; do not decide alone.
  • Never run migrations against production; use the test/dev DB from the packet.
  • Don't install DB tooling or write secret/.env files — the hook blocks both.
  • Run on a branch (the create-branch skill), never a protected branch.

Capture lore

This skill is one of the places durable, reusable knowledge naturally surfaces: A schema decision or migration constraint future agents must respect — a naming convention, a reversibility rule, or a modelling choice with downstream impact. That kind of fact is lore. Capture it via the lore-capture protocol in your brief (CLAUDE.factory.md, step 11 "Memory contribution"): call the Memory MCP suggest_lore once at the close of your work — reusable conventions, gotchas, decisions, and boundaries only, never per-ticket trivia.

Read the full file on GitHub · 48 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. 5d ago First seen · 48 lines · 65 tokens per session scan A 7b13cfd5cb32

Subscribe to this mod's changes

add-db-migration is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 5d ago), licensed Apache-2.0. It adds 65 tokens to every session and 662 once invoked, about $0.0003 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

database-query-profiler

Profile database query profiler operations. Auto-activating skill for Performance Testing. Triggers on: database query profiler, database query profiler Part of the Performance Testing skill category. Use when working with database query profiler functionality. Trigger with phrases like "database query profiler"…

nek1987/auto-agent-harness · 64 tokens

database-schema-designer

Build database schema designer operations. Auto-activating skill for Backend Development. Triggers on: database schema designer, database schema designer Part of the Backend Development skill category. Use when working with database schema designer functionality. Trigger with phrases like "database schema designer"…

nek1987/auto-agent-harness · 64 tokens

database-schema-visualizer

Generate database schema visualizer operations. Auto-activating skill for Visual Content. Triggers on: database schema visualizer, database schema visualizer Part of the Visual Content skill category. Use when working with database schema visualizer functionality. Trigger with phrases like "database schema…

nek1987/auto-agent-harness · 71 tokens

database-test-helper

Assist with database test helper operations. Auto-activating skill for Test Automation. Triggers on: database test helper, database test helper Part of the Test Automation skill category. Use when writing or running tests. Trigger with phrases like "database test helper", "database helper", "database".

nek1987/auto-agent-harness · 62 tokens

dbt-test-creator

Create dbt test creator operations. Auto-activating skill for Data Pipelines. Triggers on: dbt test creator, dbt test creator Part of the Data Pipelines skill category. Use when writing or running tests. Trigger with phrases like "dbt test creator", "dbt creator", "dbt".

nek1987/auto-agent-harness · 71 tokens

database-operations

Instructions on how to write database queries with SQLAlchemy.

nek1987/auto-agent-harness · 15 tokens