Tips for Building Apps with CursorAI

Maximizing Development Efficiency: Essential Tips for Building Applications with CursorAI

I’ve just finished a complete Ruby on Rails app using CursorAI, and I’d like to share some tips on how to use CursorAI effectively when developing a Ruby on Rails app. There are a couple of things you can do to make building your app much faster, and I’ll give you a list of the things I’ve learned.

  1. Edit your .cursorrules to tell CursorAI to maintain an up-to-date changelog. It’s useful to keep track of what you’ve completed so far, and it’s a good way to keep Cursor from getting stuck in a loop when it’s not able to fix a bug. CursorAI will tend to alternate between the same solution when nothing seems to be working; keeping a changelog will let the AI know that we’ve already tried something and not to do it again.

  2. Write tests for all new code. CursorAI is very good at writing unit tests. Any time you implement a new feature, tell CursorAI to write a new spec for that feature. This will keep you from breaking things as you continue to develop your app. Also, having a complete test suite will give Cursor more context about your app and allow it to make better suggestions.

  3. If you’ve got a list of features, tell Cursor to add them to a TODO.md Cursor can help you generate and track your project requirements. You could try asking Cursor, “Implement these features, and generate a unique branch name for each feature.” This will save you from having to come up with a good branch name every time you’re working on a new feature.

  4. Use @/ in your prompts to specify the directories Cursor should look in. If you tell CursorAI to only include certain directories in its context, that will keep your total context window from getting too large, and it’ll be easier for Cursor to reason about your code.

  5. Don’t forget to throw in @Web in your prompts If you’re having an issue, it’s likely there is a recent discussion about it on the web. Cursor will check and consider this new information when making suggestions.

  6. If you’re stuck, read your code. Maybe this goes without saying, but I find Cursor can sometimes overlook something simple, like trying to use the Rails credentials when you should be using the dotenv file.

  7. Always Commit your code ASAP - Cursor will delete it. In my first week of using Cursor, I had about 3 hours of uncommitted code. I left my computer for a couple of hours, and it went to sleep. When it woke, all the files that were changed were deleted. This does not seem to happen if you have committed your code.

  8. Ctrl+K in the terminal: this is your friend. Having Cursor generate your command is obviously helpful. One thing I do a lot is use Ctrl+K and tell Cursor to generate a commit message for me. This saves me from having to think, and I like that.

  9. Bootstrapping new projects with a shell script If you are bootstrapping a new project, you can ask Cursor to write a shell script to generate the project and all of its boilerplate code. This saves you from having to do it the slow manual way… Or you could just use Composer.