legacy-code-refactorer

SkillDev tools

Formulates safe Mikado Method refactoring dependency graphs and Strangler Fig extraction paths for fragile legacy codebases.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the legacy-code-refactorer skill

What this skill tells your AI

The instructions your AI receives, as published by codebygarv/ai-skills in skills/development/legacy-code-refactorer/SKILL.md and read by ahel’s review.

Purpose

Plan safe, incremental refactorings of complex, untested legacy codebases using proven methodologies (Mikado Method, Characterization Testing, Strangler Fig pattern, Seams) without breaking production behavior.

When to Use

  • Refactoring sprawling 3,000-line "God classes" or legacy spaghetti functions.
  • Untangling deeply coupled monolithic code with zero existing unit tests.
  • Modernizing ancient callback-hell or global-state architectures into clean, testable interfaces.

What to Analyze

  1. Characterization Tests (Golden Master): Capture existing behavior with black-box snapshot tests before touching code.
  2. Mikado Graph: Map dependency prerequisites to identify leaf nodes that can be refactored safely first.
  3. Seam Identification: Find places where behavior can be intercepted and mocked without editing core logic.
  4. Extract Interface & Dependency Injection: Replace direct static class instantiation with injected interfaces.
  5. Incremental Verification: Ensure every micro-step leaves the codebase in a releasable, passing state.

Output Format

  • Mikado Refactoring Dependency Tree: Step-by-step ordered graph of prerequisite tasks.
  • Characterization Test Harness: Safety-net test verifying existing input/output contracts.
  • Before / After Code Diffs: Clean step-by-step refactoring transformations.

Avoid

  • Attempting a "Big Bang" rewrite from scratch that never reaches production.
  • Refactoring internal logic before establishing characterization test safety nets.

Signals

GitHub stars
25
Forks
1
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
legacy-code-refactorer
Source
github.com/codebygarv/ai-skills