Skip to main content
skill CX Codex

migrate · codewithmukesh — Claude Code skill: what it does, how to install

Step-by-step workflow for EF Core schema migrations, .NET version upgrades, and NuGet package updates with rollback checks.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add codewithmukesh/dotnet-claude-kit --skill migrate -a claude-code
Open on GitHub

What migrate does

The skill handles EF Core schema changes and .NET upgrades. It also manages NuGet packages. Entity Framework Core is the primary focus. Before writing any files, it inspects entity changes with MCP tools like find_symbol and find_references to verify inheritance and downstream query impact. Every migration gets an action-oriented name such as AddOrderShippingAddress.

The database update command lacks a dry-run flag. Because of this, the skill generates an idempotent SQL script via dotnet ef migrations script to catch data loss risks early. It scans the generated SQL for DROP COLUMN statements and table locks. If a migration is already applied to the database, editing its code is blocked. You must create a new migration instead.

Package updates follow an incremental path. Dependencies are updated one at a time, followed immediately by dotnet build and dotnet test. That keeps breaking changes traceable. For major framework upgrades, the skill checks project target frameworks using get_project_graph and treats a dedicated Git branch as the required rollback mechanism.

What it helps with

  • generate descriptive EF Core migrations after model updates
  • inspect generated SQL for column drops and table locks
  • upgrade .NET target frameworks across multi-project solutions
  • update vulnerable NuGet dependencies one package at a time

Example prompts for the agent

  • /migrate
  • add migration for the new ShippingAddress property on Order
  • audit and update vulnerable nuget packages

How to install migrate

1Skills CLI (Vercel)

npx skills add codewithmukesh/dotnet-claude-kit --skill migrate -a claude-code

2Manually: put the files in place

~/.claude/skills/migrate/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/migrate/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about migrate

How do I install migrate in Claude Code?

Run npx skills add codewithmukesh/dotnet-claude-kit --skill migrate -a claude-code in your terminal.

What does the migrate skill do?

It guides you through EF Core database migrations, .NET version upgrades, and NuGet dependency updates. Every step includes validation commands and an explicit rollback strategy.

How does migrate prevent database data loss?

Because dotnet ef database update has no dry-run option, the skill creates an idempotent SQL script first. It reviews the SQL for table drops, column removals, and lock durations before applying anything.

Source text

SKILL.md · MIT
---
name: migrate
description: >
  Guided, safe migration workflow covering EF Core schema migrations, .NET
  version upgrades, and NuGet dependency updates — each with rollback
  strategies and verification steps. Invoke when: "add migration",
  "update database", "create migration", "schema change", "new table",
  "rename column", "upgrade nuget", "update packages", "dependency update",
  "version upgrade", ".NET upgrade".
---

# /migrate

## What

The single migration workflow for three change types, with EF Core schema
migrations as the primary flow:

1. **EF Core schema** — review pending model changes, generate a descriptively
   named migration, review the SQL for data loss and locking risks, apply with
   a documented rollback path.
2. **.NET version upgrade** — phased TFM/SDK/package upgrade with verification
   at each phase.
3. **NuGet updates** — incremental, one-package-at-a-time updates so breakage
   is always attributable.

Shared principles: verify before applying, rollback plan always, test after
every step, one logical change per migration.

## When

- After modifying entity classes, DbContext configuration, or relationships
- "add migration", "update database", "create migration", "new table", "rename column"
- When generating SQL scripts for DBA review
- "upgrade to .NET 10", "version upgrade", ".NET upgrade"
- "upgrade nuget", "update packages", "dependency update", vulnerable package alerts

## How

First, classify the request: schema change → Flow A; framework upgrade → Flow B;
package update → Flow C. Then follow that flow end to end.

### Flow A: EF Core Schema Migration (primary)

**Step 1: Assess current state**

```bash
dotnet ef migrations list --project <InfraProject> --startup-project <ApiProject>
```

Check for pending migrations and uncaptured model changes.

**Step 2: Review model changes**

Use MCP tools instead of reading whole files:

```
find_symbol(name: entity or DbSet)        -- locate the changed entity
get_type_hierarchy(typeName: entity)      -- check TPH/TPT/TPC inheritance changes
find_references(symbolName: property)     -- assess downstream query impact
```

Confirm the change is one logical unit. If not, split into multiple migrations —
mixed migrations make rollback all-or-nothing.

**Step 3: Generate migration**

Name describes the change, not the entity: `Add|Remove|Rename|Modify` + `WhatChanged`.

```bash
# GOOD
dotnet ef migrations add AddOrderShippingAddress --project <Infra> --startup-project <Api>
# BAD — names the entity, not the change
dotnet ef migrations add Order
```

**Step 4: Review generated SQL**

`database update` has no dry-run flag — preview by generating an idempotent
script and reading it:

```bash
dotnet ef migrations script --idempotent --project <Infra> --startup-project <Api>
```

Flag and report:
- **DROP COLUMN / DROP TABLE** — confirm data loss is intentional
- **ALTER COLUMN** type changes — check precision loss or truncation
- **ALTER on large tables** — warn about lock duration
- **New non-nullable columns** — need defaults for existing rows

If data must survive a rename/retype, use a multi-step migration with raw SQL:

```csharp
protected override void Up(MigrationBuilder migrationBuilder)
{
    migrationBuilder.AddColumn<string>("ContactEmail", "Customers", nullable: true);
    migrationBuilder.Sql("UPDATE \"Customers\" SET \"ContactEmail\" = \"Email\"");
    migrationBuilder.AlterColumn<string>("ContactEmail", "Customers", nullable: false);
    migrationBuilder.DropColumn("Email", "Customers");
}
```

**Step 5: Apply and verify**

```bash
dotnet ef database update --project <Infra> --startup-project <Api>
dotnet build && dotnet test   # integration tests catch schema mismatches
```

**Step 6: Document rollback**

```bash
dotnet ef database update <PreviousMigrationName> --project <Infra> --startup-project <Api>
dotnet ef migrations remove --project <Infra> --startup-project <Api>   # if unapplying from code
```

Never modify a migration that is already applied — create a new one.

### Flow B: .NET Version Upgrade

1. **Assess** — `get_project_graph` to list all TFMs; flag mixed versions.
2. **Pre-flight** — all tests green, no pending EF migrations, dependencies
   checked for target-version compatibility, dedicated branch created
   (branch IS the rollback plan).
3. **Update `global.json`** — SDK version with `"rollForward": "latestMinor"`.
4. **Update TFMs** — `<TargetFramework>net10.0</TargetFramework>` and
   `<LangVersion>14</LangVersion>` in `.csproj` or `Directory.Build.props`.
5. **Update packages** — `dotnet outdated --upgrade Major --include Microsoft.*`,
   then build and fix.
6. **Adopt new features** — per `knowledge/dotnet-whats-new.md`: `TimeProvider`,
   `HybridCache`, primary constructors, collection expressions.
7. **Verify** — `dotnet build`, `dotnet test`, `dotnet format --verify-no-changes`.

### Flow C: NuGet Package Updates

1. **Audit** — `dotnet list package --outdated` and `dotnet list package --vulnerable`.
   Vulnerable packages are urgent: update, test, deploy.
2. **Categorize** — patch (batch-safe), minor (one at a time), major (one at a
   time, read release notes first).
3. **Update incrementally** — one package, then `dotnet build && dotnet test`
   before the next. Batched updates make failures unattributable.
4. **Check fit** — consult `knowledge/package-recommendations.md` before adding
   new packages; prefer built-in .NET alternatives. Moving off MediatR
   (commercial license from v13)? Follow the step-by-step guide in
   `knowledge/mediatr-to-mediator-migration.md`.
5. **Rollback** — git revert the package bump; never downgrade other packages
   to compensate.

### MCP Tools Used

- `find_symbol` / `find_references` — locate entities, assess schema-change impact
- `get_type_hierarchy` — entity inheritance for TPH/TPT/TPC
- `get_project_graph` — TFM audit before version upgrades
- `get_diagnostics` — catch warnings after migration generation or upgrades

## Example

```
User: /migrate

Claude: Checking migration state...
  Last applied: 20250710_AddOrderTable
  Model changes detected: new ShippingAddress property on Order entity.

  Creating migration: AddOrderShippingAddress
  Reviewing SQL (dotnet ef migrations script --idempotent)...
  - ALTER TABLE "Orders" ADD "ShippingStreet" text NULL
  - ALTER TABLE "Orders" ADD "ShippingCity" text NULL
  No data loss. No locking risk. Safe to apply.

  Applying migration... Done. Build: green. Tests: 34/34 passed.

  Rollback (if needed):
  dotnet ef database update AddOrderTable --project src/Infrastructure --startup-project src/Api
```

## Related

- `ef-core` — entity configuration, query patterns, migration internals
- `/verify` — full verification pipeline after migration work
- `/checkpoint` — commit a safe state before risky migrations

© codewithmukesh · MIT · codewithmukesh/dotnet-claude-kit

Similar skills

Everything for Backend and APIs →

migrate by other authors comes first.

migrate Alireza Rezvani Moves Cypress or Selenium tests to Playwright. Use it when an existing test suite needs file-by-file conversion and checks after each change. 1,586installs migrate toss Reads your lodash code and shows how to swap each function for es-toolkit or es-toolkit/compat. Handy when the bundle needs to shrink. CX Codex +1 313installs migrate parcadei Runs a migration from target research through review. Use it for framework, language, database, or infrastructure changes. CX Codex +1 481installs migrate launchdarkly Walks an app with hardcoded prompts through a five-stage move to LaunchDarkly AgentControl, pausing for your confirmation at each stage. CX Codex +1 1,800installs migrate incluud Plans and runs a move to Astro or an Astro version upgrade. Useful when an existing app has to be taken apart piece by piece instead of rewritten blind. CX Codex +1 363installs migrate-dotnet10-to-dotnet11 dotnet Systematically migrates .NET 10 solutions to .NET 11. It updates target frameworks, bumps dependencies, and resolves C# 15 compiler and EF Core 11 breaking changes. CX Codex +1 3,400installs migrate-dotnet9-to-dotnet10 dotnet Walks a project from net9.0 to net10.0: updates TargetFramework, fixes build errors and works through breaking changes in .NET 10, C# 14, ASP.NET Core 10 and EF Core 10. CX Codex +1 3,400installs dotnet-backend-patterns Seth Hobson Skill for C# and .NET development: patterns for async code, dependency injection, Entity Framework Core, caching, and testing. Use when building backend APIs, MCP servers, or reviewing C# code. CX Codex 19,076installs dotnet-patterns affaan-m C# and ASP.NET Core architectural conventions for AI coding agents. Enforces patterns for dependency injection, immutability, async/await, and error handling. CX Codex +1 4,600installs api-design Aaronontheweb A skill for designing public APIs that only extend, so new releases don't break the code that already depends on them. CX Codex +1 660installs dotnet-project-structure Aaronontheweb A skill that tells your agent how to lay out a .NET solution: .slnx, Directory.Build.props, central package versions and SourceLink. CX Codex +1 658installs

From the same set46

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor