Manages database schema migrations with zero-downtime strategies, rollback plans, and data migration patterns. Supports EF Core, Flyway, and Liquibase.
Ships in claude-skills-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Avant tout, caractériser l'opération :
| Type | Risque | Stratégie recommandée |
|---|---|---|
| Ajout colonne nullable | Faible | Migration directe |
| Ajout colonne NOT NULL sans default | Élevé | Expand-contract obligatoire |
| Renommage colonne/table | Élevé | Alias + expand-contract |
| Suppression colonne/table | Élevé | Phase contract après code nettoyé |
| Changement de type | Élevé | Colonne intermédiaire + backfill |
| Ajout index (grande table) | Moyen | Index CONCURRENTLY / online |
| Data migration (backfill) | Variable | Batches, jamais full-table en une passe |
Trois phases déployées séparément :
Acceptable uniquement si : trafic < 100 rps OU table < 100k lignes OU downtime explicitement accepté par le métier.
Maintenir deux environnements avec bascule DNS/load-balancer. Adapté aux changements majeurs de schéma impossibles à rendre backward-compatible.
dotnet ef migrations add AddUserEmailIndex --project src/Infrastructure
dotnet ef database update --connection "Server=...;Database=...;"
# Rollback vers migration précédente
dotnet ef database update NomMigrationPrecedente
// Migration générée — toujours vérifier le SQL produit
protected override void Up(MigrationBuilder mb)
{
mb.AddColumn<string>("email_verified", "users", nullable: true);
mb.CreateIndex("IX_users_email", "users", "email", unique: true);
}
protected override void Down(MigrationBuilder mb)
{
mb.DropIndex("IX_users_email", "users");
mb.DropColumn("email_verified", "users");
}
db/migration/
V1__create_users.sql
V2__add_email_verified.sql
V20260624_001__backfill_email.sql # préfixe date pour éviter conflits
flyway -url=jdbc:postgresql://host/db -user=x -password=y migrate
flyway info # état des migrations
flyway repair # si checksum corrompu
# changelog-v3.yaml
databaseChangeLog:
- changeSet:
id: add-email-verified
author: vantaflow
changes:
- addColumn:
tableName: users
columns:
- column:
name: email_verified
type: boolean
defaultValueBoolean: false
rollback:
- dropColumn:
tableName: users
columnName: email_verified
alembic revision --autogenerate -m "add_email_verified"
alembic upgrade head
alembic downgrade -1 # rollback d'une révision
Nommage : V<YYYYMMDD>_<NNN>__<description>.sql + script rollback/R<YYYYMMDD>_<NNN>__<description>.sql obligatoire.
Ne jamais backfiller une grande table en une seule transaction — risque de lock prolongé et timeout.
-- PostgreSQL / SQL Server : backfill par batch de 10 000 lignes
DO $$
DECLARE
last_id BIGINT := 0;
batch BIGINT := 10000;
BEGIN
LOOP
UPDATE users
SET email_verified = false
WHERE id > last_id AND id <= last_id + batch
AND email_verified IS NULL;
EXIT WHEN NOT FOUND;
last_id := last_id + batch;
PERFORM pg_sleep(0.1); -- respiration entre batches
END LOOP;
END $$;
-- SQL Server : même principe avec TOP
DECLARE @batch INT = 10000;
WHILE 1=1
BEGIN
UPDATE TOP (@batch) users
SET email_verified = 0
WHERE email_verified IS NULL;
IF @@ROWCOUNT = 0 BREAK;
WAITFOR DELAY '00:00:00.100';
END
-- Index sans lock table (peut prendre du temps, c'est voulu)
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
-- Contrainte NOT NULL sans réécriture complète (PG 12+)
ALTER TABLE users ALTER COLUMN email SET NOT NULL; -- rapide si CHECK déjà validé
ALTER TABLE users ADD CONSTRAINT chk_email_notnull CHECK (email IS NOT NULL) NOT VALID;
ALTER TABLE users VALIDATE CONSTRAINT chk_email_notnull; -- scan en arrière-plan
# pt-online-schema-change (Percona Toolkit) — pas de lock table
pt-online-schema-change --alter "ADD COLUMN email_verified TINYINT(1) DEFAULT 0" \
D=mydb,t=users --execute
# gh-ost (GitHub) — alternative sans triggers
gh-ost --database mydb --table users \
--alter "ADD COLUMN email_verified TINYINT(1) DEFAULT 0" \
--execute
# Dump anonymisé de prod vers staging
pg_dump prod_db | psql staging_db
# Mesurer la durée réelle
\timing on -- psql
# Détecter les locks
-- PostgreSQL
SELECT pid, query, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event IS NOT NULL;
-- SQL Server
SELECT * FROM sys.dm_exec_requests WHERE blocking_session_id <> 0;
# Valider le plan post-migration
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM users WHERE email = '[email protected]';
Checklist staging :
\d+ tablename en psql, sp_help en SQL Server)dotnet ef database update <PreviousMigration>U2__undo_add_email_verified.sql (Flyway Pro) ou script manuelliquibase rollbackCount 1 ou rollbackToDateR_<version>__rollback.sql toujours en binôme avec le script UpNe jamais faire :
ALTER TABLE bloquant sur table > 500k lignes en heures de pointe.IF NOT EXISTS manquant → crash à la re-exécution).Toujours faire :
migration_log ou outil dédié).What SKILL.md sets; muted values are Claude Code's defaults
/claude-skills-collection:dev-database-migration-helperfrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests"./agent-autogen-guideDéveloppement d'agents conversationnels avec Microsoft AutoGen. Création de group chats, agents spécialisés et workflows multi-agents avec exécution de code. Se déclenche avec "AutoGen", "Microsoft AutoGen", "autogen agent", "group chat agent", "ConversableAgent", "AssistantAgent", "UserProxyAgent", "coding agent", "agents qui conversent". Also triggers on "AutoGen agents", "group chat agents", "conversable agent"./agent-browser-agent-builderConstruction d'agents de navigation web autonomes incluant scraping intelligent, interaction DOM et gestion de sessions. Se déclenche avec "browser agent", "agent navigateur", "agent web autonome", "Puppeteer agent", "Playwright agent. Also triggers on "web browsing agent", "autonomous scraping agent"./agent-claude-code-extension-builderConstruction d'extensions et skills pour Claude Code — slash commands, hooks, intégration MCP et commandes personnalisées. Se déclenche avec "extension Claude Code", "skill Claude", "slash command", "Claude Code plugin", "custom command Claude". Also triggers on "build a Claude Code plugin", "custom slash command", "Claude Code hooks".Other plugins' skills for the same job