legacy-modernizer
jeffallan/claude-skills
Design incremental migration strategies and dependency maps for legacy system modernization without disrupting operations.
What is legacy-modernizer?
Legacy Modernizer guides you through safe, incremental modernization of aging codebases using patterns like strangler fig and branch by abstraction. Use it when decomposing monoliths, upgrading frameworks, implementing service boundaries, or reducing technical debt while maintaining zero production disruption.
- Analyzes legacy systems and produces dependency maps and risk registers
- Designs incremental migration roadmaps with explicit rollback strategies per phase
- Creates characterization tests to capture existing behavior as a safety net before refactoring
- Generates API facade designs to route traffic between legacy and new services using feature flags
- Provides monitoring and validation checkpoints to ensure stability after each migration increment
How to install legacy-modernizer
npx skills add https://github.com/jeffallan/claude-skills --skill legacy-modernizerHow to use legacy-modernizer
- 1.Assess your legacy system: analyze codebase, dependencies, and risks; produce a dependency map and risk register
- 2.Plan the migration: design an incremental roadmap with rollback strategies and assign phase owners
- 3.Build a safety net: create characterization tests targeting 80%+ coverage of existing behavior; validate they pass on unmodified legacy code
- 4.Migrate incrementally: apply strangler fig pattern with feature flags; route traffic gradually (e.g., 5% → 25% → 50% → 100%)
- 5.Validate and iterate: run full test suite, review monitoring dashboards, and confirm business behavior is preserved before retiring legacy code
Use cases
- Migrating a monolithic application to microservices by extracting services incrementally
- Upgrading a legacy framework or language while keeping the system live
- Implementing the strangler fig pattern to gradually replace old code with new implementations
- Establishing service boundaries in a tightly-coupled codebase without business disruption
- Reducing technical debt through incremental refactoring with comprehensive test coverage
- Backend architects planning system modernization
- Engineering leads managing legacy system upgrades
- Teams implementing microservices decomposition
- DevOps engineers coordinating zero-downtime deployments
- Technical leads reducing technical debt incrementally
legacy-modernizer FAQ
A technique where you gradually replace legacy code by routing requests through a facade layer to either the old or new service based on feature flags, allowing incremental migration without big-bang rewrites.
Target 80%+ coverage of existing behavior through characterization tests (golden-master tests) that capture the legacy system's current behavior as a safety net.
No. Every migration phase must have a defined rollback trigger and owner. New code must be proven stable at 100% traffic for at least one release cycle before legacy code is removed.
Use characterization tests to capture that behavior empirically before making changes. These tests fail loudly if unexpected behavior changes, protecting you from breaking hidden dependencies.
The skill provides reference guidance in `references/migration-strategies.md` for database, UI, API, and framework migrations. Use incremental approaches with feature flags to route reads/writes between old and new schemas.
Full instructions (SKILL.md)
Source of truth, from jeffallan/claude-skills.
name: legacy-modernizer description: Designs incremental migration strategies, identifies service boundaries, produces dependency maps and migration roadmaps, and generates API facade designs for aging codebases. Use when modernizing legacy systems, implementing strangler fig pattern or branch by abstraction, decomposing monoliths, upgrading frameworks or languages, or reducing technical debt without disrupting business operations. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: specialized triggers: legacy modernization, strangler fig, incremental migration, technical debt, legacy refactoring, system migration, legacy system, modernize codebase role: specialist scope: architecture output-format: code+analysis related-skills: test-master, devops-engineer
Legacy Modernizer
Core Workflow
-
Assess system — Analyze codebase, dependencies, risks, and business constraints. Produce a dependency map and risk register before proceeding.
- Validation checkpoint: Confirm all external integrations and data contracts are documented before moving to step 2.
-
Plan migration — Design an incremental roadmap with explicit rollback strategies per phase. Reference
references/system-assessment.mdfor code analysis templates.- Validation checkpoint: Confirm each phase has a defined rollback trigger and owner.
-
Build safety net — Create characterization tests and monitoring before touching production code. Target 80%+ coverage of existing behavior.
- Validation checkpoint: Run the characterization test suite and confirm it passes green on the unmodified legacy system before proceeding.
-
Migrate incrementally — Apply strangler fig pattern with feature flags. Route traffic via a facade; shift load gradually.
- Validation checkpoint: Verify error rates and latency metrics remain within baseline thresholds after each traffic increment (e.g., 5% → 25% → 50% → 100%).
-
Validate & iterate — Run full test suite, review monitoring dashboards, and confirm business behavior is preserved before retiring legacy code.
- Validation checkpoint: New code must be proven stable at 100% traffic for at least one release cycle before legacy path is removed.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Strangler Fig | references/strangler-fig-pattern.md | Incremental replacement, facade layer, routing |
| Refactoring | references/refactoring-patterns.md | Extract service, branch by abstraction, adapters |
| Migration | references/migration-strategies.md | Database, UI, API, framework migrations |
| Testing | references/legacy-testing.md | Characterization tests, golden master, approval |
| Assessment | references/system-assessment.md | Code analysis, dependency mapping, risk evaluation |
Code Examples
Strangler Fig Facade (Python)
# facade.py — routes requests to legacy or new service based on a feature flag
import os
from legacy_service import LegacyOrderService
from new_service import NewOrderService
class OrderServiceFacade:
def __init__(self):
self._legacy = LegacyOrderService()
self._new = NewOrderService()
def get_order(self, order_id: str):
if os.getenv("USE_NEW_ORDER_SERVICE", "false").lower() == "true":
return self._new.fetch(order_id)
return self._legacy.get(order_id)
Feature Flag Wrapper
# feature_flags.py — thin wrapper around an environment or config-based flag store
import os
def flag_enabled(flag_name: str, default: bool = False) -> bool:
"""Check whether a migration feature flag is active."""
return os.getenv(flag_name, str(default)).lower() == "true"
# Usage
if flag_enabled("USE_NEW_PAYMENT_GATEWAY"):
result = new_gateway.charge(order)
else:
result = legacy_gateway.charge(order)
Characterization Test Template (pytest)
# test_characterization_orders.py
# Captures existing legacy behavior as a golden-master safety net.
import pytest
from legacy_service import LegacyOrderService
service = LegacyOrderService()
@pytest.mark.parametrize("order_id,expected_status", [
("ORD-001", "SHIPPED"),
("ORD-002", "PENDING"),
("ORD-003", "CANCELLED"),
])
def test_order_status_golden_master(order_id, expected_status):
"""Fail loudly if legacy behavior changes unexpectedly."""
result = service.get(order_id)
assert result["status"] == expected_status, (
f"Characterization broken for {order_id}: "
f"expected {expected_status}, got {result['status']}"
)
Constraints
MUST DO
- Maintain zero production disruption during all migrations
- Create comprehensive test coverage before refactoring (target 80%+)
- Use feature flags for all incremental rollouts
- Implement monitoring and rollback procedures
- Document all migration decisions and rationale
- Preserve existing business logic and behavior
- Communicate progress and risks transparently
MUST NOT DO
- Big bang rewrites or replacements
- Skip testing legacy behavior before changes
- Deploy without rollback capability
- Break existing integrations or APIs
- Ignore technical debt in new code
- Rush migrations without proper validation
- Remove legacy code before new code is proven
Output Templates
When implementing modernization, provide:
- Assessment summary (risks, dependencies, approach)
- Migration plan (phases, rollback strategy, metrics)
- Implementation code (facades, adapters, new services)
- Test coverage (characterization, integration, e2e)
- Monitoring setup (metrics, alerts, dashboards)
Knowledge Reference
Strangler fig pattern, branch by abstraction, characterization testing, incremental migration, feature flags, canary deployments, API versioning, database refactoring, microservices extraction, technical debt reduction, zero-downtime deployment
Related skills
More from jeffallan/claude-skills and the wider catalog.

mcp-developer
Build and debug MCP servers/clients connecting AI systems to tools and data sources.

microservices-architect
Design distributed system architectures, decompose monoliths, and implement resilience patterns for cloud-native microservices.

ml-pipeline
Design and deploy production ML pipelines with experiment tracking, orchestration, and automated model lifecycle management.

monitoring-expert
Set up comprehensive monitoring, logging, metrics, dashboards, alerts, and performance testing for production systems.

nestjs-expert
Enterprise NestJS specialist for REST APIs, GraphQL services, and scalable TypeScript backends with DI, authentication, and testing.

nextjs-developer
Senior Next.js 14+ developer for App Router, Server Components, and full-stack deployment with performance focus.