Tell us about your project

blog post on using ai to refactor legacy systems
blog post on using ai to refactor legacy systems
Image of Dylan Marcotte
Dylan Marcotte
5 min lecture 29 May, 2026

Legacy Systems vs. Innovation: A Persistent Challenge

Companies of all kinds often face a common bottleneck in software delivery: a long history and technology debt dating back many years. Manufacturing companies are particularly hard hit by this phenomenon. That said, we'd be surprised to learn that dozens, if not hundreds, of domains share the same issue.

Legacy systems often concentrate the heart of business value, but their evolution is costly and risky: incomplete documentation, implicit dependencies, time-consuming tests, and difficult-to-anticipate side effects. How can you integrate a new feature quickly, without weakening the existing system or blowing your schedule and budget, when a significant proportion of project time is taken up by understanding and securing the terrain?

Because even before writing a line of code, you need to map the unknown: which areas are really responsible for the behaviour you want to change, which dependencies will be affected, which side-effects lurk. It is precisely at this bottleneck that AI begins to change the game, transforming a long, uncertain exploration phase into a guided, iterative process.

 

AI as a strategic lever for legacy systems

AI can serve as an analysis and preparation assistant for legacy systems: it helps to read and summarize historical code, map dependencies, reveal implicit architecture and propose integration strategies. By preparing the ground faster and more accurately, we reduce the risk of side effects, shorten delivery cycles and improve the quality of the technical decisions made by our development teams. As my colleague Alexandre Rivest mentions in his article on refactoring, "a developer spends most of his time reading rather than writing. The ratio is about 90% reading, against 10% writing." So it's essential, when optimizing developers' work, to aim for the reading portion of the job.

This is where AI-assisted refactoring comes into its own. It shifts the effort: less time spent "discovering" the system, more time devoted to design, architecture choices, relevant testing and robustness. Used methodically, it accelerates the integration of legacy features while reinforcing best practices (traceability, testing, targeted refactoring).

 

AI as the architect of legacy systems

In a legacy context, the challenge is not simply to "make a feature work", but to insert it in the right place, with the minimum collateral impact. It is precisely in this preparation phase, which is often long, uncertain and undervalued, that AI can become a powerful gas pedal in our daily lives. Rather than replacing a senior developer's analysis, AI serves here as an investigative co-pilot: it helps transform a dense codebase into exploitable elements. The aim is simple: reduce ambiguity before touching the code, and produce a shared vision of what will change, where and what risks are associated with it.

 

Analyze historical code to identify intent

AI excels at structure recognition, making it particularly well-suited to the analysis of dense legacy code.

Part of the complexity comes from the fact that code rarely "explains" why. AI can therefore assist with tasks such as :

  • summarizing the role of a module, class or set of files ;
  • proposing a functional reading (e.g. "this component calculates X, applies Y, then publishes Z");
  • identify conventions, local patterns and areas of high technical debt.

This first level is not a definitive diagnosis but a way to get started more quickly: you reduce the time spent navigating blindly and prepare more pertinent questions for reviews and workshops. Where manual analysis is costly, AI can help build a workable map:

  • direct and indirect dependencies (imports, calls, events, messages, jobs, triggers) ;
  • actual entry points (API, batch, UI, message consumers);
  • radiating" components that impact many things, and "sensitive" components (high instability, historical bugs, weak tests).

 

Reveal the implicit architecture (the one that really exists)

In legacy systems, the "official" architecture is sometimes obsolete or incomplete. By slicing up code, flows and usages, AI can help make visible :

  • real boundaries between domains (or their absence) ;
  • hidden couplings, circular dependencies, "services" that are no longer really services;
  • implicit invariants (dispersed business rules, replicative validations, historical behaviours).

The point is not to redo the architecture at this stage, but to know where you're going before adding a brick.

 

Generate integration plan hypotheses

Once the area is understood, the AI can propose an integration plan in the form of hypotheses:

  • implementation scenarios (extension point A vs. B, new abstraction vs. minimal adaptation) ;
  • targeted refactorings to reduce risk (function extraction, DB access isolation, duplication removal);
  • list of expected impacts (modules affected, contracts to be respected, major risks).

These proposals should be treated as options to be validated, not as automatic decisions. The value is to arrive more quickly at a structured discussion on trade-offs, risks, and deployment strategy. Better technical preparation is only useful if it leads to a strategic plan for the team and concrete results: fewer incidents, higher quality and more features delivered quickly.

 

Back in the field: navigating a multi-directory legacy .NET ecosystem

In a recent assignment, we had to integrate new features into a .NET ecosystem spread across several repositories, without centralized documentation and with implicit dependencies between systems, notably for billing and bill-of-materials generation. The business logic was fragmented across services that assumed one another without explicit contracts.

Added to this was an additional layer of complexity: part of the system was still based on PowerBuilder, a 90s technology whose syntax and paradigms are alien to most modern developers. Rather than dive straight into the code, we used AI to build up an initial map: which modules were involved in the billing cycle, which events triggered the generation of the bill of materials, where the calculation rules were and what state the test coverage was in. In just a few hours, we had an overview that would normally have required several days of manual exploration and interviews with the teams.

This preparatory work enabled us to identify two high-risk areas before even writing a line of code, and to design a targeted integration plan with appropriate safeguards. The result: a regression-free delivery on a system that nobody in the team had fully mastered at the outset.

 

Concrete benefits and enhanced quality

Used correctly, artificial intelligence enables us to considerably improve the productivity of our development teams, while enhancing the quality of the code delivered and its durability over time. What's more, it improves the quality of developers' decisions and the robustness of their solutions, which is often more important than "raw" improved performance.

 

More effects, more predictability

In legacy systems, most surprises arise from implicit dependencies and historical behaviour. AI-assisted preparation makes it possible to :

  • better target risk areas ;
  • define safeguards (tests, feature flags, instrumentation) before making changes;
  • Explain assumptions ("if we change X, then Y must remain true").

AI doesn't guess at anything; that said, it makes hard-to-notice factors visible, enabling us to better understand the current state of affairs before creating added value.

 

Faster cycles without systematic compromise on quality

Time savings are primarily achieved in high-friction activities such as initial understanding, code exploration, identifying potential impacts, and preparing a relevant test or implementation plan. The expected result is a reduction in the time required for preparation and exploration, leading to better continuity across analysis → design → implementation → validation.

That said, it's vital to remember that AI tools should not replace our reasoning. Experimenting and discovering through trial and error lead us to superior mastery of the domain and the code, and guarantee the sustainability of development. We can use it to validate our hypotheses and speed up refactoring, while using our judgment to prioritize hot spots and secure manipulations likely to generate bugs or regressions.

 

AI at the service of best practice (and not the other way round)

The key point on the engineering side is to avoid the "copy-paste suggestions" effect. In a mature approach, AI reinforces already sound practices:

  • Risk-oriented testing: we prioritize identified critical scenarios.
  • More efficient code review: we arrive with documented hypotheses and impacts.
  • Targeted refactoring : Small structural improvements that enhance features and reduce debt.
  • Lively documentation: Diagrams, summaries, decisions (ADRs) produced.

In other words, AI is used to industrialize preparation, but quality remains driven by engineering standards, such as validation, traceability and delivery discipline. Several refactoring tools have been added to the devs' toolbox over the years, and LLMs are the latest. They automate code extraction and the introduction of design patterns, such as the strategy pattern, which comes in very handy in older codebases.

 

In conclusion

Legacy systems are not just old code; they are critical platforms, rich in business rules, but whose evolution is slowed down by incomprehension and uncertainty. In this context, AI should not be seen as a magic wand, but as a preparation tool: it accelerates understanding, makes complexity more visible and helps to draw up more secure integration plans. The most tangible value comes when AI is used in conjunction with an engineering discipline: risk-oriented testing, structured code reviews, targeted refactoring. The benefits are twofold: accelerated delivery and a reduction in costly surprises. This lays a solid foundation for progressive modernization.

If your challenge is to add features without weakening the existing system, the approach is to start by preparing the ground: mapping, clarifying, securing, and only then implementing. This is exactly where AI, when used methodically and with critical judgment, becomes a competitive advantage for upgrading a legacy system with quality. Let's talk about your next legacy feature: we can combine our software expertise, quality requirements and pragmatic AI to accelerate your modernization and feature delivery, while ensuring greater predictability.