First Steps
A comprehensive guide to using Cursor for Salesforce development with LWCs, MCP, and Agentforce
What this guide covers
This guide is written for Salesforce SEs on a Mac getting Cursor set up for Agentforce, LWCs, Flows, and Apex. If you're on Windows or Linux, everything still works — the commands and screenshots lean macOS, but we call out the Windows path where it matters. If you haven't spent much time in pro-code tools, you're exactly who this was written for. It assumes nothing.
Don't want to run terminal commands?
Most of the steps in this guide include terminal commands. If you're not comfortable with a shell, you can ask Cursor's Agent to run them for you. A good prompt at any point is: "Follow the steps on this page, stopping to ask me before anything that touches my Salesforce org." The Agent can install tools, scaffold projects, and run sf commands on your behalf.
Foundations
macOS Environment Setup
Install Homebrew, Java, Node.js, Salesforce CLI, and Agentforce DX on macOS
What If I Use Windows?
Git Bash, Node, Java, and the Salesforce CLI on native Windows
Cursor Fundamentals
Chat, Agent, Inline Edit, Tab, context, and models
Your First Project
Scaffold a Salesforce project, authorize an org, and deploy an LWC
Source Tracking & .forceignore
Scratch orgs vs. sandboxes, deploys, retrieves, and the .forceignore file
Git for Salesforce SEs
Branches, commits, pushes, and pull requests for SE workflows
Rules & AGENTS.md
Teach Cursor your conventions with .cursor/rules/*.mdc and AGENTS.md
Tools and integrations
MCP Setup
Connect Cursor to your Salesforce orgs via the Model Context Protocol
MCP Beyond Salesforce
GitHub, Filesystem, Playwright, Context7, Vercel, and more
Multi-Org Workflows
Juggling scratch orgs, customer sandboxes, and per-project defaults
Prompt Library
Reusable prompts for common Salesforce tasks
Coding with Cursor
Debugging Apex in Cursor
Anonymous Apex, debug logs, and the Replay Debugger
Running & Writing Apex Tests
The test panel, coverage, and agent-written test classes
LWC Local Dev & Live Preview
Iterate on LWCs without deploying. Save-reload-see-it in a browser tab.
Security & Data Handling
Privacy Mode, redacting PII, and safe defaults for customer work
Advanced Techniques
Multi-agent orchestration, hooks, and subagents
Agentforce
Agentforce DX
Build Agentforce agents from the command line
Agent vs. Builder vs. Script
Pick between Agentforce Builder, Agent Script, and Prompt Builder
Session Tracing & Agent Testing
Write tests for your agent and read the traces when something fails
Why Cursor for Salesforce
The pitch in one sentence
Cursor gives an SE the same AI workflow an engineer gets, wired into the Salesforce CLI, Org Browser, and Agentforce DX, so you can build and ship a POC in the time it used to take to scope one.
Prerequisites
Before you start, you need:
- A Mac (primary audience) or a Windows laptop — see What If I Use Windows?
- Basic terminal comfort, or the willingness to let Cursor's Agent run commands for you
- A Salesforce org to build in (Dev Edition, Trailhead Playground, scratch org, or sandbox)
- Cursor installed
What you'll have at the end
- A configured Salesforce development environment
- A first Lightning Web Component deployed to an org
- Cursor talking to that org through MCP
- A starter set of rules and
AGENTS.mdin your repo - A library of prompts, rules, and skills you can pull from on the next POC
Ready to start?
Start with macOS Environment Setup and follow the cards down the list. If you're on Windows, begin with What If I Use Windows? first.