AI Coding

Is AI Better at Writing New Code or Fixing Existing Code?

New code gives AI freedom. Existing code requires preserving relationships it may not see. Here's why modification can be deceptively harder.

A forked path contrasting the freedom of writing new code with dependencies and hidden risks in existing code.
In This Article

    Quick Answer

    AI is often easier to use for new isolated code than for modifications to an existing system.

    New code gives the model freedom to choose an implementation.

    Existing code comes with history.

    A seemingly small change may have to preserve styles, functions, plugins, data structures, naming conventions and behavior elsewhere in the application.

    That makes modification more context-dependent than it first appears.

    New Code Has Fewer Inherited Decisions

    If we ask AI to create a small standalone component, it can choose the structure that best fits the requirements.

    It can name the functions.

    Choose the organization.

    Select a straightforward implementation.

    There may still be mistakes, but the model is not negotiating with years of existing decisions.

    Existing Code Has Relationships

    Modification is different.

    The requested line may depend on CSS defined elsewhere.

    A function may be called from another file.

    A WordPress plugin may expect a particular hook.

    A database field may have an established format.

    A class name may be reused across several pages.

    The requested change itself can be trivial while integration is not.

    We Saw This on Real Website Work

    Some of our easiest AI coding successes involved narrow, visible problems.

    The harder cases were changes to live pages where the new behavior had to fit an existing design without disturbing anything else.

    A local solution could be correct and still be wrong for the system.

    That is why “just change this” can be a surprisingly demanding instruction.

    Context Improves Modification

    We had better results when we supplied the relevant surrounding code rather than only the broken line.

    We also explained:

    what already works;

    what must remain working;

    what the failure looks like;

    what result we expect;

    and whether shared components are involved.

    That gives AI a better map of the relationships it must preserve.

    Preservation Is Part of the Requirement

    For existing systems, a successful change has two jobs.

    Create the requested behavior.

    Preserve the behavior that was already correct.

    The second job is easy to omit from the prompt because humans assume it automatically.

    We learned to state it explicitly and then test it.

    When New Code Is Not Easier

    New code can still be difficult when the requirements are vague, the architecture is complex or the component must immediately integrate with a large system.

    The distinction is therefore not simply “new good, existing bad.”

    It is freedom versus inherited constraints.

    The more inherited constraints a task contains, the more context AI needs.

    A Useful Workflow

    For modifications, we now prefer:

    show the relevant existing code;

    state the requested change;

    list behavior that must remain unchanged;

    make the smallest sensible patch;

    run the result;

    then regression-test nearby behavior.

    That is slower than blindly pasting a generated replacement.

    It is much faster than recovering from an unnoticed system-wide side effect.

    Worthy Trying Verdict

    New isolated code: Often easier

    Existing systems: More context-dependent

    Main challenge in modification: Preserving relationships

    Best input: Relevant surrounding code + preservation constraints

    Human testing: Required

    The lesson: New code has to work. Modified code has to work without destroying the decisions that already work around it.