Syed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer Shah — home
● MenuAHMERAHMER
20+Certificates
PHPMERNMySQLSEO

Explore

01About→02Education→03Certificates→04Skills→05Projects→06Services→07Testimonials→08Contact→

Pages

01Blog→02Saved articles→03Privacy Policy→04Terms of Service→
Interface sound
Hire me →

Available for new work · --:--:-- PKT

Have an idea?

support@ahmershah.dev
Book a call WhatsApp +92 370 4831994

On this site

  • 01About
  • 02Education
  • 03Certificates
  • 04Skills
  • 05Projects
  • 06Services
  • 07Testimonials
  • 08Contact

Pages

  • Blog
  • Saved articles
  • RSS
  • Privacy Policy
  • Terms of Service
  • llms.txt

Elsewhere · official profiles

26 links

Professional

Work history, code and credentials.

  • in/syedahmershah
  • company/syedahmershah
  • @ahmershahdev
  • syed-ahmer-shah
  • syed-ahmer-shah
  • u/syedahmershah
  • @syedahmershah
  • AWS@syedahmershah

Coding & credentials

Problem solving, verified badges.

  • u/syedahmershah
  • syedahmershah
  • users/syedahmershah
  • learner/syedahmershah

Google & business

The official listings.

  • Google Business Profileg.page
  • Syed Ahmer Shah
  • syedahmershah
  • Beaconssyedahmershah
  • syedahmershah

Social (@ahmershahdev)

Build logs, clips, threads.

  • @ahmershahdev
  • @ahmershahdev
  • @ahmershahdev
  • ahmershahdev
  • @ahmershahdev
  • @bluesky.ahmershah.dev
  • ahmershahdev

Design

Interfaces and visuals.

  • syedahmershah
  • syedahmershah

Direct

  • support@ahmershah.dev

    Support & projects

  • syedahmershahofficial@gmail.com

    Personal

  • +92 370 4831994

    Phone · WhatsApp

  • Hyderabad, Sindh, Pakistan

    Remote-first · Asia/Karachi (UTC+5)

Résumé ↗
SYED AHMER SHAH

© 2026 Syed Ahmer Shah. All rights reserved.

PrivacyTermsRSS
Syed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer Shah — home
● MenuAHMERAHMER
20+Certificates
PHPMERNMySQLSEO

Explore

01About→02Education→03Certificates→04Skills→05Projects→06Services→07Testimonials→08Contact→

Pages

01Blog→02Saved articles→03Privacy Policy→04Terms of Service→
Interface sound
Hire me →

Available for new work · --:--:-- PKT

Have an idea?

support@ahmershah.dev
Book a call WhatsApp +92 370 4831994

On this site

  • 01About
  • 02Education
  • 03Certificates
  • 04Skills
  • 05Projects
  • 06Services
  • 07Testimonials
  • 08Contact

Pages

  • Blog
  • Saved articles
  • RSS
  • Privacy Policy
  • Terms of Service
  • llms.txt

Elsewhere · official profiles

26 links

Professional

Work history, code and credentials.

  • in/syedahmershah
  • company/syedahmershah
  • @ahmershahdev
  • syed-ahmer-shah
  • syed-ahmer-shah
  • u/syedahmershah
  • @syedahmershah
  • AWS@syedahmershah

Coding & credentials

Problem solving, verified badges.

  • u/syedahmershah
  • syedahmershah
  • users/syedahmershah
  • learner/syedahmershah

Google & business

The official listings.

  • Google Business Profileg.page
  • Syed Ahmer Shah
  • syedahmershah
  • Beaconssyedahmershah
  • syedahmershah

Social (@ahmershahdev)

Build logs, clips, threads.

  • @ahmershahdev
  • @ahmershahdev
  • @ahmershahdev
  • ahmershahdev
  • @ahmershahdev
  • @bluesky.ahmershah.dev
  • ahmershahdev

Design

Interfaces and visuals.

  • syedahmershah
  • syedahmershah

Direct

  • support@ahmershah.dev

    Support & projects

  • syedahmershahofficial@gmail.com

    Personal

  • +92 370 4831994

    Phone · WhatsApp

  • Hyderabad, Sindh, Pakistan

    Remote-first · Asia/Karachi (UTC+5)

Résumé ↗
SYED AHMER SHAH

© 2026 Syed Ahmer Shah. All rights reserved.

PrivacyTermsRSS
Syed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer ShahSyed Ahmer Shah — home
● MenuAHMERAHMER
20+Certificates
PHPMERNMySQLSEO

Explore

01About→02Education→03Certificates→04Skills→05Projects→06Services→07Testimonials→08Contact→

Pages

01Blog→02Saved articles→03Privacy Policy→04Terms of Service→
Interface sound
Hire me →
← Engineering Logs

Stop Writing Code AI Agents Can't Read

Why messy architecture and weak typing are the absolute fastest ways to break your automated development workflows.

Written by

Syed Ahmer Shah

Software Engineer

Jun 14, 2026Updated Jun 19, 20269 min read2,069 wordsOriginally on DEV—reading now▼
Read this articlevoice
Markdown

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 every single day. GitHub Copilot, Cursor, Claude, whatever. We let the AI generate entire functions for us. We prompt it to refactor our components, debug our APIs, write our tests.

And yet, somehow, the code we feed back into those same AI agents is a mess that confuses them completely.

I noticed this in one of my own projects a few months back. I was building a full-stack app — Node/Express on the backend, React on the frontend — and I asked Cursor to help me trace a bug through three files. The AI just... gave up halfway. It kept referencing variables that didn't exist, confused one function's output with another's, and confidently wrote code that broke things even worse.

At first I blamed the model. Then I looked at my code.


#The Problem Nobody's Talking About

We've spent years writing code for ourselves. Or for teammates who will hop on a call if something's unclear. Or for future-us who will eventually remember what we meant.

But AI agents don't have that luxury. They don't ask questions mid-read (well, the good ones try, but there's limits). They parse your code with a context window — a fixed amount of tokens they can "see" at once — and they try to infer everything from that snapshot.

If your code is ambiguous to a human reading it cold, it's invisible to an AI agent trying to reason about it.

As of early 2026, models like Claude Sonnet and GPT-4o have context windows of 200k-450k tokens. That sounds like a lot. But a production codebase? Hundreds of files. Thousands of dependencies. Layers of abstraction. No AI agent sees all of it at once.

So when you ask Cursor to fix a bug that spans four files, it's reasoning under partial information. Your naming, your structure, your comments — all of that becomes the difference between the agent understanding your intent or hallucinating its way through your codebase.


#What "AI-Readable" Actually Means

Before I get into the specifics, let me be clear: I'm not saying you should write code for AI. That's backwards. Good code is good code. What I'm saying is that the things which make code readable to a tired human at 2am are the exact same things that make code readable to an AI agent working with limited context.

AI-readable code is just... good code. We forgot how to write it.


#The Sins We're All Guilty Of

#1. Variable Names That Mean Nothing

This one's embarrassing because we all know better.

javascript
// this is what my code actually looked like last year
const d = await fetchData(u);
const r = process(d);
return r.f.map(x => x.v * x.m);

What is d? What's u? What's f? What the hell is v * m?

I know what it means. I wrote it. But if I paste this into an AI agent and ask it to add error handling, it has to guess what everything represents. And it will guess wrong. Or rather — it will guess confidently and write broken code.

Compare that to:

javascript
const userData = await fetchUserProfile(userId);
const processedUser = normalizeUserData(userData);
return processedUser.friends.map(friend => friend.views * friend.multiplier);

Now an AI agent can reason about this. It knows normalizeUserData probably returns something predictable. It knows friends is an array. It can infer what .views and .multiplier are about. Error handling writes itself almost.

#2. Functions Doing Way Too Much

I had a function called handleSubmit in a React component. It was 180 lines long. It validated form data, made an API call, updated three different state variables, dispatched a Redux action, logged to analytics, and conditionally redirected the user.

When I asked Claude to help me add loading state to it, the response was almost hilariously wrong. It added setLoading(true) in four different places because it literally couldn't track the flow.

The fix:

javascript
// before: one 180-line monster
async function handleSubmit(e) { ... }

// after: broken down properly
async function handleSubmit(e) {
  e.preventDefault();
  
  const validationError = validateFormData(formState);
  if (validationError) return setError(validationError);

  setLoading(true);
  
  try {
    const result = await submitUserForm(formState);
    trackFormSubmission(result.userId);
    redirectToOnboarding(result.userId);
  } catch (err) {
    setError(err.message);
  } finally {
    setLoading(false);
  }
}

Now every sub-function has a single job. An AI agent can understand, modify, or extend any one of them without needing to understand the rest of the 180-line mess.

#3. Magic Numbers Everywhere

python
# what does 86400 mean here?
if time_diff > 86400:
    send_reminder_email(user)

I've seen this in so many codebases. Including ones I wrote. The AI has no idea that 86400 is seconds in a day. It might assume it's a timeout value, a database ID limit, a file size — anything.

python
SECONDS_IN_A_DAY = 86400

if time_since_last_login > SECONDS_IN_A_DAY:
    send_reminder_email(user)

Now it's obvious. To a human. To an AI. To you when you come back in three months.

#4. Missing or Useless Comments

Two kinds of bad comments:

javascript
// no comments at all (bad)
async function sync(items, flag) {
  if (flag) return items.filter(i => i.s === 'a');
  return await bulkUpdate(items);
}
javascript
// completely useless comments (somehow worse)
// this function syncs items
async function sync(items, flag) {
  // filter items if flag is true
  if (flag) return items.filter(i => i.s === 'a');
  // otherwise update
  return await bulkUpdate(items);
}

Neither of these help an AI agent understand why this logic exists, what edge cases it handles, or what flag represents.

javascript
/**
 * Syncs inventory items with the database.
 * 
 * @param {Array} items - Array of product objects from the frontend
 * @param {boolean} dryRun - If true, returns filtered items without persisting (used in preview mode)
 * @returns {Array|Promise} - Filtered items (dry run) or DB update result
 * 
 * Note: items with status 'a' (archived) are excluded from live syncs
 */
async function syncInventoryItems(items, dryRun = false) {
  if (dryRun) return items.filter(item => item.status === 'archived');
  return await bulkUpdateInventory(items);
}

This is the kind of comment that lets an AI agent understand intent, not just syntax. Big difference.

#5. Inconsistent Patterns Across Files

This is a subtle one but it absolutely kills AI agents.

In one file you do:

javascript
const { data, error } = await supabase.from('users').select('*');

In another:

javascript
const response = await api.get('/users');
const users = response.data.users;

In another:

javascript
fetchUsers().then(setUsers).catch(console.error);

Three different async patterns. Three different error handling approaches. Three different ways to store the result. When an AI agent is trying to understand your app's data flow, this inconsistency forces it to treat every file as a fresh puzzle with no assumptions it can carry over.

Pick a pattern. Use it everywhere. Your team will thank you. The AI will thank you. Future-you will thank you.


#A Real Scenario: Debugging with Claude

Let me tell you what happened to a classmate of mine (we're both studying Software Engineering and he was working on his semester project).

He had a Node.js backend, pretty standard REST API. Something was wrong with his authentication middleware. He pasted the auth file into Claude and asked what was wrong.

Claude responded with something like:

"It looks like your verifyToken function is using req.headers.authorization, but your middleware in the routes file may be expecting the token in a different format..."

Except the routes file wasn't pasted. Claude was inferring from the auth file that there was probably a routes file doing something with the token. It was making educated guesses — and sometimes they were right, sometimes totally off.

When my classmate cleaned up his auth file — better naming, clearer structure, a comment explaining the expected header format — and pasted it again, Claude immediately identified the actual bug: he was calling next() before the token was fully validated.

Same model. Same Claude version. Different code quality. Totally different result.


#The 2026 Context: Why This Matters More Than Ever

According to the Stack Overflow Developer Survey 2025, around 76% of developers were already using or planning to use AI tools in their development process. By 2026, that number's almost certainly higher — adoption isn't slowing down.

GitHub Copilot crossed 1.8 million paid subscribers as of mid-2024, and Cursor reportedly onboarded over a million active users within months of gaining traction. These tools are deeply embedded in how we code now.

But here's the thing: these tools are also getting more agentic. They're not just autocompleting lines anymore. They're:

  • Running multi-step tasks across your codebase

  • Writing and executing tests automatically

  • Making PRs, reviewing diffs, suggesting refactors

  • Debugging by reading logs and tracing through files

The more autonomous these agents become, the more your code quality becomes a dependency of their success. You are, in a real sense, writing code that AI will read, execute, and modify — not just suggest.

If your code is unreadable, your AI agent is flying blind.


#Quick Wins: What You Can Start Doing Today

Here's the stuff that actually moved the needle for me:

On naming:

  • Functions should be verbs: getUserById, validateEmailFormat, sendWelcomeEmail

  • Booleans should be questions: isLoggedIn, hasPermission, shouldRedirect

  • Arrays should be plural nouns: userIds, selectedProducts, pendingOrders

On functions:

  • One function, one job. Seriously. Name it after what it does. If the name needs "and" in it, split it.

  • Aim for functions under 30 lines. Not a hard rule but a good gut-check.

On comments:

  • Comment the why, not the what. The what is visible in the code. The why usually isn't.

  • Use JSDoc or Python docstrings. Not because tooling needs them (though it helps), but because it forces you to explain the function in a single sentence.

On structure:

  • Keep related code close together. An AI agent given one file should be able to understand its purpose without needing three others.

  • Export types/interfaces alongside the functions that use them.

On consistency:

  • Write a simple conventions doc for yourself (or your team). Even three rules are better than none.

  • When you pick an async pattern, stick to it. When you pick a naming convention, stick to it.


#The Downside: Don't Overdo It

I'll be honest — there's a risk of going too far with this.

  • Over-commenting creates noise. If every line has a comment, nothing stands out.

  • Excessive abstraction can make code harder to follow, not easier. Splitting a 30-line function into ten 3-line functions sometimes just creates a maze.

  • Obsessing over naming can lead to ridiculously long variable names that break line length and readability.

Balance is real. The goal isn't to make your code perfect for AI — it's to make your code good. Good code happens to work well with AI agents because good code has clear intent, single responsibility, and honest documentation.

Don't write for the AI. Write clearly. Those end up being the same thing.


#One Last Thing

There's a quote I keep coming back to from Martin Fowler:

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

He wrote that in 1999. But in 2026, I'd add a corollary:

Good programmers write code that humans and AI agents can understand — because the tools that help you ship are only as useful as the code they can reason about.

Your codebase is your context. Make it readable.


#References & Sources

  • Stack Overflow Developer Survey 2025 — AI tool adoption among developers

  • GitHub Copilot — 1.8M subscribers — subscriber milestone reporting

  • Cursor — AI Code Editor — agentic coding tool

  • Martin Fowler, Refactoring (1999) — on code clarity

  • Anthropic Claude Context Windows — model specs 2026

  • OpenAI GPT-4o Technical Details — context window and capabilities

  • Clean Code by Robert C. Martin — naming, functions, comments

  • The Pragmatic Programmer — general software craft

Originally published

This article first appeared on DEV. That copy is the canonical one; this is the same piece, kept on my own site.

Also onHashnode ↗

Find me across the web.

Same person, every platform

Work & code

  • ASPortfolioahmershah.dev
  • LinkedInin/syedahmershah
  • GitHub@ahmershahdev
  • AWSAWS Builder Center@syedahmershah
  • Crunchbasesyed-ahmer-shah
  • LinkedIn · Companycompany/syedahmershah

Writing

  • Dev.tosyedahmershah
  • Medium@syedahmershah
  • Hashnode@syedahmershah
  • Substack@syedahmershah
  • HackerNoonu/syedahmershah
  • CLCoderLegionuser/syedahmershah

Reviews & listings

  • Google Knowledge PanelSyed Ahmer Shah
  • Google Business Profileg.page
  • ClClutch
  • TpTrustpilot
  • DRDesignRush
  • TBTechBehemoths

Social

  • YouTube@ahmershahdev
  • Instagram@ahmershahdev
  • TikTok@ahmershahdev
  • Facebookahmershahdev
  • X@ahmershahdev
#syedahmershah#coding#programmingblogs#technology#webdevelopment#artificialintelligence#javascript
ShareXLinkedInRedditWhatsApp

← Older

Fable 5 Pwned: Inside the First Mythos-Class Leak

Newer →

AI Writes Code. It Doesn't Do Engineering.

On this page

  • The Problem Nobody's Talking About
  • What "AI-Readable" Actually Means
  • The Sins We're All Guilty Of
  • 1. Variable Names That Mean Nothing
  • 2. Functions Doing Way Too Much
  • 3. Magic Numbers Everywhere
  • 4. Missing or Useless Comments
  • 5. Inconsistent Patterns Across Files
  • A Real Scenario: Debugging with Claude
  • The 2026 Context: Why This Matters More Than Ever
  • Quick Wins: What You Can Start Doing Today
  • The Downside: Don't Overdo It
  • One Last Thing
  • References & Sources

Up next

Keep reading.

All 44 articles→
  1. 01

    Change One Number. Take Everything.

    IDOR affects 94% of apps. Learn how changing one URL number exposes millions of records & how to build bulletproof defenses. | Syed Ahmer Shah

    Aug 11, 20269 minThe Engineering LogsFirst on Hashnode

  2. 02

    I Tested 8 Best AI Design Tools for UI/UX with the Same Prompt

    I gave Flowstep, Stitch, Base44, Bolt, Replit, v0, Lovable & Figma Make the same UI prompt. Here's how their design quality and code actually compare.

    Jul 27, 20269 minAI vs RealityFirst on Hashnode

  3. 03

    The Anatomy of AI: Deconstructing the "Brain" Into Vectors and Math

    Syed Ahmer Shah deconstructs AI vectors, transformers, RAG, diffusion models, Claude Code leak, data training ethic. The complete technical breakdown.

    Jul 17, 20269 minAI vs RealityFirst on Hashnode

Available for new work · --:--:-- PKT

Have an idea?

support@ahmershah.dev
Book a call WhatsApp +92 370 4831994

On this site

  • 01About
  • 02Education
  • 03Certificates
  • 04Skills
  • 05Projects
  • 06Services
  • 07Testimonials
  • 08Contact

Pages

  • Blog
  • Saved articles
  • RSS
  • Privacy Policy
  • Terms of Service
  • llms.txt

Elsewhere · official profiles

26 links

Professional

Work history, code and credentials.

  • in/syedahmershah
  • company/syedahmershah
  • @ahmershahdev
  • syed-ahmer-shah
  • syed-ahmer-shah
  • u/syedahmershah
  • @syedahmershah
  • AWS@syedahmershah

Coding & credentials

Problem solving, verified badges.

  • u/syedahmershah
  • syedahmershah
  • users/syedahmershah
  • learner/syedahmershah

Google & business

The official listings.

  • Google Business Profileg.page
  • Syed Ahmer Shah
  • syedahmershah
  • Beaconssyedahmershah
  • syedahmershah

Social (@ahmershahdev)

Build logs, clips, threads.

  • @ahmershahdev
  • @ahmershahdev
  • @ahmershahdev
  • ahmershahdev
  • @ahmershahdev
  • @bluesky.ahmershah.dev
  • ahmershahdev

Design

Interfaces and visuals.

  • syedahmershah
  • syedahmershah

Direct

  • support@ahmershah.dev

    Support & projects

  • syedahmershahofficial@gmail.com

    Personal

  • +92 370 4831994

    Phone · WhatsApp

  • Hyderabad, Sindh, Pakistan

    Remote-first · Asia/Karachi (UTC+5)

Résumé ↗
SYED AHMER SHAH

© 2026 Syed Ahmer Shah. All rights reserved.

PrivacyTermsRSS