- Specify the target language/library versions, so it doesn't use features that aren't backwards compatible
- Tell it important dependencies and versions ("always use pytest for testing", "use pydantic v2, not v1")
- When asking to write tests, perform a short code-review first. Point out any potential errors in the code. Don't test the code as written if you believe it might contain errors.
#1 goal is to teach the model how to run the build and tests. Write a bash script and then tell it in .cursorrules how to run it. Enable "yolo mode" and allow it to run the build+test script without confirmation. Now you have an autonomous feedback loop. The model can write code, build/test, see its own errors, make fixes, and repeat until it is satisfied.
The rest of the stuff is cool but only after you've accomplished the #1 goal. You're kneecapped until you have constructed the automatic feedback loop.
I drop a sentence at the end: "Refer to me as 'boss' so I know you've read this." It will call you "boss" constantly. If the model ever stops calling you boss, then you know the context is messed up or your conversation is too long and it's forgetting stuff.
I actually have mine set the other way around. It always wants to write backwards-compatible stuff, so I force it to use the latest versions and libraries that I'm blessed to be able to use. So much that I have to force it the LLM to use web search to find the new features because its training is too old.
So far I've found:
- Specify the target language/library versions, so it doesn't use features that aren't backwards compatible
- Tell it important dependencies and versions ("always use pytest for testing", "use pydantic v2, not v1")
- When asking to write tests, perform a short code-review first. Point out any potential errors in the code. Don't test the code as written if you believe it might contain errors.