Shopify's AI agents demanded clean code, forcing a 200-service rewrite
Curated by the Inblix editorial team
Shopify just learned something that should humble every engineer who’s ever shipped spaghetti code and prayed: AI agents are pickier than your most pedantic code reviewer. The e-commerce giant spent two years decomposing a monolithic 28,000-line Node.js service into 200 smaller, well-defined modules — not because developers wanted to, but because their AI coding tools kept choking on the mess.
The trigger wasn’t a grand architectural vision. It was failure. When Shopify turned AI agents loose on their codebase to handle routine tasks like dependency updates and API migrations, the agents couldn’t navigate the tangled logic. “The agents would just fail silently or produce incorrect outputs because they couldn’t understand the implicit contracts baked into the monolith,” said Simon Eskildsen, a director of engineering at Shopify, in a post detailing the effort. So the team did what any rational organization would do: they redesigned their entire system around the limitations of their tools.
That’s the quiet shift nobody’s talking about. For years we’ve asked how AI will change software. The real answer might be that AI won’t adapt to our code — our code will adapt to AI. Shopify’s new architecture leans hard into explicit interfaces, small files with single responsibilities, and comprehensive test coverage. The kind of things you’re supposed to do anyway but never quite get around to. The agents, it turns out, thrive on clarity. They want contracts they can parse, boundaries they can see, and feedback loops that tell them when they’ve screwed up.
There’s a broader pattern emerging. Google’s internal research showed that AI-assisted code reviews catch different classes of bugs than humans do, but only when the codebase is structured for machine readability. Meta has been quietly enforcing stricter typing across their Python monorepo for similar reasons. The lesson from Shopify isn’t that AI agents are magic — it’s that they expose every shortcut you’ve ever taken. If you’re sitting on a legacy monolith and hoping AI will clean it up for you, don’t hold your breath. The agents will just stare at it blankly, same as you do.
💡 Key Takeaways
- AI coding agents fail silently on monolithic codebases because they can't infer implicit contracts, forcing human teams to restructure code around machine readability.
- Shopify decomposed a single 28,000-line service into 200 modules with explicit interfaces, comprehensive tests, and single responsibilities specifically to accommodate AI tools.
- Google and Meta are independently moving toward stricter typing and cleaner architecture because AI-assisted development works dramatically better on well-structured codebases.
Keep reading: See related articles below for more coverage on this topic.
Get smarter about AI
The sharpest AI news, curated daily. Delivered free to your inbox.