author-migration

Author first-party Nx migrations with generators, prompts, and packageJsonUpdates entries.

29.3k|3.0k|Updated Aug 11, 2017
One-click install
npx skills add https://github.com/nrwl/nx --skill author-migration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: author-migration
Source: https://github.com/nrwl/nx/tree/main/.claude/skills/author-migration
Command: npx skills add https://github.com/nrwl/nx --skill author-migration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires semver, and includes scripts (resource) and references (resource) components.

What problem does it solve?

When Nx removes, renames, or deprecates an option, executor, or dependency, existing workspaces can break on nx migrate unless a proper migration ships with the change. This Skill guides the authoring of correct first-party Nx migrations so upgrades do not silently break user workspaces.

Core Features & Use Cases

  • Migration classification: Decomposes a breaking change into treatments (plain bump, source transform, prompt-only, hybrid, ported upstream migration) and decides whether an entry is needed at all.
  • Correct wiring: Covers migrations.json entry shape, version gating, requires semantics, packageJsonUpdates groups, and the colocated update-VER/NAME.{ts,spec.ts,md} file layout.
  • Runtime contract guidance: Companion references explain how nx migrate actually consumes each key, plus a registry of deprecated patterns to never copy.
  • Use Case: You bump a plugin to support a new upstream major (e.g., Vite 6) and need to decide which workspaces get a packageJsonUpdates group, which need a codemod generator, and which need an AI prompt runbook.

Quick Start

Ask the assistant to author an Nx migration for a breaking change, specifying the affected package and the target release train.

Frequently Asked Questions about author-migration

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

FAQPage Schema
How do I write an Nx migration for a breaking change?

Classify each breaking item into a treatment: declarative packageJsonUpdates for plain bumps, a generator implementation for deterministic source transforms, or a prompt .md for judgment-based changes. Then wire a generators entry in migrations.json with version, implementation, and documentation keys.

When should an Nx migration use a prompt instead of a generator?

Use a prompt only when no subset of the change is safely automatable by a deterministic transform. If any mechanical part exists, ship a hybrid entry with both implementation and prompt keys, since generators run for every user while prompts only execute in agentic flows.

How does the version field gate Nx migrations?

An entry runs when installed version is strictly less than the entry version and the entry version is at most the target, with prerelease ordering. Always use the train's exact next prerelease, never a bare final version or a backdated prerelease.

What is the difference between generators and packageJsonUpdates in migrations.json?

Generators entries run code or prompts against the workspace tree, while packageJsonUpdates groups declaratively bump dependency versions. Groups gate on the source major window with inclusive installed-side bounds and are evaluated in key order to support multi-major chains.

Why did my Nx migration silently skip some workspaces?

Skips usually come from a wrong requires gate: it evaluates against the version the package lands on in the same run, and a package absent from both pending updates and installed deps fails the gate. Upper bounds that encode the source window also fail when the run bumps past the cap.

Can an Nx migration return install tasks or GeneratorCallback?

No. The runner silently discards GeneratorCallback returns and installs packages by diffing package.json itself. Migrations return void, a string array of next steps, or an object with nextSteps, agentContext, and skipAgentic.