run-migration

Generates and applies EF Core migrations for .NET microservices.

1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/GSU26SE55/backend --skill run-migration-gsu26se55
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: run-migration
Source: https://github.com/GSU26SE55/backend/tree/main/.claude/skills/dev/be/run-migration
Command: npx skills add https://github.com/GSU26SE55/backend --skill run-migration-gsu26se55

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing database schema changes across multiple .NET microservices is error-prone when each service has its own DbContext and project layout. This Skill standardizes how EF Core migrations are generated, applied, verified, and rolled back for any service in the solution. ## Core Features & Use Cases - Migration Generation: Runs dotnet ef migrations add with the correct -p (Infrastructure) and -s (Api) project flags for the target service. - Apply & Verify: Applies migrations with dotnet ef database update and verifies output in the Migrations folder. - Naming Conventions: Enforces PascalCase naming patterns such as Add{Entity}, Add{Field}To{Entity}, and InitialCreate. - Troubleshooting: Provides commands to remove the last migration, list existing migrations, and generate a SQL script for review. - Use Case: After adding a new VoltageThreshold property to the Battery entity, run the Skill with BatteryService and AddVoltageThresholdToBattery to produce and apply a consistent migration. ## Quick Start Ask the assistant to run the migration skill for BatteryService with the migration name AddBattery to generate and apply the EF Core migration.

Frequently Asked Questions about run-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an EF Core migration in a multi-project solution?▼

Run dotnet ef migrations add from the Api project directory, passing -p to point at the Infrastructure project containing the DbContext and -s for the startup Api project. This ensures the migration is scaffolded in the correct assembly.

How to apply EF Core migrations to the database from the CLI?▼

Use dotnet ef database update with the same -p and -s flags used during generation. The Skill also supports auto-migrate on startup via db.Database.Migrate() in Program.cs.

What naming convention should EF Core migrations follow?▼

Use PascalCase names that describe the change: Add{Entity} for new entities, Add{Field}To{Entity} for new columns, Remove{Field}From{Entity} for deletions, and InitialCreate for the first schema.

How do I undo an EF Core migration that was not applied yet?▼

Run dotnet ef migrations remove with the same project and startup flags to delete the most recent migration. If it was already applied, revert the database first or create a compensating migration.

Can I review the SQL of an EF Core migration before applying it?▼

Yes, run dotnet ef migrations script with the project flags to generate the SQL for review. This lets you verify schema changes before executing dotnet ef database update.