RC RANDOM CHAOS

Your AI-Written Shortcuts Become the Codebase's House Style

· via Hacker News

Original source

Write code like a human will maintain it

Hacker News →

Coding with LLMs makes it tempting to skip good engineering hygiene: when the model can regenerate anything on demand, why bother extracting a shared helper instead of copy-pasting the same access check into a route handler, a background job, an API endpoint, and a webhook? The author admits to doing exactly this — merging four near-identical conditionals because the code worked, the tests passed, and future edits would supposedly be the model’s problem, not theirs.

The flaw in that reasoning is that LLMs don’t generate in isolation. They condition on the existing repo — open files, established patterns, recent commits. Every shortcut that gets merged becomes a signal about “how things are done here.” Ask for a fifth endpoint and the model reproduces the duplicated logic; ask for a refactor and it faithfully preserves all five copies, because that duplication now reads as your intended style. What felt like outsourcing maintenance is really teaching the assistant your worst habits.

The damage compounds. Individual code smells seem harmless, but duplicated conditionals, god functions, and deferred cleanups stack into a pattern dense enough that you can no longer prompt your way out — and there’s no guarantee the model will catch every instance when you finally try to fix it. The takeaway: treat AI-generated code as if a human still has to maintain it, because the model is a sponge that absorbs and echoes back whatever quality you let into the repo.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.