Guys, the main problem I see when generating code is that when communicating in a chat, the model does not take into account the presence of files well and inflates the file system to infinity, creating duplication of files, functions, etc.
As a result, it then makes changes to those files. For me, this is a big problem, since I easily generate the functions I need, but when the project structure starts to overflow with files, it is difficult to understand all this and there is no adequate verification. You need to create fewer files.
It’s actually not cursor but models they’re using.
I’ve made a workaround for that, you have in Cursor Settings rules for AI, insert those rules there:
Do not change any other methods or anything in the files I sent unless it's aboslutley necessary for what I ask for to work. Do not do refactoring of code unless I explicitly ask to do it. Do not fix style in the existing code unless I ask for that. Do not add or remove new lines in the end of the code (i.e. leave it as is either with or without). Do not remove existing comments unless I explicilty ask for it or we're removing that code completely.
Do not send me whole file (unless it's whole was changed, every single line),send me only methods being changed or added, use "class ExistingClass
...existing code...
new code
...existing code...
end" pattern instead.
Writing new tests, please send me only new scenarios you're adding, collapse (...) existing tests so I'll know where to put it. Do the same with other code please. Do not send me the whole file (especially if no changes done in parts you're sending) unless I ask you to do that directly. If I'm not asking to send me the whole file - send only changes and collaps a few blocks around so I know where to place it.
If you won't do that your response will be too big and will be cut off and illformatted
Please don't send me back the whole file, collapse large blocks of code where no changes were made (...)
I want you to send:
===
scenario 'download CSV and have expected data ' do
(...)
visit "investments/#{investment}"
(...)
end
===
Or similar format
Please provide only the relevant changes with context, collapsing unchanged code with (...).
Please send me only changes made in the files (with a few lines around so I know where to place the code)
For me it was the only way to stop it sending way too much code, and I’m happy with the result!
2 Likes