HeadlinesBriefing favicon HeadlinesBriefing.com

AI Coding Assistants Replicate Your Bad Patterns

Hacker News •
×

Developers using LLMs for code generation increasingly accept duplicated logic instead of extracting shared helpers. The author caught themselves merging the same four-condition access check — active user, read permission, not suspended, open account — across a route handler, background job, API endpoint, and webhook. Each version worked, tests passed, and the assumption was that future changes would be the LLM's problem.

That assumption breaks because LLMs don't start from first principles. They read your existing codebase — open files, established patterns, recent commits — and treat whatever they find as the canonical style. When you ask for a fifth endpoint with identical access rules, the model replicates the four existing copies rather than suggesting a shared function. A refactor request preserves all five duplicates because that's what your repository demonstrates.

Each shortcut compounds. Duplicated conditionals, bloated functions, and deferred cleanup accumulate as training data for the next prompt. The codebase signals that repetition is normal, and the model obliges. Eventually you cannot prompt your way out of the mess without manually rewriting the underlying patterns.

The fix is uncomfortable: write code as if a human will maintain it, because the LLM is a sponge that repeats exactly what you feed it. Good habits propagate; bad ones metastasize.