‹ 首页

legacy-modernizer

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

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.

适合你,如果正在维护老旧代码库,需要安全地迁移到新架构

/ 下载安装
legacy-modernizer.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/legacy-modernizer
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/legacy-modernizer
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/legacy-modernizer
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~1.1K最小装载
~11.3K含声明引用
~11.3K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

装上后,Claude 会帮你分析老旧代码,设计逐步迁移方案,生成依赖图、迁移路线图和 API 外观代码,并确保业务不中断。

什么时候触发

当你提到“遗留系统现代化”、“绞杀者模式”、“增量迁移”、“技术债务”等关键词,或要求分解单体、升级框架时触发。

装好后可以这样说
Claude 会生成外观层和迁移计划。
Claude 会输出依赖映射和风险评估。
Claude 会分阶段规划并包含回滚策略。
技能原文 SKILL.md作者撰写 · MIT · e8be415

Legacy Modernizer

Core Workflow
  1. Assess system — Analyze codebase, dependencies, risks, and business constraints. Produce a dependency map and risk register before proceeding.
  2. Validation checkpoint: Confirm all external integrations and data contracts are documented before moving to step 2.
  1. Plan migration — Design an incremental roadmap with explicit rollback strategies per phase. Reference references/system-assessment.md for code analysis templates.
  2. Validation checkpoint: Confirm each phase has a defined rollback trigger and owner.
  1. Build safety net — Create characterization tests and monitoring before touching production code. Target 80%+ coverage of existing behavior.
  2. Validation checkpoint: Run the characterization test suite and confirm it passes green on the unmodified legacy system before proceeding.
  1. Migrate incrementally — Apply strangler fig pattern with feature flags. Route traffic via a facade; shift load gradually.
  2. Validation checkpoint: Verify error rates and latency metrics remain within baseline thresholds after each traffic increment (e.g., 5% → 25% → 50% → 100%).
  1. Validate & iterate — Run full test suite, review monitoring dashboards, and confirm business behavior is preserved before retiring legacy code.
  2. 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:

  1. Assessment summary (risks, dependencies, approach)
  2. Migration plan (phases, rollback strategy, metrics)
  3. Implementation code (facades, adapters, new services)
  4. Test coverage (characterization, integration, e2e)
  5. 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

Documentation

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。