salesforce-local-dev-loop
Configure Salesforce local development with scratch orgs, SFDX, and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with Salesforce. Trigger with phrases like "salesforce dev setup", "salesforce local development", "salesforce scratch org", "sfdx project", "develop with salesforce".
Best use case
salesforce-local-dev-loop is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Configure Salesforce local development with scratch orgs, SFDX, and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with Salesforce. Trigger with phrases like "salesforce dev setup", "salesforce local development", "salesforce scratch org", "sfdx project", "develop with salesforce".
Teams using salesforce-local-dev-loop should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/salesforce-local-dev-loop/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How salesforce-local-dev-loop Compares
| Feature / Agent | salesforce-local-dev-loop | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Configure Salesforce local development with scratch orgs, SFDX, and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with Salesforce. Trigger with phrases like "salesforce dev setup", "salesforce local development", "salesforce scratch org", "sfdx project", "develop with salesforce".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
# Salesforce Local Dev Loop
## Overview
Set up a fast, reproducible local development workflow using Salesforce CLI (sf), scratch orgs, and jsforce with hot reload.
## Prerequisites
- Completed `salesforce-install-auth` setup
- Salesforce CLI installed (`npm install -g @salesforce/cli`)
- Dev Hub enabled in your production org (Setup > Dev Hub)
- Node.js 18+ with npm/pnpm
## Instructions
### Step 1: Create SFDX Project Structure
```bash
# Initialize a new SFDX project
sf project generate --name my-sf-project --template standard
# Project structure created:
# my-sf-project/
# ├── config/
# │ └── project-scratch-def.json # Scratch org definition
# ├── force-app/
# │ └── main/default/ # Metadata source (Apex, LWC, etc.)
# ├── scripts/
# │ └── apex/ # Anonymous Apex scripts
# ├── sfdx-project.json # Project config
# └── .sf/ # Local CLI state
```
### Step 2: Create a Scratch Org
```bash
# Authenticate to your Dev Hub first
sf org login web --set-default-dev-hub --alias DevHub
# Create a scratch org (expires in 7 days by default)
sf org create scratch \
--definition-file config/project-scratch-def.json \
--alias my-scratch \
--duration-days 7 \
--set-default
# Open scratch org in browser
sf org open --target-org my-scratch
```
### Step 3: Configure scratch-def for development
```json
{
"orgName": "My Dev Org",
"edition": "Developer",
"features": ["EnableSetPasswordInApi", "MultiCurrency"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"securitySettings": {
"passwordPolicies": {
"enableSetPasswordInApi": true
}
}
}
}
```
### Step 4: Node.js Integration Dev Loop
```
my-integration/
├── src/
│ ├── salesforce/
│ │ ├── connection.ts # jsforce connection wrapper
│ │ ├── accounts.ts # Account operations
│ │ ├── contacts.ts # Contact operations
│ │ └── queries.ts # SOQL query builders
│ └── index.ts
├── tests/
│ ├── unit/
│ │ └── queries.test.ts # Mock-based tests
│ └── integration/
│ └── accounts.test.ts # Live org tests
├── .env.local # Local secrets (git-ignored)
├── .env.example # Template for team
└── package.json
```
### Step 5: Configure Hot Reload
```json
{
"scripts": {
"dev": "tsx watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"test:integration": "SF_ENV=scratch vitest run tests/integration/",
"push": "sf project deploy start --target-org my-scratch",
"pull": "sf project retrieve start --target-org my-scratch"
}
}
```
### Step 6: Configure Testing with Mocked Connections
```typescript
import { describe, it, expect, vi } from 'vitest';
// Mock jsforce for unit tests — no live org needed
vi.mock('jsforce', () => ({
default: {
Connection: vi.fn().mockImplementation(() => ({
login: vi.fn().mockResolvedValue({ id: '005xx', organizationId: '00Dxx' }),
query: vi.fn().mockResolvedValue({
totalSize: 1,
done: true,
records: [{ Id: '001xx', Name: 'Test Account', Industry: 'Tech' }],
}),
sobject: vi.fn().mockReturnValue({
create: vi.fn().mockResolvedValue({ id: '001xx', success: true }),
update: vi.fn().mockResolvedValue({ id: '001xx', success: true }),
destroy: vi.fn().mockResolvedValue({ id: '001xx', success: true }),
}),
})),
},
}));
describe('Account Service', () => {
it('should query accounts with SOQL', async () => {
const conn = new (await import('jsforce')).default.Connection({});
const result = await conn.query("SELECT Id, Name FROM Account LIMIT 5");
expect(result.totalSize).toBe(1);
expect(result.records[0].Name).toBe('Test Account');
});
});
```
## Output
- SFDX project with scratch org configured
- Hot reload development server running
- Unit tests with mocked jsforce connections
- Integration tests against scratch org
- Fast iteration cycle: edit, auto-reload, test
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `ERROR: No default dev hub` | Dev Hub not set | Run `sf org login web --set-default-dev-hub` |
| `INVALID_OPERATION: scratch org limit` | Hit scratch org limit (6 active) | Delete old orgs: `sf org delete scratch --target-org old-alias` |
| `SourceConflictError` | Local/remote metadata conflicts | Run `sf project retrieve start` to sync |
| `MODULE_NOT_FOUND: jsforce` | Not installed | Run `npm install jsforce` |
| `sf: command not found` | CLI not installed | Run `npm install -g @salesforce/cli` |
## Resources
- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/)
- [Scratch Org Definition File](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm)
- [jsforce Documentation](https://jsforce.github.io/document/)
- [Vitest Documentation](https://vitest.dev/)
## Next Steps
See `salesforce-sdk-patterns` for production-ready code patterns.Related Skills
workhuman-local-dev-loop
Workhuman local dev loop for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman local dev loop".
wispr-local-dev-loop
Wispr Flow local dev loop for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr local dev loop".
windsurf-local-dev-loop
Configure Windsurf local development workflow with Cascade, Previews, and terminal integration. Use when setting up a development environment, configuring Turbo mode, or establishing a fast iteration cycle with Windsurf AI. Trigger with phrases like "windsurf dev setup", "windsurf local development", "windsurf dev environment", "windsurf workflow", "develop with windsurf".
webflow-local-dev-loop
Configure a Webflow local development workflow with TypeScript, hot reload, mocked API tests, and webhook tunneling via ngrok. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with the Webflow Data API. Trigger with phrases like "webflow dev setup", "webflow local development", "webflow dev environment", "develop with webflow".
vercel-local-dev-loop
Configure Vercel local development with vercel dev, environment variables, and hot reload. Use when setting up a development environment, testing serverless functions locally, or establishing a fast iteration cycle with Vercel. Trigger with phrases like "vercel dev setup", "vercel local development", "vercel dev environment", "develop with vercel locally".
veeva-local-dev-loop
Veeva Vault local dev loop for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva local dev loop".
vastai-local-dev-loop
Configure Vast.ai local development with testing and fast iteration. Use when setting up a development environment, testing instance provisioning, or building a fast iteration cycle for GPU workloads. Trigger with phrases like "vastai dev setup", "vastai local development", "vastai dev environment", "develop with vastai".
twinmind-local-dev-loop
Set up local development workflow with TwinMind API integration. Use when building applications that integrate TwinMind transcription, testing API calls locally, or developing meeting automation tools. Trigger with phrases like "twinmind dev setup", "twinmind local development", "twinmind API testing", "build with twinmind".
together-local-dev-loop
Together AI local dev loop for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together local dev loop".
techsmith-local-dev-loop
TechSmith local dev loop for Snagit COM API and Camtasia automation. Use when working with TechSmith screen capture and video editing automation. Trigger: "techsmith local dev loop".
supabase-local-dev-loop
Configure Supabase local development with the CLI, Docker, and migration workflow. Use when initializing a Supabase project locally, starting the local stack, writing migrations, seeding data, or iterating on schema changes. Trigger with phrases like "supabase local dev", "supabase start", "supabase init", "supabase db reset", "supabase local setup".
stackblitz-local-dev-loop
Configure local development for WebContainer applications with hot reload and testing. Use when building browser-based IDEs, testing WebContainer file operations, or setting up development workflows for WebContainer projects. Trigger: "stackblitz dev setup", "webcontainer local", "test webcontainers locally".