How to Better Use Cursor
Basic Knowledge
Three Most Essential Shortcuts
(If you’re using a Mac, replace Control with Command)
- Control + K: Directly edit code or ask questions about selected code.
- Control + L: Open the AI chat assistant dialog box for interaction.
- Control + I: Activate the AI agent to automatically complete specific tasks.
Useful Features You Might Not Know
- Cursor’s Chat supports image uploads, which is extremely useful for quickly generating UI components.
Methods to Improve Response Quality
Cursor Rules
- Global Cursor Rules
Open Cursor Settings, navigate to the Rules page, and write your Rules under the User Rules title. I currently use Rules shared by Cursor employees as follows (reference link):
- Be casual unless otherwise specified
- Be terse
- Suggest solutions that I didn’t think about—anticipate my needs
- Treat me as an expert
- Be accurate and thorough
- Give the answer immediately. Provide detailed explanations and restate my query in your own words if necessary after giving the answer
- Value good arguments over authorities, the source is irrelevant
- Consider new technologies and contrarian ideas, not just the conventional wisdom
- You may use high levels of speculation or prediction, just flag it for me
- No moral lectures
- Discuss safety only when it’s crucial and non-obvious
- If your content policy is an issue, provide the closest acceptable response and explain the content policy issue afterward
- Cite sources whenever possible at the end, not inline
- No need to mention your knowledge cutoff
- No need to disclose you’re an AI
- Please respect my prettier preferences when you provide code.
- Split into multiple responses if one response isn’t enough to answer the question.
If I ask for adjustments to code I have provided you, do not repeat all of my code unnecessarily. Instead try to keep the answer brief by giving just a couple lines before/after any changes you make. Multiple code blocks are ok.
- Project-Specific Cursor Rules
Beyond global settings, Cursor also supports project-level prompts. To implement this, create a .cursor
folder in your project. Then create a subfolder called rules
inside the .cursor
folder, and set up different prompt files.
Note: If I develop more insights after implementation, I’ll update this section with additional details.
Recommended Prompt Structure
OpenAI co-founder Greg Brockman once recommended a prompt writing approach that became widely shared on X (reference link):
- Goal: Clearly state what task you want the AI to complete.
- Return Format: Explicitly define the expected output format.
- Warnings: Remind AI about specific considerations when handling the task.
- Context: Provide relevant background information.
The most critical element is describing your goals and requirements with clarity.
For better context writing in Cursor, utilize these five key components:
-
Write the Cursor Rules as explained in the previous section
-
Leverage Cursor’s useful indexing features to import relevant context:
@file
: Reference an entire file as context.@code
: Reference specific code segments (avoiding irrelevant content).@git
: Reference Git records (such as commits, PR diffs) for convenient code reviews.@docs
: Reference technical documentation (such as Next.js official docs) to avoid outdated information.@web
: Have Cursor conduct a web search first, then answer based on the latest content (ideal for new technologies without official documentation).
-
Use “decision context” to avoid AI memory issues
When AI output doesn’t meet your expectations:
- Ask AI to adjust, then ask AI to summarize what should be done
- Put that summary in fyi.md
- Include fyi.md in future prompts
Note: If I develop more insights after implementation, I’ll update this section with additional details.
-
Ensure high-quality responses through the “Single Context Principle”
The single context principle (single purpose composers) concept was shared by Cursor team member Eric Zakariasson on X (reference link).
My understanding is that each conversation thread should focus on “solving one specific purpose.” When I open a New chat to solve “Purpose A,” but encounter unrelated issues during the conversation, I open another New chat to address those separately, then return to the original conversation to continue with “Purpose A.”
After discovering this concept, I realized I’ve been instinctively using this approach. I mentally categorize it as “main quest” and “side quests,” creating conversation threads that branch like a tree.
-
Additional recommended tips
-
Add the following at the end of your prompts:
If you need clarification or have any questions, feel free to ask.
This encourages Cursor to proactively ask questions, helping you provide more context and improving response quality. (reference link)
-
To preserve key points from a lengthy conversation thread, use this prompt:
Summarize what you did and output in Markdown format that I can copy directly.
-
Advanced Practical Applications
Below are scenarios where AI can assist during different project phases, with example prompts:
1. Design Phase
I strongly recommend storing technical design documents directly in your code repository.
Scenario: Modifying Technical Design Documents
Scenario: Creating Visual Aids for Text Content
Scenario: Quickly Understanding a Codebase
2. Implementation Phase
Scenario: Implementing Test-Driven Development (TDD) Workflow
Scenario: Code Review
Scenario: Writing Commit Messages
Cursor’s commit field has a “Generate Commit Message” button. I recommend setting global Cursor Rules to ensure that Cursor generates messages following Conventional Commits. For example:
Scenario: Writing PR Messages
I recommend adding a template for PR messages in your project-specific Cursor Rules (place it in .cursor/rules/pr_generation.mdc):
## Background (Why)
<!-- Describe the background of this PR. Why is this PR needed? What problem does it solve? -->
## Implementation Method (How)
<!-- Describe the implementation method and architectural decisions made. -->
## Actual Changes (What)
<!-- Highlight the main changes implemented in this merge request. Specifically explain what you changed and why. -->
- [ ] Feature/Change 1
- [ ] Feature/Change 2
### Screenshots or Video References
<!-- If applicable, add design references (links), screenshots, or screen recordings -->
### Test Verification
<!-- List the test cases that have been verified. Include edge cases. -->
- [ ] Test scenario 1
- [ ] Test scenario 2
- [ ] Test scenario 3
<!-- Add any other test notes for reviewers -->
## Additional Notes
<!-- Any information that would help PR reviewers (e.g., known limitations, future todos) -->
## Related Links
<!-- Links related to the PR -->
With this PR template and Cursor’s @git
feature, you can use prompts like “Use the PR Generation prompt to write a description for these two commits” to generate comprehensive PR messages.
Scenario: Assisting with Code Review
-
I recommend maintaining a Style Guide in Cursor’s Docs. Combined with the
@git
feature, you can use prompts like “Review this PR using the JavaScript Style Guide” to assist with code reviews. -
In addition to the style guide, the decision context records mentioned earlier can also be useful during code reviews.
-
Beyond using
@git
, you don’t need to focus only on entire PRs; you can target specific files or code snippets for review. For example, import a React component file and have Cursor suggest improvements based on React best practices.