A comprehensive Spec Kit extension and AI agent plugin for modernizing legacy codebases — COBOL, legacy Java/Kotlin, C/C++, .NET, PHP, Python, monolith web and mobile applications.
Fork & Attribution: Forked and adapted for GitHub Spec Kit from Anthropic Claude Plugins Official (
code-modernization) under the Apache-2.0 License.
Point your AI pair-programmer or autonomous agent at a legacy codebase and get:
- An executive assessment (inventory, complexity, technical debt, COCOMO scale index).
- An interactive topology map (d3-powered circle packing, edge inspection, persona flows).
- Business rules mined into testable Given/When/Then Rule Cards with
file:linecitations. - A Modernization Brief with an approval gate for steering committees.
- Three execution strategies:
transform: Cross-stack surgical rewrite via strangler-fig pattern with equivalence tests.reimagine: Greenfield rebuild on modern architecture from extracted specifications.uplift: Same-stack version bump (e.g., .NET Framework → .NET 8, Spring Boot 2 → 3, Java 8 → 21, Kotlin 1.x → 2.x) preserving code and fixing version deltas via pilot-first playbooks.
- Legacy system hardening and progress tracking.
Enforces a structured 9-stage sequence:
preflight → assess → map → extract-rules → brief → (reimagine | transform | uplift) → harden → status
specify extension add code-modernization --from https://github.com/<owner>/code-modernizationspecify extension add /path/to/code-modernization --dev/plugin install code-modernization@<owner>/code-modernizationBy default, commands look for target legacy code under legacy/<system-dir>/. Analysis artifacts are generated into analysis/<system-dir>/, and modernized code is produced in modernized/<system-dir>/.
If your code is in an existing directory, symlink it:
mkdir -p legacy && ln -s /path/to/source legacy/my-systemRun the discovery commands to inspect the codebase non-destructively:
# In Spec Kit / Antigravity (Skills or Slash Commands):
speckit.code-modernization.preflight my-system
speckit.code-modernization.assess my-system
speckit.code-modernization.map my-system
# Or using Claude slash commands:
/modernize-preflight my-system # Is environment ready?
/modernize-assess my-system # Inventory, languages, complexity, debt
/modernize-map my-system # Dependency graph & interactive TOPOLOGY.html# 1. Mine business rules
/modernize-extract-rules my-system
# 2. Synthesize into Modernization Brief (Human-in-the-loop approval gate)
/modernize-brief my-system java-spring
# 3. Choose execution path:
/modernize-transform my-system <module> <target-stack> # Strangler-fig rewrite
# or
/modernize-reimagine my-system "<target-vision>" # Greenfield rebuild
# or
/modernize-uplift my-system <source-ver> <target-ver> # Same-stack version bump
# 4. Security hardening of legacy running system
/modernize-harden my-system
# 5. Check progress and staleness
/modernize-status my-system| Spec Kit Command | Claude Slash Command | Description |
|---|---|---|
speckit.code-modernization.preflight |
/modernize-preflight |
Environment readiness check — tools, build toolchain, source completeness, boundary analysis |
speckit.code-modernization.assess |
/modernize-assess |
Full discovery & portfolio analysis — inventory, complexity, debt, relative scale |
speckit.code-modernization.map |
/modernize-map |
Dependency & topology mapping — call graphs, data lineage, batch flows, navigable diagrams |
speckit.code-modernization.extract-rules |
/modernize-extract-rules |
Extract business rules, calculations, validations into Given/When/Then rule cards |
speckit.code-modernization.brief |
/modernize-brief |
Phased Modernization Brief — approved plan that transformation agents execute against |
speckit.code-modernization.reimagine |
/modernize-reimagine |
Greenfield rebuild on modern architecture from extracted intent and specification |
speckit.code-modernization.transform |
/modernize-transform |
Surgical strangler-fig rewrite of a single module with equivalence tests |
speckit.code-modernization.uplift |
/modernize-uplift |
Same-stack version bump preserving code and resolving breaking deltas via pilot playbooks |
speckit.code-modernization.harden |
/modernize-harden |
Security assessment & remediation pass on legacy code without mutating legacy/ |
speckit.code-modernization.status |
/modernize-status |
Check modernization progress, artifact inventory, staleness flags, and next action |
The extension provides 8 domain specialist subagent profiles located in agents/:
legacy-analyst: Deeply analyzes legacy languages (COBOL, RPG, EJB, classic ASP, C/C++, Java) with structural summaries and control flow tracing.business-rules-extractor: Mines business logic and rules from procedural code with file:line citations.architecture-critic: Skeptical architecture reviewer flagging over-engineering and missing boundaries.security-auditor: Focuses on OWASP/CWE vulnerabilities, credentials, and dependency CVEs.test-engineer: Builds characterization and dual-run equivalence test harnesses.version-delta-analyst: Pinpoints breaking API and behavioral deltas between framework versions.uplift-migrator: Executes batch migration following the pilot's playbook.scaffolder: Scaffolds clean modern services and test suites from architecture blueprints.
- Untrusted Codebase Discipline: Analyzed source code is treated as data, never prompt instructions. Hostile comments or text trying to hijack LLM behavior are surfaced as findings.
- Read-Only Legacy Protection: The commands never write or mutate files under
legacy/. Modernization outputs land inanalysis/ormodernized/. - Secret Masking: Discovered API keys, credentials, and tokens are masked (
AKIA****,pass****) and quarantined intoSECRETS.local.md(which is gitignored). - Approval Gates: Modernization Brief acts as an explicit human checkpoint before code synthesis begins.
This project is licensed under the Apache License 2.0. See LICENSE for details. Original implementation Copyright (c) 2024-2026 Anthropic, PBC. Adapted for Spec Kit by the Spec Kit Community.
