Why learn to code when AI can write it?
People keep asking why anyone should learn to code when AI can write it. My answer is that someone still has to read what it generates.

Shipped code is your code
Generated code becomes your code the moment you ship it. You are responsible for how it works, how it fails, and how hard it is to change.
When a payment fails in production or a customer sees someone else’s data, “the agent wrote it” doesn’t explain anything. Someone has to find the bug, understand why it happened, and fix it without breaking something else. You can ask the agent to help with each of those steps. You still have to decide whether its explanation is correct and whether its fix is safe to ship.
Review each change while it is small
Reading 10,000 lines of generated code is a nightmare. So don’t wait until there are 10,000 lines.
Review each change while it is small. You can read a 200-line diff line by line and understand it. A 5,000-line diff gets skimmed and approved, and whatever was wrong in it is now part of the codebase. This is the same trade-off as in my post on one-piece flow for AI coding agents. Small batches show you problems while they are still cheap to fix.
When you review, ask why the agent added code instead of changing what already exists. Say you ask it to support a new kind of discount. The pricing module already has a calculateDiscount function. The agent leaves that function alone and writes applyPromoDiscount in a new file, with its own copy of the rounding logic. Both functions pass the tests. A month later someone fixes a rounding bug in one of them, and the other one keeps charging the wrong amount.
These are the patterns I look for in a diff:
- A new helper that does the same thing as an existing helper.
- An
ifbranch that handles one specific input or one customer. - A
try/catchthat swallows an error so a test passes. - A type cast like
as anythat gets past the compiler. - A wrapper around a function where a change to the function would do.
If every feature creates another layer and every bug fix adds another workaround, something is wrong with the architecture, the instructions you gave the agent, or both. When the code has no clear place for a change, the agent creates one. When the prompt says nothing about where the logic lives, or tells the agent not to touch existing files, it writes new code next to the old code. Find out which of the two caused it. Then refactor the module or tell the agent which module owns the logic.
Code quality still matters when AI writes the code
Clear modules and clear interfaces help people understand the system. They also help coding agents find the right place to make a change.
A coding agent learns a codebase the way a new developer does. It searches for names, opens files, and reads until it knows enough to make the change. If all the pricing logic lives in one module with a small interface, a search for “discount” leads the agent there, and it changes that module. If pricing is spread across a controller, two helpers and a database trigger, the agent reads some of those files, misses the others, and writes its own version of the logic it didn’t find.
A short AGENTS.md or CLAUDE.md that says where each part of the system lives also helps. The agent reads it at the start of a session and spends less time searching. That file is only useful if the structure it describes exists in the code.
Output volume is not progress
“If AI is doing the work, why care how much code it writes?”
Because the number of lines it writes tells you nothing about whether the problem is solved.
If Claude Code generates thousands of lines for a routine update, it may be struggling to find the right module or interface. So it duplicates logic and adds another workaround.
A well-structured codebase lets the agent solve the same problem with a smaller, safer change. That change usually costs fewer tokens too. The agent reads fewer files to find the right place and writes fewer lines. Duplicated code keeps costing after it ships, because the next person or agent that touches it has to read both copies and keep them in sync.
For a routine update, a good diff is often small. Sometimes it deletes more lines than it adds.
What you are learning to code for
You learn to code so you can read 200 generated lines and say, “This is wrong, and here’s why.”
You learn it so you notice when the agent is working around your architecture instead of using it, and so you can keep the codebase easy to change.
You also learn it to write better prompts, because you understand the system you are asking the agent to modify. Compare these two prompts:
Add support for percentage discounts.
Add percentage discounts to calculateDiscount in src/pricing/discounts.ts.
Reuse the existing roundToCents helper. Add test cases next to the
existing discount tests.
Only someone who knows the code can write the second one. The agent has less to guess, and the diff it produces is easier to review.
Learning to code now means learning to judge code.