Why does Cursor always like to rewrite a set instead of using an implementation that you already have in your project? This kind of complaint is common, but Cursor has actually made the answer clear in the Reuse Existing Code : if you don't explicitly ask it to "find an existing implementation before deciding whether to write a new one", it may generate a new version by default.
Why is this happening?
AI editors are good at completion and generation, but "generated" does not mean "best for your warehouse". Especially in old projects, multi-person collaborative projects, and monorepo, the really more reasonable approach is usually to follow the existing model. But if your prompt is just "help me write a login check" or "add a caching layer to me", it is entirely possible to skip the retrieval stage and create a new wheel directly.
More practical solutions
The most direct way is not to change the model, but to put the rules in front. The official idea is to first ask Cursor to rewrite the request to "I'm looking for if there is already code that can do this", search the codebase first, and then decide whether to create a new implementation. When landing, you can do this:
- In the project rules, it is stated: Search for similar implementations first, and then generate new code.
- When asking a question, add a sentence: Find the existing usage, existing components, and existing services first, and don't rewrite them immediately.
- Give it a clear point with a '@Files' or chat context for a key file, and don't let it play with just a few lines of code nearby.
So the core of this kind of problem is not "Cursor won't be reused", but you don't give it a working order that must be reused first. When the order is set right, it usually behaves much more stable, and it is more like a collaborator that can fit into the existing codebase.