Be intentional about how AI changes your codebase

benswerd 97 points 36 comments March 19, 2026
aicode.swerdlow.dev · View on Hacker News

Discussion Highlights (11 comments)

benswerd

I've seen a lot of people talking about how AI is making codebases worse. I reject that, people are making codebases worse by not being intentional about how their AI writes code. This is my take on how to not write slop.

mrbluecoat

..but unintentional AI (aka Modern Chaos Monkey) is so much more fun!

ChrisMarshallNY

Because of the way that I use AI, I am constantly looking at the code. I usually leave it alone, if I can; even if I don't really like it. I will, often go back, after the fact, and ask for refactors and documentation. It works. Probably a lot slower than using agents, but I test every step, and it is a lot faster than I would do it, unassisted.

clbrmbr

Page not rendering well on iPhone Safari. Good content tho!

gravitronic

*adds "be intentional" to the prompt* Got it, good idea.

abcde666777

My intentionality is that I'll never let it make the changes. I make the changes. I might make changes it suggests, but only upon review and only written with my hands.

mattacular

Code cannot and should not be self documenting at scale. You cannot document "the why" with code. In my experience, that is only ever used as an excuse not to write actual documentation or use comments thoughtfully in the codebase by lazy developers.

AgentOrange1234

"Every optional field is a question the rest of the codebase has to answer every time it touches that data," This is a beautiful articulation of a major pet peeve when using these coding tools. One of my first review steps is just looking for all the extra optional arguments it's added instead of designing something good.

ares623

What if it's not _my_ codebase?

xiaolu627

What changed for me isn’t that AI writes bad code by default, but that it lowers the friction to adding code faster than the team can properly absorb it. The dangerous part is not obvious bugs, it’s subtle erosion of consistency.

earljwagner

The concepts of Semantic Functions and Pragmatic Functions seem to be analogous to a Functional Core and Imperative shell (FCIS): https://testing.googleblog.com/2025/10/simplify-your-code-fu... The key insight of FCIS is that complicated logic with large dependencies leads to a large test suite that runs slowly. The solution is to isolate the complicated logic in the functional core. Test that separately from the simpler, more sequential tests of the imperative shell.

Semantic search powered by Rivestack pgvector
3,471 stories · 32,344 chunks indexed