logoalt Hacker News

equinumerous • today at 9:58 PM • 1 reply • view on HN

How do you avoid the spaghetti code that (in my experience) most AI models spit out? Sure you can steer it, ask it to make it better, etc... but it's easier to me to be in the driver's seat. Doesn't mean AI isn't useful, but whenever AI designs a feature end-to-end, everything is tightly-coupled, the wrong abstractions are picked, and fundamentally the code is not optimized for human understanding. I don't really understand how people can tolerate this kind of code (assuming they read it, which I think they do not). Just take the Claude Code CLI as an example - is there anyone in the world that knows how that spaghetti machine works?

I agree that AI is very useful in reviewing PRs and searching for bugs. It's definitely a game-changer there. But a human still needs to understand the code and take responsibility for it.


Replies

atworknow • today at 10:05 PM

>How do you avoid the spaghetti code

You don't. This is demonstrated by

>Claude Code CLI ... is there anyone in the world that knows how that spaghetti machine works

Having a very active, and happy user base.

Now this a simplistic view, and I think even heavily AI first dev teams still glance at the diff to make sure things aren't going too awry or ask questions. But the concept "spaghetti code" and "optimized for human understanding" are assumptions being revisited entirely in 2026.

➕ show 1 reply