
An LLM Broke My Architecture in One Generation. I Made That a Build Error
How custom detekt rules, specialized AI agents, and specification-driven development keep Clean Architecture intact — even when an LLM writes the code. Part 4 — ← Part 1: Clean Architecture in Kotlin | ← Part 2: Your Tests Are Slow Because Your Architecture Has No Seams | ← Part 3: I Swapped the Database Client and Added GraphQL. The Domain Never Noticed. The moment an LLM broke the architecture I asked an AI coding assistant to add a new use case to the application layer. It wrote the code in under a minute. It also added @Service to the class, imported org.springframework.stereotype.Service , and threw an IllegalArgumentException for invalid input. Three architecture rules broken in a single generation. The same rules that Part 1 spent 2,000 words establishing. LLMs are fast. They're also statistically inclined to produce the most common pattern they've seen — and in the Kotlin ecosystem, that's Spring annotations on everything, exceptions for error handling, and no concept of layer
Continue reading on Dev.to
Opens in a new tab


