I wonder if there is a way to make sure models take snippets into account for suggested code. I have a bunch of snippets for special JS methods for LaunchBar, but instead of using those, Sonnet is making up similar methods. Is this something I can add as a rule?
Hi @Ptujec and welcome to Cursor Forum
Yes you can ask Agent to remember using snippets for special JS methods.
Then you could also provide those snippets in certain files (either md or js) and ask AI to follow that.
Memories (things to remember) are always active, rules may be active based on settings of the rule so you can configure that as you need.
So this would be a good rule? βIn JavaScript code consider my custom snippets for suggestions (javascript.json)β
You could literally tell the agent to remember which will create a Memory.
Remember to consider in JS code my custom snippts for suggestion ./path/file
Sure you can also add the line to .cursorrules or into your Cursor Project Rules or in User Rules.
In JS code use any matching snippets from ./path/file
But if you have specific usage cases when which snippet has to be used you may use different approaches.
Let me know what you try and how it works for you. Happy to give more feedback
well, you can use memory and .cursorrules or directly userrules
i used something like that:
DO NOT USE HTTPCONTEXT OR IMPORT AXIOS. INSTEAD, use api.ts to connect to APIs because it already includes everything necessary (like bearer token configuration, etc.). Of course, you can read the files it imports and configures, but you are only allowed to make calls using api.ts.
If you have any questions, the api.ts file Iβm referring to is located at:
~/projetos/php/src/services/api.ts
and worked well