agentleFS
saitarrunsaitarrun/Devforge-ai/skills/legacy-modernization/SKILL.md

legacy-modernization

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Industrial legacy code modernization, strangler fig migration, monolith decoupling, schema evolution without downtime, and reverse-engineering undocumented codebases.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never attempt a "Big Bang" rewrite of an industrial legacy application.

    line 15
  2. Distinctive:

    When dealing with 100k+ lines of undocumented legacy spaghetti code:

    line 36
  3. Distinctive:

    Before editing a single line, record input/output snapshots of the legacy system across hundreds of real-world scenarios.

    line 39
  4. Distinctive:

    When modifying legacy schemas touching millions of production records:

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Industrial Legacy Code Modernization & Migration Skill

This skill defines the strategy for safely refactoring, decoupling, and migrating mission-critical legacy systems (e.g., COBOL backends, 15-year-old monoliths, stored-procedure-heavy databases, PHP/Java EE stacks, and undocumented C++/C# engines) without production outages.


1. The Strangler Fig Modernization Pattern

Never attempt a "Big Bang" rewrite of an industrial legacy application. Always use the Strangler Fig Pattern:

[Phase 1: Ingress Interception & Routing Proxy]
  ↳ Direct traffic through an API gateway / reverse proxy (Envoy / Cloudflare / Nginx).
          ↓
[Phase 2: Shadow Traffic & Dark Launching]
  ↳ Duplicate live production requests to both the Legacy System and the Modern Microservice.
  ↳ Compare responses; assert 100% data equality (diff assertions) without returning modern output to clients yet.
          ↓
[Phase 3: Incremental Traffic Shifting]
  ↳ Route 1% → 10% → 50% → 100% of read traffic to the new service.
          ↓
[Phase 4: Legacy Strangling & Decommissioning]
  ↳ Decommission the legacy code path once all mutations and reads are fully migrated.

2. Reverse-Engineering Undocumented Legacy Code

When dealing with 100k+ lines of undocumented legacy spaghetti code:

  1. Golden Master Characterization Testing:
    • Before editing a single line, record input/output snapshots of the legacy system across hundreds of real-world scenarios.
    • Lock down behavior with automated characterization test suites.
  2. Extract Seams & Anti-Corruption Layers (ACL):
    • Introduce an Anti-Corruption Layer (ACL) between legacy data structures and modern domain models to prevent legacy naming/type pollution.
  3. Database Stored-Procedure Extraction:
    • Extract raw SQL triggers, cursors, and stored procedures into explicit, version-controlled domain services.

3. Zero-Downtime Database Migration (Expand & Contract)

When modifying legacy schemas touching millions of production records:

[Step 1: Expand]
  ↳ Add new column/table in parallel; do NOT drop or alter existing legacy columns.
          ↓
[Step 2: Dual Write]
  ↳ Application writes to BOTH legacy and new schemas simultaneously; reads still from legacy.
          ↓
[Step 3: Backfill]
  ↳ Run background batch migration job to sync historical records into the new schema.
          ↓
[Step 4: Switch Reads]
  ↳ Switch application reads to the new schema.
          ↓
[Step 5: Contract]
  ↳ Stop writing to the old schema; safely drop deprecated columns/tables after 30 days.

4. Legacy Migration Checklist

  • Characterization snapshot tests written before refactoring
  • Anti-Corruption Layer (ACL) isolates legacy models from new code
  • Database migration uses Expand/Contract (zero table locking)
  • Shadow traffic diff comparison passes with 0 discrepancy
  • Rollback switch/feature flag active in API Gateway

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.