← Articles · · 3 min read

Let AI agents handle the refactoring nobody wants to do

Migration tickets sit in backlogs forever because they're tedious, not because they're hard. That's exactly the work an agent should do.

  • agents
  • refactoring

Every engineering team has that one backlog ticket nobody touches. The migration. The framework swap. The file-by-file translation that touches a hundred files and ships zero new features. It sits there accumulating dust because the work is tedious, not because it is hard.

I am on parental leave at the moment, which is a useful vantage point for noticing where the actual drag in software work comes from. Watching my own agents from a distance, the pattern landed: if you only use AI to write new features, you are missing its biggest superpower. It is the maintenance crew for the work nobody wants to own.

Three examples from my own iOS work make the case.

ReactiveSwift to Combine

Ripping out an old reactive framework is usually a multi-week nightmare. It is embedded in every layer of the app, from the network stack to the UI. Manual translation drains a team’s energy long before the PR is ready to review.

For an agent it is a methodical mapping exercise with clear rules. SignalProducer becomes AnyPublisher. Property becomes @Published. flatMap(.latest) becomes switchToLatest(). The patterns are stable, the transformations are mechanical, the agent walks through hundreds of files without losing focus. The human role moves from typing the migration to checking it.

Sourcery to Swift Macros

We had a legacy mock-generation setup built on Sourcery. It worked for years, but it required external tools, Stencil templates, and YAML configs. The migration to native Swift Macros was sitting in the backlog because the cost of touching every generated file never quite justified the cleanup payoff to any single person.

An agent walked through it as a pure execution problem. The result is a Swift-native library with no extra config files, no template language to keep mental room for, and faster compile times as a side effect.

UIKit to SwiftUI

The biggest time sink in any legacy iOS codebase. Hundreds of screens built with AutoLayout, delegates, and imperative UI code. Rewriting by hand is slow and error-prone, and morale drains long before the project finishes.

Translating a UIViewController and its constraints into a declarative SwiftUI struct is a perfect agent task. The agent reads the layout, maps the state, generates the modern equivalent. The developer’s role shifts from grunt work to quality assurance. The output is reviewed, not written.

The strategy shift

When I am back from leave, this is the first thing I am taking to the engineering guild. We spend too much time on mindless migrations and boilerplate updates that nobody wants on their plate. The agent does not have to want it. The agent has no morale curve.

Treat AI as a maintenance crew for technical debt, not just a pair programmer for new code. The boring work does not stop existing because nobody volunteered to do it. The tools are different now. The constraint is the willingness to assign the work and review the output.