How can AI help Engineering teams understand and modernise legacy systems?
AI can help engineers navigate unfamiliar code, trace relationships, draft documentation, propose tests and prepare bounded refactors. It cannot establish the full behaviour or business importance of a legacy system from source code alone. Modernisation should begin with evidence, characterisation and operational context, then use small reversible changes under experienced Engineering ownership.
Key takeaways
- Use AI to accelerate investigation, not declare undocumented behaviour.
- Combine code analysis with operational, Product and domain knowledge.
- Establish tests and observability before large transformations.
- Modernise in small increments with clear rollback and human review.
Legacy systems often contain critical rules that are poorly documented and understood by few people. Their code may use old technologies, but age alone does not make a system defective. The risk lies in changing behaviour the organisation does not fully understand.
AI can lower the effort needed to explore large codebases. Its explanations remain hypotheses until checked against execution, tests, users and experienced knowledge.
Build an evidence-backed system map
Give the tool a bounded question: trace a transaction, identify callers of an interface or explain how a business rule is implemented. Ask it to cite files and code paths rather than provide a general narrative. Engineers should inspect those sources and mark uncertainty.
Add evidence that source code cannot supply by itself: logs, runtime dependencies, production behaviour, support history, business processes and knowledge held by operators or Product specialists. Protect credentials, personal data and commercially sensitive code when selecting context.
Use the result as a map for investigation. Do not allow an attractive diagram or summary to become authoritative without validation.
Characterise behaviour before changing structure
Legacy code may lack automated tests. AI can propose characterisation tests that record current behaviour, identify edge cases and draft test fixtures. Engineers must decide which behaviour is intentional, accidental or unsafe. A generated test may simply encode the model's misunderstanding.
Improve observability around important flows and compare behaviour in a representative environment. Capture critical interfaces, data transformations, failure modes and recovery. This creates a safer basis for both human and AI-assisted change.
GitHub's current modernisation tutorial demonstrates uses such as explanation, data-flow mapping, test planning and conversion, while explicitly noting that responses vary. Such examples show possible activities, not proof that a transformation is correct.
Make bounded modernisation changes
Choose increments with clear value and recovery: extracting one rule, replacing one unsupported dependency, improving one interface or adding a compatibility layer. AI may draft a refactor or translation, but Engineering owns architecture, security, performance and maintainability.
Preserve external behaviour unless a deliberate Product decision changes it. Run established characterisation and regression evidence, review dependencies and compare operational signals. Avoid converting an entire system in one generated step where failures cannot be isolated.
Retain a human-led path for novel, safety-critical or poorly observable areas. The appropriate level of AI involvement can differ within the same legacy estate.
Learn without creating a new dependency
Record validated system knowledge in owned documentation, tests, decision records and runbooks rather than leaving it in an AI conversation. Name owners and update records when the modernisation changes behaviour or architecture.
Measure lead time, investigation effort, rework, defects, operational stability and the ability of other engineers to understand the result. Generated code volume is not modernisation value. A smaller, better-understood system may be a stronger outcome than a larger rewrite.
Review tool access and capability over time. The goal is not to make the model the new expert on the legacy system. It is to use AI to help more accountable people build and preserve reliable understanding.
Example
An insurer needs to change a calculation in an old service. An assistant traces likely code paths and drafts a data-flow map, linking every claim to files. A domain specialist identifies an exception the code alone does not explain.
Engineers add characterisation tests for the rule and its exception, then use AI to prepare a small refactor behind the existing interface. They review and deploy it with rollback and operational comparison. The validated rule is added to the owned domain record.
FAQs
-
Can AI automatically convert a legacy application to a modern language?
Tools may translate code, but syntax conversion does not validate behaviour, architecture, dependencies or operability. Treat conversion as generated work requiring incremental verification.
-
Is undocumented legacy code a suitable first AI-agent task?
Read-only exploration may be useful. Broad autonomous modification is usually difficult to control until the team has stronger understanding, feedback and recovery.
-
Should teams preserve every existing behaviour?
No. Characterisation distinguishes current behaviour from intended behaviour. Product and Engineering should decide explicitly which rules to retain, change or remove.