Skip to content
ATAI Today Brief
HomeNewsConceptsGuidesToolbox
AboutSubscribeUA
Subscribe

AI Today Brief

The daily AI-engineering brief. Built in public. EN · UA.

XTelegramLinkedInYouTubeRSS
NewsConceptsGuidesSubscribeAdvertiseAboutEditorial policyAI disclosurePrivacyTerms

© 2026 AI Today Brief. All rights reserved.

  1. Home/
  2. News/
  3. Vibe coding workflow/
  4. Stop Letting AI Write Lazy, Duplicated Code Patterns in Your Repository
Vibe coding workflow

Stop Letting AI Write Lazy, Duplicated Code Patterns in Your Repository

July 10, 2026· 5 min read
OKCurated by Oleksandr Kuzmenko, AI Product Engineer·Updated July 10, 2026·Sources cited on every story
AI-assisted · editor-reviewed·How we use AI
Stop Letting AI Write Lazy, Duplicated Code Patterns in Your Repository

Letting LLMs write sloppy or duplicated code creates a feedback loop where the model copies its own bad patterns. Write clean code to train your agent to follow your exact standards.

Impact: Medium

Why it matters

You can immediately improve AI output quality by refactoring your codebase's patterns instead of just writing longer system prompts.

TL;DR

  • 01AI reads your codebase to determine how things are done here instead of applying first-principles design.
  • 02Accepting poor patterns trains the LLM to generate progressively worse, highly duplicated code.
  • 03Subjective agent instructions often fail to prevent bad patterns; clean codebases are the best prompt.

The Feedback Loop Danger

LLMs are sponges that absorb everything in your repository. When you prompt an AI to build a new route or background job, it doesn't reason from first principles; it searches your open workspace and git history. If you previously allowed a four-line duplicated conditional check like if (user.isActive && !user.isSuspended), the model treats this as your intentional, preferred style. By the fifth endpoint, the model generates the exact same copy-pasted logic, multiplying technical debt.

Why System Prompts Fail

Many developers try to fix this by adding strict rules inside files like AGENTS.md or .cursorrules. However, enforcing subjective rules like "do not write redundant comments" or "write elegant code" is notoriously difficult for models to follow consistently. Standard linters cannot easily catch these conceptual duplication issues.

Maintain Code for Humans and Agents

The true solution is to "write code like a human will maintain it." If you extract a helper function, the LLM will discover and use that helper function in its next generation. By maintaining clean, modular, and DRY structures, you implicitly train the LLM to follow those exact high-quality patterns without bloating your prompts.

Try it in 2 minutes

if (user.isActive && user.hasPermission('read') && !user.isSuspended && account.status === 'open') { /* ... */ }

javascript

✓ When to use

  • When building projects with agentic coding environments like Cursor, Claude Code, or Copilot.
  • When establishing team guidelines for code reviews of AI-generated pull requests.

✕ When NOT to use

  • For disposable one-off scripts where longevity and future AI interaction are non-existent.

What to do today

  • →Refactor any duplicated logical blocks into clean, shared helper functions before prompting your agent for new endpoints.
  • →Review your .cursorrules or AGENTS.md to ensure they complement a clean repository structure rather than trying to fix messy code after the fact.

What the community says

  • “The problem of duplicated code described in the article, goes in a different way in reality: AI does not update 4 places in the same way, but implement them a slightly different.”

    — alexsmirnov on Hacker News

  • “I have tried prompting it out and providing strong guidelines in my AGENTS.md against it, but I still get _way_ too many useless 'explain the code' style comments...”

    — boredtofears on Hacker News

  • “...if LLMs reduce the cost of maintaining more explicit or verbose code, we should use that to raise the standard, not preserve compromises made for human convenience.”

    — baptou12 on Hacker News

#Claude Code#Cursor

Sources

  • Write code like a human will maintain it
ShareShare on XShare on LinkedIn
← Previous storyMassive AI Bills Trigger Sudden Shift from Flat-Rate to Usage-Based LLM Economics

Related stories

  • Vibe coding workflowMeta open-sources Astryx, an agent-ready React and StyleX design system
  • Vibe coding workflowPersistent Limitations in Codex Agentic Frontend Design and Orchestration
  • Vibe coding workflowBuilding a Monetized App with Claude and Managing 130,000 Lines of AI Code
  • Vibe coding workflowClaude Fable Demonstrates Autonomous Tool Creation in Terminal

Email digest

Get the morning AI brief

One email a day — the stories that matter for engineers, founders and tech leads. Human-edited, with links to primary sources.

  • ✓120+ sources scanned daily
  • ✓Edited by a human
  • ✓1 email per day
  • ✓EN + UA

By subscribing you agree to the privacy policy.