Salesforce + Cursor · Apex and LWC for delivery teams
A user story goes in. Tested, deployable Apex + LWC comes out. You review one PR.
Exactly what the agent does
1
Reads the story
Jira CRM-3421
2
Reads your org
SOQL + metadata
3
Writes Apex + LWC
8 files
4
Writes the tests
94% coverage
5
Validates deploy
UAT · RunSpecifiedTests
6
Opens the PR
you review + deploy
~18 minutes unattended vs ~6 hours by hand. Every primitive is a real file in .cursor/.
Built against your real org
It reads your schema and trigger framework over the DX MCP before writing a line. No guessed field names.
Zero click-through
SOQL, metadata, deploys, and test runs happen over MCP. You never hunt Setup or paste failing logs into chat.
You own production
The agent stops at a validated UAT deploy and a PR. A human runs the Quick Deploy.
Guardrails every build clears
Consultant workflow · before and after
Same Salesforce story, same human approval. Cursor compresses the manual click-through into one grounded, reviewable delivery pack.
Stage
Refine
Jira + Confluence + Setup
Re-read the story, hunt objects and field names, rewrite it as a technical spec.
Cursor intake + rules
The story becomes a constrained build plan under your Apex standards.
Stage
Org discovery
Setup, Schema Builder, VS Code
Copy field API names, SOQL the data, trace the existing trigger and automations.
DX MCP evidence
SOQL + metadata come straight from the org over MCP. Zero click-through.
Stage
Build
VS Code + LWC + Apex tests
Write the handler, service, LWC, and a test class with a bulk run to clear 75%.
Apex + LWC subagents
Specialists write 8 files in parallel, tests included, coverage at 94%.
Stage
Review
Code Analyzer, Apex tests, GitHub
Run Code Analyzer, copy failing logs back and forth, fix formatting, collect evidence.
Hooks + Codex gate
Hooks format and scan; Codex checks bulkification, CRUD/FLS, and coverage.
Stage
Client handoff
Change sets / DevOps Center, GitHub, Jira
Assemble the change set, validate against UAT, write the PR, update the story.
PR + deploy pack
PR, validated UAT deploy, test results, and the story linked into one pack.
Today you click through Setup to find field API names, copy Apex into an assistant, paste the suggestion back, deploy a change set, run Code Analyzer, and copy the failing test log back again. Each Cursor primitive replaces one manual round-trip, wired with real files you can read in .cursor/.
MCP
Manual round-trip
Hunt field names in Setup, paste Apex through chat, click change sets.
With Cursor
SOQL, metadata, deploys, and test runs happen directly over the DX MCP.
Rules
Manual round-trip
Re-explain bulkification, sharing, and the 75% rule in every chat.
With Cursor
.cursor/rules inject your standards every session, version-controlled.
Hooks
Manual round-trip
Hand-format, run Code Analyzer, paste red test output back.
With Cursor
Hooks format, scan, and re-run tests; failures bounce back to the agent.
Subagents
Manual round-trip
Carry context between separate chats for Apex, LWC, and deploy work.
With Cursor
A planner runs Apex, LWC, deploy, and review specialists in parallel.
Cloud agents
Manual round-trip
Babysit the edit-deploy-test-PR loop at your desk.
With Cursor
A cloud VM runs the whole loop unattended and hands you a verified PR.
Straight talk
@salesforce/mcp) is published by Salesforce and wraps the Salesforce CLI. Cursor speaks to it over the open MCP standard; Cursor itself ships no native Salesforce connector.stop loop run on your local IDE agent; the cloud agent uses afterFileEdit / beforeShellExecution plus the verified-PR handoff.cursor.com/agents and the agent authenticates to your sandboxes with sfdx auth URLs held as secrets.Reference config: docs/partner-demos/salesforce-cursor-config/
Beyond the headline build
The scripted demo is one motion. Here is the rest of what your team does with Cursor across a client implementation.
Build + deploy
Story in; bulkified Apex, the LWC, tests over 75%, and a validated deploy out. You review one PR.
Faster delivery
The agent writes the test class, real asserts plus a 200-record bulk run, and runs it over MCP. The chore everyone dreads, gone.
Grounded agents
SOQL and metadata come over the DX MCP, so generated code targets your actual schema and automations.
Migrate
The agent maps an inherited org, converts legacy automation to Flow, and refactors triggers into a handler framework.
Integrate
Apex callouts, named credentials, and platform events built from the actual WSDL/OpenAPI and org metadata.
Reusable accelerator
The MCP wiring, rules, deploy gates, and subagent roles become a kit every new engagement inherits on day one.
Every primitive below is a concrete file your team commits. The skills, subagents, and rules are real in .cursor/; the runtime config lives in docs/partner-demos/salesforce-cursor-config/.
Architecture
3 trigger surfaces
Jira story · Slack /build · DevOps Center work item
Cursor cloud agent
environment.json · Salesforce CLI · sandbox auth
1 MCP · 4 subagents · 4 hooks
planner + Apex/LWC/deploy/review, each scoped
salesforce-build
Turn a plain-English user story into a bulkified Apex check + an LWC warning + an Apex test class over 75% + a validated deployment + a PR, in one orchestrated run.
apex-engineer
Composer 2.5
lwc-engineer
Composer 2.5
deployment-steward
Composer 2.5
apex-reviewer
Codex
Ground the story in the real org, fix the contract, dispatch specialists, synthesize a deploy-ready change set, open the PR. Never writes code itself.
.cursor/skills/salesforce-build-planner/SKILL.md
Write the bulkified Apex (trigger handler, service, Apex tests to clear the 75% gate) against the real SObject metadata through the DX MCP. Never click through Setup.
.cursor/agents/salesforce-apex-engineer.md
Write the Lightning Web Component bound to the cacheable Apex method, with a Jest test. Keep it accessible and on the record page.
.cursor/agents/salesforce-lwc-engineer.md
Capture every component into one validated deployment, run the right test level, stage to the UAT sandbox. Never deploy to production.
.cursor/agents/salesforce-deployment-steward.md
Review bulkification, governor limits, CRUD/FLS, sharing, and 75% test coverage before deploy. Blocks; does not patch.
.cursor/agents/apex-reviewer.md
Story in, grounded Apex + LWC + tests at 94%, a validated UAT deploy, and a PR out. ~18 minutes, unattended.
Run the scripted demo