{"slug": "claude-code-keeps-breaking-my-project-when-i-add-new-features", "title": "Claude Code keeps breaking my project when I add new features", "summary": "A developer reports that Anthropic's Claude Code, an AI coding agent, repeatedly breaks projects by making unrequested refactors, such as renaming utility files without updating imports, causing errors and requiring manual reverts. The developer now mandates a strict step-by-step prompt requiring impact analysis and a plan before execution, treating agent patches as suspicious PRs needing manual audit.", "body_md": "# Claude Code keeps breaking my project when I add new features\n\n[Claude Code](/en/tags/claude%20code/)to handle the heavy lifting of implementation, and for the first few sprints, it felt like magic. But the moment the codebase hit a certain level of complexity, the \"vibe\" shifted. I asked for a relatively simple patch to my authentication middleware—basically just adding a role-check—and the agent decided to refactor three other unrelated files to \"optimize\" the flow.\n\nThe result was a complete meltdown. I didn't realize the extent of the changes until I tried to boot the server and got slammed with a wall of errors.\n\n```\nError: Cannot find module './utils/auth-helper'\n    at Module._load (node:internal/modules/cjs/loader:js, 934:34)\n    at Function.require (node:internal/modules/cjs/loader:js, 384:19)\n    at Object.<anonymous> (/src/middleware/auth.ts:12:1)\n```\n\nThe diagnosis was frustrating. The agent hadn't just edited the logic; it had renamed a utility file and deleted the original without updating all the imports across the project. It essentially hallucinated a better file structure and applied it inconsistently. I spent two hours manually reverting commits because the agent's own \"undo\" function struggled to track the cross-file dependencies it had just shattered.\n\nThis is the danger of an AI workflow that lacks a rigorous test suite. When you're just \"vibing\" with the code, you assume the LLM understands the global state of the project, but it's really just operating on a sliding window of context. Once it loses the thread of where a specific function is exported, it starts guessing.\n\nTo stop this from happening again, I'm forcing a more disciplined prompt engineering approach. Instead of \"Add X feature,\" I'm now using a strict step-by-step requirement:\n\n1. Analyze the impact of the change on existing imports.\n\n2. Propose the file changes in a plan first.\n\n3. Execute the change without modifying any file not explicitly mentioned in the plan.\n\nIf you're doing a deep dive into LLM agents for development, the lesson here is that the more \"autonomous\" the agent is, the more likely it is to commit architectural suicide if you aren't watching the diffs in real-time. I'm now treating every agent-generated patch as a suspicious PR that needs a manual audit before it even touches the main branch.\n\nFor anyone else using these tools, are you seeing the same drift? I'm wondering if there's a way to lock the file structure so the agent can't just decide to rename things on a whim.\n\n[Next Why does the Transformer architecture look the way it does? →](/en/threads/5582/)", "url": "https://wpnews.pro/news/claude-code-keeps-breaking-my-project-when-i-add-new-features", "canonical_source": "https://promptcube3.com/en/threads/5695/", "published_at": "2026-08-09 17:00:36+00:00", "updated_at": "2026-08-09 17:20:39.550644+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "artificial-intelligence"], "entities": ["Claude Code", "Anthropic"], "alternates": {"html": "https://wpnews.pro/news/claude-code-keeps-breaking-my-project-when-i-add-new-features", "markdown": "https://wpnews.pro/news/claude-code-keeps-breaking-my-project-when-i-add-new-features.md", "text": "https://wpnews.pro/news/claude-code-keeps-breaking-my-project-when-i-add-new-features.txt", "jsonld": "https://wpnews.pro/news/claude-code-keeps-breaking-my-project-when-i-add-new-features.jsonld"}}