New advertisers: 50% off your first month with code FIRSTMONTHSee slots
laurigates avatar

migration-patterns-plugin

Migration plugin with dual-write, shadow-mode, and automated Python and JS tooling swaps.

version
1.7.1
GitHub stars
60
View on GitHub

What it does

  • Adds 7 skills covering data migration patterns, tooling migrations, and a cutover gate for retiring incumbent tools
  • Covers dual write, shadow mode, and tool swaps: mypy to ty, black to ruff-format, flake8 and isort to ruff, and ESLint and Prettier to Biome
  • Enforces a cutover gate that keeps the old tool in place until the replacement shows a positive operational signal
  • Designed for teams running zero-downtime migrations, invoked through /configure:repo when a migratable pattern is detected

Safe database and system migration patterns - dual write, shadow mode, strangler fig

Add marketplace

/plugin marketplace add laurigates/claude-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install migration-patterns-plugin@laurigates-claude-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

/migration-patterns:black-to-ruff-format

Migrate from black to ruff format — Ruff's drop-in Black-compatible formatter written in Rust (~35x faster). Replaces the psf/black pre-commit hook, migrates [tool.black] configuration, and removes black from dev dependencies.

When to Use This Skill

Use this skill when...Keep black when...
.pre-commit-config.yaml contains psf/blackTeam has strong preference for black's exact output
[tool.black] exists in pyproject.tomlCI uses black --check specifically by name
Repo already uses ruff for lintingProject uses black's API in build scripts
Wanting to consolidate formatting under ruff

Context

  • Pre-commit config: !find . -maxdepth 1 -name '.pre-commit-config.yaml'
  • pyproject.toml: !find . -maxdepth 1 -name 'pyproject.toml'
  • ruff already present: !find . -maxdepth 1 -name 'ruff.toml'

Parameters

ParameterDescription
--check-onlyReport what would change without modifying files
--fixApply migration automatically

Execution

Execute this black-to-ruff-format migration:

Step 1: Audit current black configuration

  1. Read .pre-commit-config.yaml and locate psf/black entries.
  2. Read pyproject.toml and extract the [tool.black] section.
  3. Report findings:
    black → ruff-format migration audit
    =====================================
    pre-commit hook:  psf/black found at rev <rev>
    pyproject.toml:   [tool.black] section found (line-length=<N>, target-version=<X>)
    ruff already:     EXISTS / NOT PRESENT
    
    If --check-only, stop here.

Step 2: Update .pre-commit-config.yaml

Remove the psf/black repo block. If ruff-pre-commit is already present, add the ruff-format hook ID. Otherwise add the full ruff-pre-commit repo block with both ruff and ruff-format hooks:

- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.9.1  # use latest stable ruff version
  hooks:
    - id: ruff
      args: [--fix]
    - id: ruff-format

If ruff-pre-commit already exists but only has the ruff linter hook, add the ruff-format hook ID under the same repo block.

Step 3: Migrate [tool.black] → [tool.ruff.format] in pyproject.toml

Convert black configuration to ruff format config:

black keyruff equivalentNotes
line-length[tool.ruff] line-lengthShared with linter
target-version[tool.ruff] target-versionShared with linter
skip-string-normalization[tool.ruff.format] quote-style = "preserve"
skip-magic-trailing-comma[tool.ruff.format] skip-magic-trailing-comma = true
preview[tool.ruff.format] preview = true

Remove the [tool.black] section. Merge settings into [tool.ruff] and [tool.ruff.format] sections (create if absent, merge if existing).

Step 4: Remove black from dependencies

Remove black from dev/lint dependencies:

# With uv
uvx --from uv uv remove --dev black 2>/dev/null || true

If not using uv, note it for manual removal.

Step 5: Verify migration

Run the new hook to confirm it works:

pre-commit run ruff-format --all-files

If it exits 0, the migration is complete. If it produces diffs, this is expected on first run (ruff format may reformat some files differently from black). Commit the reformatted files as part of the migration.

Step 6: Report

Print a summary of changes:

black → ruff-format migration complete
=======================================
.pre-commit-config.yaml   UPDATED (removed psf/black, added ruff-format hook)
pyproject.toml            UPDATED ([tool.black] → [tool.ruff.format])

Note: ruff-format is Black-compatible (same defaults), but may reformat a small
number of files. Review the diff and include these reformatted files in the
migration commit.

Files to stage:
  git add .pre-commit-config.yaml pyproject.toml
  git add <any reformatted .py files>

Agentic Optimizations

ContextCommand
Audit only/migration-patterns:black-to-ruff-format --check-only
Apply migration/migration-patterns:black-to-ruff-format --fix
Verify after migrationpre-commit run ruff-format --all-files
Check format directlyuvx ruff format --check .

Quick Reference

ItemValue
ruff format docshttps://docs.astral.sh/ruff/formatter/
Black compatibilityruff format is designed as a Black drop-in with ~99.9% compatible output
Config section[tool.ruff.format] in pyproject.toml
Pre-commit hookruff-format in astral-sh/ruff-pre-commit

See Also

  • /migration-patterns:flake8-to-ruff — Migrate flake8/isort linting to ruff
  • /migration-patterns:mypy-to-ty — Migrate mypy to ty
  • /configure:repo — End-to-end repo config driver

Readme

migration-patterns-plugin

Migration patterns for safe, zero-downtime transitions — both data migrations and tooling migrations.

Skills

Data Migration Patterns

SkillDescription
dual-writeDual write (double write) pattern for keeping two data stores in sync during migration
shadow-modeShadow mode (dark launching) pattern for validating new systems under production traffic

Migration Discipline

SkillDescription
tool-migration-cutoverGate removal of the incumbent tool on a positive operational signal from the replacement — and spot the mirror failure, a leftover still wired and fighting the new tool

Automated Tooling Migrations

SkillInvocationDescription
mypy-to-ty/migration-patterns:mypy-to-tyMigrate from mypy to ty (Astral's type checker)
black-to-ruff-format/migration-patterns:black-to-ruff-formatMigrate from black to ruff's formatter
flake8-to-ruff/migration-patterns:flake8-to-ruffMigrate from flake8/isort to ruff linting
eslint-to-biome/migration-patterns:eslint-to-biomeMigrate from ESLint/Prettier to Biome

Data Migration Patterns

Dual Write

During a database migration, the application writes to both the old and new system simultaneously. Reads can be compared between them to validate consistency before cutting over.

Use when: Migrating databases, switching storage backends, zero-downtime schema changes.

Shadow Mode

Production requests are mirrored to a shadow deployment in the background. The shadow's responses are discarded (only the production response reaches the user), but responses are logged and compared to verify the new system behaves correctly under real traffic.

Use when: Validating replacement services, testing under production load, comparing response correctness.

Combined Usage

These patterns are complementary tactics within the Strangler Fig migration strategy:

  • Shadow mode validates read behavior
  • Dual write keeps both systems in sync
  • Together they enable safe, gradual migration with rollback at every phase

Tooling Migration Skills

These skills automate common Python and TypeScript tooling migrations. Each migration:

  • Audits the current state
  • Updates .pre-commit-config.yaml
  • Migrates configuration in pyproject.toml / biome.json
  • Removes old dependencies
  • Verifies the migration with a dry run

All four skills are invoked by /configure:repo via AskUserQuestion when the corresponding migration pattern is detected — they are not run automatically.

mypy → ty

Replaces the mirrors-mypy pre-commit hook with a repo: local hook running uvx ty check. Converts [tool.mypy] config to [tool.ty].

Note: astral-sh/ty-pre-commit does not yet exist; repo: local with entry: uvx ty check is the correct pattern.

black → ruff-format

Replaces psf/black pre-commit hook with ruff-format. Migrates [tool.black] config to [tool.ruff.format]. Drop-in compatible output.

flake8/isort → ruff

Replaces pycqa/flake8 and PyCQA/isort hooks with a single ruff hook. Migrates rule configuration and import-sort settings.

ESLint → Biome

Replaces .eslintrc* and Prettier configs with biome.json. Updates pre-commit hooks and package.json scripts. Flags plugins without Biome equivalents (e.g., eslint-plugin-jsx-a11y) for manual review.

Migration Discipline

tool-migration-cutover

"Config exists" and "config works" are different claims, and the gap between them is where coverage silently drops to zero. This skill gates removal of the incumbent on a positive operational signal from the replacement (a successful runner execution, a side effect on the target repo, a token actually minted and used), and stages the deprecation as a draft until that signal lands. It also covers the mirror failure — the old tool left wired, reformatting correct code on every commit.

Use when: Removing Dependabot after adopting Renovate, retiring a PAT for a GitHub App, replacing a linter/formatter/CI runner, or when a 3-line edit produces a 400-line diff.

Integration with /configure:repo

The end-to-end driver /configure:repo detects migratable patterns and offers each migration via AskUserQuestion. Users choose which migrations to apply.

Installation

Add to your Claude Code plugin registry or install from the marketplace.

Details

Marketplace
laurigates/claude-plugins
Source
migration-patterns-plugin
Author
Lauri Gates
Category
Infrastructure
License
MIT
Keywords
migration, dual-write, shadow-mode, dark-launching, strangler-fig, database-migration, zero-downtime
Listed since
Apr 7, 2026

More from laurigates/claude-plugins

All 52

Similar to migration-patterns-plugin

More Developer Tools