Cursor Usage Tips and Reflections

Many people say that 2025 will be the year of intelligent agents, and in 2024, many efficiency-seeking programmers have already started using Cursor/Windsurf. It seems to take us a step further than GitHub Copilot from a few years ago. I often ponder what programming will look like in the future and how Cursor and LLMs will impact the entire development process.

Introduction

This article is based on a technical sharing session held at the end of 2024 within our team, titled “Programming with Cursor.” The session was primarily a demonstration, gradually introducing everyone to the powerful features of Cursor, along with some usage tips. While organizing this into a blog post, I realized that many operation videos would facilitate understanding, so this article does not aim to reproduce the textual process but rather discusses some reflections on collaborative programming with Cursor from another angle.

I will briefly discuss some basic operations and settings, but clearly, a hands-on tutorial is not suitable here; then I will cover some advanced usages and how to leverage it to restructure our daily development processes; finally, I will also touch upon other AI code editors and compare them with Cursor. I hope that before reading this article, you have at least some experience with Cursor or other AI-assisted code generation tools, as this will greatly help in understanding what I am discussing.

Alright, let’s get started.

The Origin of Cursor

It’s not easy to introduce it simply. If you are familiar with traditional Copilot, Cursor has stronger AI capabilities and a more user-friendly interaction. One of its philosophies is:

“Based on your cursor position, consider what you want to do?”

I flipped through Cursor’s BLOG and noticed that they have been continuously enhancing its contextual awareness, as well as multi-line and cross-file code changes. In the later versions (0.43+), they improved capabilities like Agent, further enhancing the level of AI automation. One interesting label of Cursor is Tab, Tab, Tab, which perhaps means it understands you well; all you need is to confirm with Tab, and it supports multiple modifications while continuously jumping around.

Basic Interaction with Cursor

The reason it has become popular is that Cursor has made interactions quite simple, mainly involving four operations (using MacOS shortcuts as an example; please check for other platforms):

  • Tab: Confirm certain code changes or completions.
  • Cmd+K: Engage in dialogue or rewrite a segment of code in the editor.
  • Cmd+L: Open the Chat window to converse with Cursor.
  • Cmd+I: Open the Composer for more complex tasks like building a project from scratch or multi-file modification dialogues.

I don’t know why, but I personally feel that Cmd+K is not very useful in coding, as it directly rewrites code. I prefer to see a Diff comparison before accepting changes. So, the commands I use most often are probably Cmd+L and Cmd+I. Of course, Cmd+K is quite useful in the command line, allowing direct command generation without switching to chat. I remember an editor called Wrap from years ago, which unfortunately did not make it far.

Cursor’s referencing capability is even more impressive. As long as you start with @, you can reference a lot of content, such as files, directories, code snippets, and even more powerful web pages, external documents, commits in Git repositories, and the entire codebase. Here are a few tips:

  1. Sometimes when you discuss something with it, it may misinterpret due to insufficient context. You can try referencing some files or corresponding structures and functions with @. You may find that the generated output aligns more with your expectations.
  2. Since it can reference Git, it understands your repository situation, so asking it to generate some Commit Messages is also a good choice. The format is standardized, and the descriptions are clear; I feel it even writes better than I do.
  3. For some newer external documents, the model may not have learned them. In such cases, providing a link with @web is very helpful. I believe it reads documents faster and more accurately than you do, which is both delightful and a bit sad.
  4. Because Cursor is supported by a large model, its contextual awareness has limitations. Sometimes when the context is too long, it may seem to forget previous content, so I recommend occasionally starting a new chat window with Cmd+N.

Advanced Usage of Cursor

To be honest, my first experience with the Agent feature was filled with delightful surprises. In this section, we will discuss several advanced usages, mainly involving agent mode/yolo mode and the customization of the .cursorrules file. The underlying working principles seem evident but are quite useful.

Agent Mode

Agent mode requires your version to be 0.43 or higher. Some users have mentioned they cannot find the Cursor; this is not a special version: D You just need to update (though some users have reported that they were blocked after repeatedly deleting accounts to gain access, the reason is unknown). For software that iterates quickly, timely updates can unlock more powerful features. The initial Agent can already handle some of our mundane tasks, from automatically writing code to fixing lint errors, generating unit test cases, and creating commits.

I was amazed when I asked it to refactor a piece of code; it attempted to fix related lint issues, noticed modifications in protobuf’s proto, and automatically compiled the proto. It first tried the command make proto and encountered an error. Then it analyzed my Makefile, recognized that it was built based on Earthly, and discovered that the make code command could generate the relevant protocol. It then executed the compilation and repair work automatically. Once everything was ready, it generated a nice Commit Message and committed it automatically. During this process, I just watched it perform, occasionally confirming the commands it wanted to execute, smiling while feeling a bit melancholic.

YOLO Mode

When using Agent mode, sometimes it will ask for your confirmation before executing certain commands on the computer, mainly for privacy reasons. However, there are times when we want it to act more quickly, which is the background for the emergence of the Yolo feature. To use this feature, you need version 0.44 or higher. Compared to enabling Agent, Yolo is more of a configuration; calling it a mode seems a bit forced. The default is to not enable Yolo for safety reasons, but we can configure it to allow automatic execution of certain commands, supporting both whitelists and blacklists.

With YOLO enabled, the work in Agent mode becomes more automated, allowing you to mostly “observe” the machine at work. My experience with this mode is not particularly extensive; sometimes it seems to have inefficient loops, but its future potential is promising.

Customization of .cursorrules

While writing this article, I checked again, and the recently updated version 0.45 has enhanced the customization capabilities of the .cursorrules file, supporting rules configuration at the multi-repository level. I will study the actual effects in the future. For now, let’s discuss two usage methods:

  1. Global Rules For AI. You can directly input these rules in the Cursor settings, allowing you to configure some global rules. For example, I set it to respond in Chinese, but use English for code comments, and the effect is quite noticeable.
  2. Define a .cursorrules file in the root directory, where you can write some prompts you want to convey to Cursor.

You can also find some excellent summaries of useful prompts online, such as awesome-cursorrules[1]. I tried to inform it of repository-specific rules, such as coding styles and certain tools or compilations, which will help us communicate better with AI in the future.

During this process, we can also be lazy; even the .cursorrules can be written by AI, based on README or codebase, helping us complete a draft that we can then refine. In the future, this could become part of the prompts we provide to AI. I wonder if we could continuously edit and improve rules, such as how to write a test case, how to write comments, and how to write a module. This could yield excellent results. I believe I will continue to practice this area, especially since I frequently interact with certain repositories at work, where some mature conventions can be easily learned by AI.

Other Practices with Cursor

Unit Testing

Some tasks we usually dislike doing ourselves can be handled diligently by our AI assistants, such as writing more unit tests. When we write tests ourselves, we often face two major issues: incomplete test cases and insufficient coverage due to laziness. Tasks with such specific goals can be relatively easy to accomplish with Cursor, provided your code is well-structured and there are some reference examples available.

If the generated code does not meet expectations in certain scenarios, how can we write AI-friendly test cases/code? I find Behavior Driven Development (BDD)[2] quite good; it emphasizes behavior rather than implementation, allowing us to focus more on functionality rather than implementation details. With such a coding framework, AI can fill in the details while we only need to focus on functionality (i.e., test cases). In Go, we can leverage Ginkgo (https://onsi.github.io/ginkgo/) which supports the BDD framework. See if this feels more AI-friendly:

var _ = Describe("Books", func() {
  var foxInSocks, lesMis *books.Book

  BeforeEach(func() {
    lesMis = &books.Book{
      Title:  "Les Miserables",
      Author: "Victor Hugo",
      Pages:  2783,
    }

    foxInSocks = &books.Book{
      Title:  "Fox In Socks",
      Author: "Dr. Seuss",
      Pages:  24,
    }
  })

  Describe("Categorizing books", func() {
    Context("with more than 300 pages", func() {
      It("should be a novel", func() {
        Expect(lesMis.Category()).To(Equal(books.CategoryNovel))
      })
    })

    Context("with fewer than 300 pages", func() {
      It("should be a short story", func() {
        Expect(foxInSocks.Category()).To(Equal(books.CategoryShortStory))
      })
    })
  })
})

How to leverage AI in more scenarios to help improve unit tests is a topic worth exploring, and I hope to share more insights after further practice.

Code Review

You might not expect it, but AI can help you not only write code but also review it. As I keep hearing about various AI tools making waves, I look forward to them helping me manage more risks. I tried using Cursor to review some hidden bugs in my work, and I found that it could indeed identify some issues, even those that multiple reviewers in our team had missed. I can’t help but think that if everyone had such a powerful assistant to review their changes before submitting code, the quality of the submitted code would be higher, and we would be more confident.

The diligent AI won’t be overwhelmed by hundreds of modifications; it will quietly follow your instructions to help you check. Therefore, the prompts provided for code reviews are crucial. Here, we can look at some online summaries, such as ai prompts for code reviews[3]. However, I feel that different teams or projects should have their own custom CR rules, perhaps written in the .cursorrules file for more targeted guidance.

Here’s a little tip: before submitting code in Cursor, you can use @git to select PR (Diff with Main Branch), so Cursor will review based on the current diff rather than the entire repository. From a modeling perspective, I recommend choosing a more robust model, like claude-3.5-sonnet or o1-mini.

Recently, I took a more complex commit for AI code review using the claude-3.5-sonnet model and 4o, and it did not find any issues. But when I switched to o1-mini, it was able to identify problems. I also tried the recently popular domestic model, DeekSeek V3, and it could find issues as well. Kudos to the domestic model! So when using AI for CR, let’s not skimp on resources in complex scenarios.

Other AI Code Editors

In addition to paid options like Cursor/Windsurf, we can also achieve a good AI-assisted programming experience with free tools like vscode + cline plugin. Currently, I recommend using the Roo Cline plugin (which seems to have been renamed to Roo Code to shed the Cline image); it is more friendly in terms of token consumption and offers more features for you to discover. Combined with the domestic DeeSeek V3 or the globally popular DeepSeek-R1 series models, which are affordable and powerful, it should also be a good option. It’s a bit regrettable that these plugins may feel slightly inferior in various experiences since they are just “plugins”.

Additionally, I found a rather interesting extension in Cline: MCP Servers. Based on the MCP (model-context-protocol)[4] protocol, it defines a paradigm for interaction between models and tools. Currently, there are many servers that support it[5], such as those interacting with Git/Sqlite, and even Cloudflare:

Cloudflare – Deploy, configure & interrogate your resources on the Cloudflare developer platform (e.g., Workers/KV/R2/D1)

There are also many third-party MCP servers, and it remains to be seen whether this standard will dominate in the future, but it is a promising idea with significant potential.

Conclusion

Due to time constraints, I can’t claim to have a deep experience with Cursor, but it seems clear that it brings improvements in work efficiency. We often hear that the future will not be taken over by AI, but by those who cannot use AI. I am not sure if this is just a sensational statement from self-media selling courses, but it does remind us of how not to be easily replaced. If we can’t become 10x programmers, can we at least aim for 2x or 3x?

In the short term, how to integrate this capability into our daily development processes and achieve genuine quality and efficiency improvements is far more meaningful. I welcome everyone to exchange and discuss how you are using it, and feel free to point out any mistakes in this article. Let’s learn and improve together.

I am an engineer who loves to tinker with technology and enjoy sharing. Feel free to like, follow, and share, and I welcome discussions on technical issues. To receive timely article updates, please follow my public account, “The Engineer Who Loves to Tinker.”

References
[1]

awesome-cursorrules: https://github.com/PatrickJS/awesome-cursorrules

[2]

Behavior Driven Development (BDD): https://en.wikipedia.org/wiki/Behavior-driven_development

[3]

ai prompts for code reviews: https://faqprime.com/en/ai-prompts-for-code-reviews/

[4]

MCP (model-context-protocol): https://www.anthropic.com/news/model-context-protocol

[5]

Many servers supporting it: https://github.com/modelcontextprotocol/servers

Leave a Comment