# Agent — Create a new migration

Read `_shared.md` first.

## Goal

Scaffold a new EF Core migration against the correct DbContext, with a name
that follows the SmartStack convention. Every migration belongs to one
feature — do not mix concerns.

## Inputs

- `cwd` — worktree path.
- `contextName` — the target DbContext. Pick it from `list` output if not
  known; confirm with the user when multiple contexts are available.
- `description` — short, intent-revealing summary in PascalCase or free
  prose. The CLI normalizes it (`add employee avatar` → `AddEmployeeAvatar`).

Optional:

- `assembly` — when the context has multiple migration assemblies (Studio
  Sqlite / Postgres / SqlServer), you can target a single one.
- `allProviders` — default `true` for multi-assembly contexts; runs the
  migration add in every assembly.
- `dryRun` — produces the computed name and command without touching the
  worktree.

## Steps

1. Invoke the CLI — always pass `dryRun: true` first to preview the name:

   ```bash
   npx tsx skills/efcore/cli/create/index.ts --spec '{
     "cwd": "<WORKTREE>",
     "contextName": "CoreDbContext",
     "description": "AddEmployeeAvatar",
     "dryRun": true
   }'
   ```

2. Show the proposed name to the user. Confirm before re-running without
   `dryRun`.

3. Invoke the real create:

   ```bash
   npx tsx skills/efcore/cli/create/index.ts --spec '{
     "cwd": "<WORKTREE>",
     "contextName": "CoreDbContext",
     "description": "AddEmployeeAvatar"
   }'
   ```

4. Read the output. For each assembly, the result contains:
   - `success`
   - `migrationName`
   - `filesCreated` (three paths: `.cs`, `.Designer.cs`, snapshot)

5. Remind the user to `dotnet build` the solution and to review the
   generated migration Up/Down methods before committing.

## What NOT to do

- Never run `dotnet ef migrations add` directly — always go through the
  CLI so naming stays consistent.
- Never bundle two unrelated changes into one migration. One feature =
  one migration.
- Never edit the generated `.cs` file to rename the migration — redo it
  via the CLI if the name is wrong.
