Aller au contenu principal

Rules: migration-safety

Major framework or dependency migrations are risky. Always follow a structured process to avoid cascades of CI failures.

Affected files

These rules apply to files matching the following patterns:

  • **/package.json
  • **/tsconfig.json
  • **/next.config.*
  • **/.eslintrc*
  • **/eslint.config.*
  • **/pyproject.toml
  • **/go.mod
  • **/pubspec.yaml
  • **/Cargo.toml
  • **/Gemfile

Detailed rules

Migration Safety

Principle

Major framework or dependency migrations are risky. Always follow a structured process to avoid cascades of CI failures.

Mandatory migration checklist

StepActionBlocking
1Read the framework's official migration guideYes
2List the breaking changes that impact the projectYes
3Create a dedicated branch (refactor/migrate-xxx)Yes
4Save the current CI state (note pre-existing errors)Yes
5Migrate one dependency at a time, not all at onceYes
6Run lint + type-check + tests after each changeYes
7Clear caches if necessaryYes
8Atomic commit per migration stepYes

Common migrations and pitfalls

MigrationKnown pitfallSolution
ESLint 8 → 9Flat config incompatible with old formatConvert .eslintrceslint.config.js
Next.js 14 → 15/16Turbopack cache corruptionDelete .next/ after migration
Prisma upgradeConflicting migrationsprisma migrate status before prisma migrate deploy
React 18 → 19Deprecated APIsCheck StrictMode and hooks
TypeScript 4 → 5New strict checksEnable checks one by one
Python 3.x → 3.ySyntax/API changesCheck pyproject.toml python-requires

Caches to clear after migration

StackCommand
Next.js / Turbopackrm -rf .next/
Webpackrm -rf node_modules/.cache/
TypeScriptrm -rf tsconfig.tsbuildinfo
Prismanpx prisma generate
Pythonfind . -type d -name __pycache__ -exec rm -rf {} +
Gogo clean -cache
Rustcargo clean
Flutterflutter clean

Rules

IMPORTANT: NEVER migrate multiple major dependencies at the same time. One migration at a time.

IMPORTANT: Always read the official migration guide BEFORE starting.

IMPORTANT: Clear bundler/compiler caches after each major migration.

NEVER ignore the breaking changes listed in the new version's changelog.

NEVER migrate without a dedicated branch — always be able to roll back.

Automatic application

These rules are automatically applied by Claude during:

  • Reading the matching files
  • Modifying code
  • Suggestions and fixes

See also