Mastering Cursor - From Chatbot to Pair Programmer
This guide outlines the shift from treating AI as a snippet generator to using it as a fully integrated Junior Developer.
π§ Phase 1: The Philosophy
The Mindset Shift
- β The Old Way: Treating AI as a "Chatbot" (Copy/Paste from ChatGPT).
- β
The Cursor Way: Treating AI as a Junior Developer living inside your VS Code.
- It has Eyes: It sees your file structure, active tabs, and terminal.
- It has Hands: It can edit, create, and delete files.
βοΈ Golden Rule: The AI is only as smart as the Context you give it.
- No Context = It guesses (Risk of hallucinations).
- Tagged Context = It acts like a Senior Engineer.
π οΈ Phase 2: The Core Toolkit (Daily Drivers)
Before diving deep, master the three primary interaction points.
1. Tab (Copilot++)
What it is: Auto-logic, not just auto-complete. It predicts your next cursor position and the next few lines of code.
- Usage: Start typing. If the gray text looks right, hit
Tab. - Partial Accept: Hold
Ctrl(orCmd) +Right Arrowto accept word-by-word. - Jump Navigation: If Cursor suggests a change in a different file (e.g., updating an import), hitting
Tabwill physically move you to that file. - Suggestions
- Auto-import
- Tab in Peek
2. Inline Edit (Cmd + K / Ctrl + K)
What it is: Quick, localized edits without opening the chat sidebar.
- Workflow: Highlight code β Press
Cmd + Kβ Type instruction. - Use Cases: "Add error handling," "Convert to async/await," "Fix typo."
3. Modes (Cmd + L)
Cursor has distinct modes for different stages of development.
| Mode | Best Used For | Capabilities |
|---|---|---|
| Agent | Building features, refactoring | Autonomous exploration, multi-file edits, terminal usage. |
| Ask | Learning & questions | Read-only exploration. No file changes. |
| Plan | Architecture & Strategy | Creates implementation plans before coding. |
| Debug | Tricky bugs | Hypothesis generation, log instrumentation, runtime analysis. |
π§ Phase 3: Context Mastery
The most powerful feature of Cursor is explicit context tagging using the @ symbol.
The @ Symbol
| Tag | Purpose | Best Use Case |
|---|---|---|
| @Docs | Live Documentation | Paste a URL (e.g., Next.js 15) to overcome knowledge cutoffs. |
| @Browser | Internet Search | "What is the latest breaking change in React 19?" |
| @Branch | Version Control | "Analyze the diff between this branch and main." |
| @Files and Folders | Specific Files | Reference @user.service.ts to focus the AI. |
π‘ Context Tip:
You don't need to manually tag every file. If you know the exact file, tag it. If not, let the agent find it. Over-tagging with irrelevant files can confuse the AI.
Index & Docs
The Codebase Index and Documentation features help the AI understand your project context better.
πΊοΈ Phase 4: Planning & Design
The most impactful change you can make is planning before coding.
Plan Mode (Shift + Tab)
Toggle Plan Mode in the agent input. Instead of writing code immediately, the Agent will:
- Research your codebase.
- Ask clarifying questions.
- Create a Markdown plan with file paths.
- Wait for approval before building.
π‘ Click "Save to workspace" to store plans in
.cursor/plans/. This creates documentation for your team, makes it easy to resume interrupted work, and provides context for future agents working on the same feature.
Design to Code
The agent can process images directly.
- Workflow: Drag a screenshot or design file into the chat.
- Prompt: "Implement this UI using our existing
@buttons.component.tsand Tailwind colors."
βοΈ Phase 5: Project Configuration (Rules)
Move away from generic prompt engineering. Force the AI to follow your team's style guide automatically.
How to Set Up
- Create a folder in root:
.cursor/rules/ - Create rule files (e.g.,
angular-standards.mdc).
Example Rule (.cursor/rules/angular-standards.mdc)
---
description: Standards for Angular Components
globs: '**/*.ts'
---
# Angular Standards
- Use **Signals** for state.
- Use `@if` syntax, not `*ngIf`.
Best Practices for Rules
- Keep it brief: Under 500 lines.
- Use Globs: Ensure rules only load for relevant files (
**/*.tsvs**/*.py). - No Fluff: Don't document generic things (the AI knows Python). Focus on your specific patterns.
- Reference Files: Instead of pasting large code blocks, refer to canonical examples in your codebase.
Keep rules focused on the essentials: the commands to run, the patterns to follow, and pointers to canonical examples in your codebase. Reference files instead of copying their contents; this keeps rules short and prevents them from becoming stale as code changes.
What to avoid in rules:
- Copying entire style guides (use a linter instead)
- Documenting every possible command (the agent knows common tools)
- Adding instructions for edge cases that rarely apply
Tip: Start simple. Add rules only when you notice the agent making the same mistake repeatedly. Don't over-optimize before you understand your patterns.
Check your rules into git so your whole team benefits. When you see the agent make a mistake, update the rule. You can even tag
@cursoron a GitHub issue or PR to have the agent update the rule for you.
π Phase 6: Advanced Workflows
Once you have the basics, use these workflows to speed up complex tasks.
π§ͺ Test-Driven Development (TDD)
Agents perform best when they have a clear target (a failing test) to iterate against.
- Write Tests: "Write a test for
auth.tscovering the logout edge case. Do not implement the logic yet." - Confirm Failure: Run the test to ensure it fails.
- Implement: "Write the code to pass the test. Do not modify the test file."
- Refactor: Once green, ask the agent to optimize.
π Debug Mode
When standard chat fails, toggle Debug Mode.
- It generates hypotheses.
- It adds logging statements automatically.
- It analyzes runtime data to pinpoint root causes.
- It makes targeted fixes based on evidence
π€ Custom Commands
Store frequent workflows in .cursor/commands/.
Example: The /pr Command
Prompt: "Look at staged changes. Write a commit message. Push to current branch. Use gh pr create to open a pull request with a summary."
Create a pull request for the current changes.
1. Look at the staged and unstaged changes with `git diff`
2. Write a clear commit message based on what changed
3. Commit and push to the current branch
4. Use `gh pr create` to open a pull request with title/description
5. Return the PR URL when done
Commands are ideal for workflows you run many times per day. Store them as Markdown files in .cursor/commands/ and
check them into git so your whole team can use them.
Other examples of commands we use:
/fix-issue [number]: Fetch issue details withgh issue view, find relevant code, implement a fix, and open a PR/review: Run linters, check for common issues, and summarize what might need attention/update-deps: Check for outdated dependencies and update them one by one, running tests after each
The agent can use these commands autonomously, so you can delegate multi-step workflows with a single / invocation.
π€ Phase 7: Team Collaboration
Architecture diagrams
For significant changes, ask the agent to generate architecture diagrams. Try prompting: "Create a Mermaid diagram showing the data flow for our authentication system, including OAuth providers, session management, and token refresh." These diagrams are useful for documentation and can reveal architectural issues before code review.
Feature Development Workflow
[ Project ] --> [ Design ] --> [ Code ]
| ^
| |
Test Feedback
| |
v |
[ Verify ]
- Project (PRD): Define feature requirements and success criteria.
- Design: Translate PRD into an approved solution design.
- Code: Implement the feature.
- Test: Validate behavior and stability.
- Verify: Confirm compliance with the PRD.
- Feedback: Iterate on code until verification passes.
Speeding Up Pull Requests
Stop writing manual descriptions.
- Stage your changes (
git add .). - Prompt: "@Branch (Diff with Main) Write a PR description including Summary, Breaking Changes, and Testing Instructions."
The "Auto-Reviewer" (Self-Correction)
Before pushing code, run your own code review.
- Prompt: "@Branch (Diff) Review my staged changes. Look for memory leaks, console.logs, and adherence to project rules."
Code Review
AI-generated code requires more review, not less.
- Agent Review: Click
ReviewβFind Issuesto have the AI critique its own work before you see it. - Self-Correction: Before pushing, prompt: "@Branch (Diff) Review my staged changes. Look for memory leaks and console.logs."
- Architecture Diagrams: For big changes, ask: "Create a Mermaid diagram showing the data flow for our new auth system."
Bugbot for pull requests
Push to source control to get automated reviews on pull requests. Bugbot applies advanced analysis to catch issues early and suggest improvements on every PR.
Onboarding
New to a codebase? Use Cursor to ramp up.
- "How does logging work in this project?"
- "Why are we calling
setUser()instead ofcreateUser()on line 1738?"
β‘ Phase 8: Quick Recipes
Copy-paste these prompt patterns for immediate results.
| Role | Task | Prompt Recipe |
|---|---|---|
| UI Dev | Clone UI | Screenshot table β "Recreate this UI using our existing @buttons component." |
| Backend | Refactor SQL | Highlight SQL β "Convert to TypeORM query builder. Ensure injection protection." |
| QA | Unit Tests | Open file β "@Codebase Write a test that fails when API returns 500." |
| Migrator | Update Libs | "@Web What are the breaking changes in Lucide v0.4? Update icons in @folder." |
π Habits of Power Users: Developing your workflow
The developers who get the most from agents share a few traits:
They write specific prompts. The agent's success rate improves significantly with specific instructions. Compare
"add tests for auth.ts" with "Write a test case for auth.ts covering the logout edge case, using the patterns in
__tests__/ and avoiding mocks."
They iterate on their setup. Start simple. Add rules only when you notice the agent making the same mistake repeatedly. Add commands only after you've figured out a workflow you want to repeat. Don't over-optimize before you understand your patterns.
They review carefully. AI-generated code can look right while being subtly wrong. Read the diffs and carefully review. The faster the agent works, the more important your review process becomes.
They provide verifiable goals. Agents can't fix what they don't know about. Use typed languages, configure linters, and write tests. Give the agent clear signals for whether changes are correct.
They treat agents as capable collaborators. Ask for plans. Request explanations. Push back on approaches you don't like.