Curious to know what are your hacks or workflows to get the best out of cursor?

Curious to know what are your hacks or workflows to get the best out of cursor?

1 Like

for reference:

and a few good ideas came up in this topic:

I have also seen people posting creative solutions to working with git, and creating integrations with cursor logs and requests etc.

Here is a useful hack for when you want Composer to do a complex coding task for you, especially one that could fail in many different ways: Ask Composer to write unit tests to confirm that the code it wrote works as intended. Then just keep running the tests and showing the error messages to Composer until all tests are passing.

Donā€™t even look at the code until all tests are passing. It will write some nonsense now and then, but the unit tests will do the complaining for you. Just accept all > run tests > copy errors > repeat. It might take 20 rounds or so but youā€™ll get some seriously impressive results at the end.

3 Likes

Good discussion!
Iā€™m collecting the best practice together here:

  1. Ask to generate unit tests
  2. Use ā€œAI rulesā€ in settings to capture best practice and oneā€™s preference.
  3. Design guided code completion.

Here is my ā€œAI rulesā€ at the moment:

Prefer functional programming over object oriented programming.
Use declarative programming when it reduces complexity.
When performing code changes, always review and update the whole content of the file where changes are made.
Always insist on type hints, doc-string, and unit tests for functions.
Use object oriented desgin when it is helpful to improve readability, and reduce code complexity.
Always generate and update code content outline and call graphs for each file at the top of a code file.
Refrain from code auto-completion, when there is not much context of comment, or code in a function.

The above rules represents some best practices that Iā€™m practicing with Cursor. I found it effective to ask the preference of functional programming.

At the moment, Iā€™m puzzled though: how to use Cursor actually to be more productive. Iā€™ve been using Cursor to refactor and improve a file of some data analytics in Python. The code was of poor readability, repetition. With Cursor, especially, by ask it to generate function outline and call graphs of the functions, we were able to improve the readability, and structure of the code.
However, I wonder how it can actually save the development time? I found that Cursor can always find some improvement endlessly when ask it repeatedly to review the code, thus it might not save the development but could be in the ā€œrabbit holeā€ of endless improvement.

I also found that Cursorā€™s too eager code auto-completion sometimes may be a distraction, when one is not clear of the design of the code being crafted.
I had to do some core coding out side of Cursor to figure out the proper design, then come back to Cursor for review and adaptation of the design to the rest of the codebase.

Letā€™s keep sharing the actual productive workflow using Cursor.