DEV Community

Cover image for Stop Writing Code AI Agents Can't Read

Stop Writing Code AI Agents Can't Read

Syed Ahmer Shah on June 14, 2026

okay so this is gonna sound ironic. maybe even a little embarrassing. Most of us — and yes, I'm including myself here — use AI tools to write code...
Collapse
 
syedfarzeen profile image
Ganjkar Bhai

The irony is real: AI is forcing us to return to fundamental Clean Code principles that we should have been following all along. Descriptive names and short functions are no longer 'nice-to-haves'—they are functional requirements for AI collaboration.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Well said, Sagar. It’s an interactive loop. We can't expect magical output from AI if we feed it garbage input. Clean architecture is the foundation that makes automation actually viable.

Collapse
 
syedfarzeen profile image
Ganjkar Bhai

I’ve noticed this explicitly with Cursor and Claude. If I modularize my backend controllers into single-responsibility functions, the AI fixes bugs on the first prompt. If I feed it a legacy mega-function, it just writes confidently wrong code. Separation of concerns is a superpower again.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

😂 This is brilliant and incredibly accurate. A violent psychopath might come looking for you, but an AI agent will quietly break your production DB while smiling and telling you it successfully completed the task. That's a whole new level of horror.

Collapse
 
farzeenai profile image
Aley

This is the real evolution of the 'Developer' role. We are transitioning from raw code writers to context managers and system architects. If you can't provide clear context through your code structure, you can't leverage AI effectively.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

100% Tahir. A huge context window is just a larger bucket; if you fill it with muddy water, you still get mud. Attention mechanisms degrade when forced to parse massive, deeply nested spaghetti functions. 'Lost in the middle' is a very real problem for codebases.

Collapse
 
farzeenai profile image
Aley

Interesting take. If AI readability becomes a standard metric, I wonder if we’ll see linters in the future specifically designed to score code based on 'LLM comprehension probability' before it's pushed to a repo.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Exactly. The critic has changed from a pedantic senior dev at a 10 AM code review to a confidently incorrect AI model hallucinating dependencies at 3 AM. The rules of Clean Code are exactly the same, but the feedback loop is terrifyingly faster now.

Collapse
 
farzeendev profile image
Sagar Kumar

Reminds me of the saying: 'Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.' Now, replace 'violent psychopath' with 'an AI agent that will happily hallucinate a breaking change in production.'

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Perfectly articulated, Aley. The modern developer is becoming an editor and an orchestra conductor. If you feed the AI bad context, you get bad music. Prompt engineering isn't just about what you type into the chat box; it's about how you structure your entire project repository.

Collapse
 
farzeen profile image
Tahir

This is such a crucial shift in mindset. We used to write clean code to survive code reviews with colleagues, but now we're writing clean code so our AI pair programmers don't hallucinate a ghost variable at 3 AM. The standards haven't changed, but the stakes definitely have

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

This is a fascinating prediction! I could absolutely see a future where CI/CD pipelines have a step like npm run linter:ai-ready. If a function has too much cyclomatic complexity or poor naming conventions, the build fails because 'Expected AI Error Rate > 5%'. You might be onto a brilliant open-source tool idea here!

Collapse
 
musabsheikh profile image
Faraz

This highlights why TypeScript/strongly-typed languages feel like cheating when using AI tools nowadays. Explicit types give the agent a structural map of the data without it having to guess what d or r contains.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Explicit types act like semantic guardrails for LLMs. Instead of wasting its reasoning tokens trying to infer what d or r could possibly be, the AI can immediately focus on the actual logic. TypeScript isn't just for developer experience anymore; it’s an AI optimization tool.

Collapse
 
farzeen profile image
Tahir

The context window bottleneck is real. People think a 200k+ token window means an LLM understands their entire monolithic repo, but semantic drift happens fast when functions are hundreds of lines of spaghetti.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Haha, we've all been there! It’s the classic 'I'll fix this variable name later' trap. Consider this a safe space—just think of the refactoring as doing a favor for your future AI coworker. 😂

Collapse
 
farzeendev profile image
Sagar Kumar

Excellent points. We’ve focused so much on what AI can do for us that we forgot we need to build a stable foundation for it to work on. It’s a two-way street.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

This mirrors my experience completely! Single-responsibility functions give the AI a localized problem to solve. The moment you give it a mega-function with side effects, its reasoning splits and it defaults to confident nonsense. Separation of concerns truly is a modern superpower.

Collapse
 
faique_26 profile image
Faique

It turns out the best way to prompt an AI is actually just to write readable code in the first place. Who would've thought? 🤯

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Right?! Who knew Uncle Bob’s Clean Code was actually the ultimate prompt engineering handbook written decades ahead of its time.

Collapse
 
syedfarzeenshahofficial profile image
Vinod Oad

My AI agent when it looks at my legacy codebase: 'I can confidently say I have no idea what is going on here, but here is some code that will make it worse.' Great article, needed this wake-up call!

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

That 'confident ignorance' is the scariest part! Glad the article resonated with you. Sometimes we just need that wake-up call to realize our codebase has become a maze that even a trillion-parameter model can't navigate.

Collapse
 
syedfarzeenshahofficial profile image
Vinod Oad

So you're saying my 200-line handleSubmit function isn't 'complex engineering,' it's just an AI-confusing monster? Fair point, refactoring now...

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Haha, consider it a rite of passage, Vinod! Break that monster down into 5 smaller, pure functions and watch your AI agent suddenly become a genius. Happy refactoring!

Collapse
 
musabsheikh profile image
Faraz

I feel personally attacked by that const d = await fetchData(u) snippet. 😂 Glad to know I'm not the only one writing hieroglyphics when I think no one is looking!

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

The irony is beautiful, isn't it? We thought AI would allow us to be lazier, but it’s actually forcing us to be more disciplined. Clean Code is no longer a stylistic preference; it’s a functional requirement for the AI to do its job.

Collapse
 
faique_26 profile image
Faique

We spent years learning how to prompt the AI, only to realize our actual codebase was the worst prompt of all.

Collapse
 
syedahmershah profile image
Syed Ahmer Shah The Silicon Architect

Oof, that hits deep. 'Our actual codebase was the worst prompt of all' needs to be printed on a t-shirt.