← Back to Blog

Code Is Still a Liability (Even When AI Writes It)

Code Is Still a Liability (Even When AI Writes It)

Code has always been a liability. Every line you write is a line you have to test, maintain, secure, and eventually debug.

For years, the best engineers prided themselves on writing less code. The most satisfying pull requests were always the ones with a net-negative line count.

But AI has fundamentally changed the economics of software development. Generating 1,000 lines of code used to take days; now it takes seconds. And if we’re increasingly asking AI to read, maintain, and debug our code for us, it raises a valid question:

If an AI is doing the heavy lifting of debugging, does it actually matter if a feature takes 10 lines or 1,000 lines?

The short answer is yes. In fact, code minimalism is more critical in the age of AI than it was before. Here is why.

1. Context Windows Are the New Bottleneck

When a human debugging a complex system gets stuck, they can hold a limited amount of context in their head. AI has a similar constraint: the context window.

If you have a 1,000-line “God class” full of boilerplate and convoluted logic, feeding that into an LLM to find a bug consumes a massive amount of its attention capacity. The AI has to wade through the noise to find the signal.

Ten lines of elegant, well-architected code take up negligible context space. This leaves room in the prompt to include documentation, expected behavior, and system architecture. When the codebase is bloated, the AI gets overwhelmed, leading to degraded performance and higher hallucination rates.

2. The “Blast Radius” of AI Hallucinations

AI coding assistants are brilliant, but they are confident even when they are wrong.

When you ask an AI to fix a bug in a 1,000-line file with tangled dependencies, it might successfully fix the bug—but silently break three other things by misunderstanding a side effect. The larger the code surface area, the larger the blast radius for an AI hallucination.

With smaller, isolated components (10 lines instead of 1,000), the blast radius is contained. It is much easier for an AI to reason about a pure function with no side effects than it is to untangle spaghetti code.

3. The Human Review Burden Shifts

We aren’t at the point where AI writes, tests, and deploys code completely unsupervised in critical production environments. Humans still have to review the work.

AI makes writing code cheap, but it makes reviewing code expensive.

If an AI generates 1,000 lines of logic to solve a problem that could have been solved in 10, a human engineer still has to verify that those 1,000 lines are secure and correct. The mental fatigue of reviewing AI-generated code is immense. If the code is concise, the human reviewer can actually validate it. If it’s bloated, they will skim it, approve it, and push a vulnerability to production.

4. Prompting is Easier When Code is Clean

Think about how you interact with an AI assistant.

Which prompt is more likely to yield a correct, working result?

  • “Here is our 2,000-line billing controller. Users are being double-charged sometimes. Fix it.”
  • “Here is the 15-line calculateInvoiceTotal function. It is returning the wrong value for discounted items. Fix it.”

Clean, modular code allows you to ask the AI precise, scoped questions. Bloated code forces you to ask broad, ambiguous questions.

The New Role of the Engineer

AI hasn’t eliminated the need for clean code; it has just shifted where we spend our energy.

Our job is no longer to be human compilers, typing out syntax. Our job is to be the architects of the system. We define the boundaries, enforce the simplicity, and ensure that the codebase remains small enough, and modular enough, that both humans and AI can reason about it effectively.

Code is still a liability. AI just lets you accumulate that liability a hundred times faster. Guard your codebase accordingly.