diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 20:18:45 -0700 |
|---|---|---|
| committer | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 20:18:45 -0700 |
| commit | b6b148f496e8da208676b4a1553bdf292ce340d9 (patch) | |
| tree | b975243ebfb4e78dd56d4b36ac3560feed156f7b /plugins | |
| parent | 696904602b2bdf3e0ddd07ae1221f9eb3e3b8e62 (diff) | |
code-modernization: a front door that asks what you want once
/code-modernization:modernize takes no arguments. It finds the code, asks
what the person wants to do with it (a newer version of the same
technology, a rewrite in another one, a rebuild, or just to understand it)
and what must stay true, writes the answers to analysis/<system>/INTENT.md,
shows the road ahead in a few lines, and gives the exact first command.
On a return visit it acts like status.
brief takes its objective, target and each phase's build command from
INTENT.md, and uplift, transform and reimagine fall back to it for their
versions, target and vision, so nobody is asked the same thing twice. The
README's start section now begins with the front door.
Diffstat (limited to 'plugins')
5 files changed, 80 insertions, 9 deletions
diff --git a/plugins/code-modernization/README.md b/plugins/code-modernization/README.md index dd765fe1..7392e6a7 100644 --- a/plugins/code-modernization/README.md +++ b/plugins/code-modernization/README.md @@ -12,11 +12,19 @@ Point Claude at a legacy codebase (COBOL, Java, .NET, PHP, Perl, Python 2, C and ## Start here -1. **Point it at your code.** In a workspace folder, put the code at `legacy/<name>` (a copy or a symlink), or leave it where it is and pass `--source <path>` in step 2: preflight makes the `legacy/<name>` link for you and copies nothing. `<name>` is a short label: letters, digits, `-` and `_`. -2. **Run** `/code-modernization:modernize-preflight <name>` (add `--source /path/to/code` if it lives elsewhere). -3. **Follow the "next step" line** each command ends with, or run `/code-modernization:modernize-status <name>` at any time: it says where you are and gives the exact command to paste. - -Commands are namespaced, so type the full name (autocomplete finds it from `/modernize`). Flags go after the arguments. No command edits your code: they write to `analysis/<name>/` and `modernized/`, and each refreshes `analysis/<name>/REPORT.html`, one page with everything found so far that you can open or share. +Type `/code-modernization:modernize` in a workspace folder (autocomplete finds it from `/modernize`). It asks what you want to do with +your code, finds it (a `legacy/<name>` copy or symlink, or a folder you point it at), writes your answers down once, shows the road +ahead, and gives you the exact first command. You can also run any command directly: + +1. **Point it at your code.** Put it at `legacy/<name>` (a copy or a symlink), or pass `--source <path>` to preflight: it makes the + `legacy/<name>` link for you and copies nothing. `<name>` is a short label: letters, digits, `-` and `_`. +2. **Run** `/code-modernization:modernize-preflight <name>`. +3. **Follow the "next step" line** each command ends with, or run `/code-modernization:modernize-status <name>` at any time: it says + where you are and gives the exact command to paste. + +Commands are namespaced, so type the full name. Flags go after the arguments. No command edits your code: they write to +`analysis/<name>/` and `modernized/`, and each refreshes `analysis/<name>/REPORT.html`, one page with everything found so far that +you can open or share. ## The path diff --git a/plugins/code-modernization/commands/modernize-brief.md b/plugins/code-modernization/commands/modernize-brief.md index 5e567540..b9a9299e 100644 --- a/plugins/code-modernization/commands/modernize-brief.md +++ b/plugins/code-modernization/commands/modernize-brief.md @@ -6,13 +6,17 @@ arguments: system target_stack Synthesize everything in `analysis/$system/` into a **Modernization Brief**: the single document a steering committee approves and engineering executes. Target stack: -`$target_stack` (if blank, recommend one from the assessment). +`$target_stack` (if blank, the one in `analysis/$system/INTENT.md`, else recommend one from the assessment). Read `ASSESSMENT.md`, `topology.json` (and the `.mmd` files beside it; never read `TOPOLOGY.html`, it is a viewer with the data minified inside) and `BUSINESS_RULES.md` in `analysis/$system/` first. If any is missing, say so and stop: they come from `assess`, -`map` and `extract-rules`, which run first. Two more inputs are conditional: +`map` and `extract-rules`, which run first. Three more inputs are conditional: +- **`INTENT.md`**, if it exists (written by `/code-modernization:modernize`): what the person wants (goal, target, + what must stay true). It is the objective of this plan; never override it with a guess. Its goal decides each + phase's build command: a newer version of the same technology means `uplift`, a rewrite in another technology + means `transform`, a rebuild on a new architecture means `reimagine`. Without it, the assessment's pattern decides. - **`PREFLIGHT.md`**, if it exists. It holds two things nothing else has: the human's answers to preflight Check 0 (scope, local build and test, bespoke build infrastructure, prior attempts, what is off limits) and the Check 6 **scope boundary** (whether the source is a diff --git a/plugins/code-modernization/commands/modernize-reimagine.md b/plugins/code-modernization/commands/modernize-reimagine.md index 65f324f0..f06970c9 100644 --- a/plugins/code-modernization/commands/modernize-reimagine.md +++ b/plugins/code-modernization/commands/modernize-reimagine.md @@ -1,11 +1,11 @@ --- description: Rebuild the system from its extracted intent on a new architecture, with two human checkpoints -argument-hint: <system> <target-vision> +argument-hint: <system> [target-vision] arguments: system --- The first token of `$ARGUMENTS` is the system name (`$system`); **everything after it is the target -vision**, usually several words, so do not truncate it. Below, `<vision>` means that whole remainder. +vision**, usually several words, so do not truncate it (with none, use the one in `analysis/$system/INTENT.md`). Below, `<vision>` means that whole remainder. The code is `legacy/$system`, often a symlink to where it really lives: say where it points (`readlink legacy/$system`) in one line before you start. Run every subagent in the foreground and wait for its result: never end your turn while one is still running. **Reimagine** the system as: <vision>. This is not a port but a rebuild from extracted intent: the legacy diff --git a/plugins/code-modernization/commands/modernize-status.md b/plugins/code-modernization/commands/modernize-status.md index 2439bdc0..04ff05a0 100644 --- a/plugins/code-modernization/commands/modernize-status.md +++ b/plugins/code-modernization/commands/modernize-status.md @@ -16,6 +16,7 @@ presence and modification time: | Stage | Artifacts | |---|---| +| intent | `INTENT.md` (what the person wants; written by `/code-modernization:modernize`) | | preflight | `PREFLIGHT.md` (are the Check 0 human answers and the Check 6 scope-boundary finding there?), where `legacy/$system` points (does that directory exist?) | | assess | `ASSESSMENT.md`, `ARCHITECTURE.mmd` | | map | `topology.json`, `TOPOLOGY.html`, `*.mmd`, `extract_topology.*` | diff --git a/plugins/code-modernization/commands/modernize.md b/plugins/code-modernization/commands/modernize.md new file mode 100644 index 00000000..9440ae58 --- /dev/null +++ b/plugins/code-modernization/commands/modernize.md @@ -0,0 +1,58 @@ +--- +description: Start here — say what you want done with your code and get the plan and the first step +argument-hint: [system] [--source <path>] +arguments: system +--- + +You are the front door of a guided modernization. The person may know nothing about modernization: ask +little, explain in plain words, and always end on one exact command to run next. + +## 1 — Find where things stand + +- If `$system` was given, use it. Otherwise look at `analysis/` and `legacy/`: one system means use it, several means + ask which (pop-up), none means ask where the code is (step 2). +- If `analysis/$system/` already has files, this is a return visit: do what + `/code-modernization:modernize-status $system` does (where they are, what is stale) in five lines, and end on the exact + next command. Stop there. + +## 2 — Find the code + +The code is `legacy/$system` (a copy, or a symlink to where it really lives). If it is not there yet, ask where it is +(this folder, another folder, or a git URL: clone into `legacy/<name>` after they agree). If `$ARGUMENTS` has +`--source <path>`, use that path. Pick a short name for it (letters, digits, `-` and `_`) if none was given. Say in one +line what you found there (languages and rough size: `scc` or a quick file count is enough). + +## 3 — Ask what they want (one pop-up, at most three questions) + +Use the AskUserQuestion tool, never chat text; without it (a headless run) pick the defaults and record them as open +items. Give each question plain options and let them type their own. + +1. **What do you want to do with it?** Options: *Move to a newer version of the same technology* (for example .NET + Framework to .NET 8, Java 8 to 17, Python 2 to 3), *Rewrite it in a different technology, one piece at a time, while + the old system keeps running*, *Rebuild it from scratch on a new architecture*, *Just understand it first: map it and + list what it does*, *I'm not sure: recommend one after a quick look*. +2. **What should it become?** Only for a version move (from which version to which), a rewrite (the target language or + framework) or a rebuild (a sentence about the goal). Offer common choices for the code's stack, and "Other". +3. **What must stay true?** Options (pick any): *The old system keeps running during the move*, *Behavior must match + exactly, including known quirks*, *Fix known bugs as we go*, *A security review comes first*, *Nothing else*. + +## 4 — Write it down once + +Write `analysis/$system/INTENT.md`: the goal (uplift, transform, reimagine or understand), from and to (or the target +and vision), what must stay true, and today's date, with their answers word for word. Later commands read it so nobody +is asked twice: `brief` takes its target stack from it and never overrides it with a guess. + +## 5 — Show the road + +In at most eight lines, tailored to their goal, list the commands they will run in order (`preflight`, `assess`, `map`, +`extract-rules`, `brief`, then `uplift`, `transform` or `reimagine`, then `verify` and `harden`), one line each on what they get +and where a person decides. For "understand it first" stop after `brief`. For "not sure", run `preflight` and `assess` +first and let the assessment's recommended pattern pick the road. Name the two places a human decides (approving the brief, +accepting each difference the proof finds) so nothing surprises them. + +## 6 — First step + +Give the exact command with everything filled in, for example +`/code-modernization:modernize-preflight billing "Java 17" --source /work/billing`, and ask "Shall I start it?". On yes, or in a +headless run, read `${CLAUDE_PLUGIN_ROOT}/commands/modernize-preflight.md` and carry it out with those arguments as if they had +typed it. After it finishes, name the next command. |
