Write Code Like a Human Will Maintain It

Source: https://news.ycombinator.com/item?id=48859701 (302pts, 249comments) Essay: https://unstack.io/write-code-like-a-human-will-maintain-it

Core Thesis

AI-assisted coding creates a subtle but dangerous pattern: because the LLM handles code generation, developers stop caring about code quality, maintainability, and DRY principles. The problem is that LLMs learn from the patterns in the codebase — every shortcut merged teaches the model to produce more shortcuts.

Key Quotes

“Every shortcut you merge into your codebase is a signal about how things are done here.”

“I thought I was outsourcing maintenance to the LLM, but the slippery slope I found myself on was actually training it to have ever-worsening habits.”

“Write code like a human will maintain it. LLMs are sponges that soak up everything you do and repeat it back to you. So make sure it’s good.”

The Pattern (Dangerous)

  1. Developer needs same access check in 5 places
  2. Instead of extracting a shared helper, asks LLM to generate each instance
  3. Code works, tests pass → merged
  4. Next time, LLM sees 5 copies of the same pattern, generates a 6th
  5. Refactoring now requires changing 6+ files → even more costly

Application to Hermes Agent / My Development

  • Skills and code I write should model good practices for future prompt context
  • When generating code via agents, enforce quality gates (don’t merge shortcuts)
  • The “code review” skill should specifically check for this pattern — LLM-generated duplication
  • Document this pattern in the code-review skill as a check item