grzmol/vibe-force/sf-local-development
Claude Code and agent skill by grzmol/vibe-force
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Covers the Salesforce development loop that runs before any deployment - Live Preview (formerly Local Dev) via sf lightning dev app, sf lightning dev component and sf lightning dev site, what hot-reloads versus what needs a redeploy and server restart, which checks genuinely run offline (prettier, ESLint, Code Analyzer, sfdx-lwc-jest) versus which need an org (Apex compilation and tests, Flow, permissions, SOQL), source-tracking hygiene with sf project deploy preview, --dry-run and sf project retrieve start, watch loops, anonymous Apex probes, VS Code and devcontainer setup, and the exact composition of the vf-check local gate. Use this skill when starting work on a component before deploying, when deciding whether a change can be verified without an org, when the preview server does not pick up a change, when source tracking reports conflicts, or when a contributor asks how to iterate quickly on LWC or Apex.
Install
npx vskill@latest install grzmol/vibe-force/sf-local-developmentSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as majiayu000/claude-skill-registry/sf-local-development.
Salesforce Local Development Loop
When to use
| Situation | Use this skill | |
|---|---|---|
| Iterating on an LWC before deploying | Yes | |
| Deciding whether a change can be proven without an org | Yes | |
sf lightning dev ... fails, or a change does not appear in the preview | Yes | |
| Previewing empty, error or long-text states the org has no records for | Yes - pattern 9 | |
| Source tracking reports conflicts between project and org | Yes | |
| Writing the component | Skill sf-lwc-development | |
| Writing or fixing Jest tests | Skill sf-lwc-jest-testing | |
| Creating or refreshing the org itself | Skill sf-scratch-orgs-sandboxes | |
| Analyzer/lint findings | Skill sf-code-analyzer-quality | |
| Reading debug logs after a failure | Skill sf-debugging-logs |
Naming: Salesforce rebranded Local Dev to Live Preview in Spring '26. The CLI command names (sf lightning dev app|component|site) did not change.
Decision table: what runs where
| Activity | Offline (no org) | Needs an org | |
|---|---|---|---|
prettier --check / --write | Yes | - | |
eslint on LWC/Aura JS | Yes | - | |
sf code-analyzer run (PMD, ESLint, Regex, RetireJS) | Yes | - | |
sfdx-lwc-jest unit tests and coverage | Yes | - | |
| LWC template/JS compile errors | Yes (Jest and ESLint surface most) | Full validation at deploy | |
| Rendering a component with real record data | - | Yes (Live Preview proxies org data) | |
| Apex compilation | - | Yes (--dry-run deploy) | |
| Apex unit tests | - | Yes | |
| SOQL results, sharing, FLS | - | Yes | |
| Flow, validation rules, permission sets | - | Yes | |
| Platform events, callouts, named credentials | - | Yes |
There is no local Apex runtime. The fastest Apex feedback is a check-only deploy (sf project deploy start --dry-run) or an anonymous block (sf apex run).
Core patterns
1. Prerequisites
The Salesforce CLI installs the Live Preview plugin automatically; a manual sf plugins install @salesforce/plugin-lightning-dev is only needed when the plugin was explicitly removed. The first sf lightning dev run prompts to enable the feature in the target org - press Enter or type y. Enabling requires the View Setup and Customize Application permissions. The project must contain an lwc directory (typically force-app/main/default/lwc).
2. First run against a scratch org
Run Live Preview against scratch orgs and sandboxes. It is technically available in production, but Salesforce recommends against it and the vibe-force hooks treat any production alias as protected.
3. The three preview modes
Omit --name to get an interactive picker. Flag tables for all three commands: references/local-dev-server.md.
4. What hot-reloads and what does not
| Change | Reflected automatically | |
|---|---|---|
| HTML attribute or markup edit | Yes | |
| Component CSS edit | Yes | |
Adding a <lightning-*> or existing custom component to markup | Yes | |
| Importing a new CSS-only component | Yes | |
| JavaScript change that does not alter the public API | Yes | |
| Adding or deleting a file inside an existing bundle | Yes (Spring '25 and later) | |
New @api property or method | No - browser refresh for a component preview, deploy + server restart for app/site | |
| Wire adapter changes (new adapter, config change, GraphQL query change) | No | |
New @salesforce scoped import | No | |
.js-meta.xml change | No - only .js, .html, .css hot-reload, and a meta edit needs a deploy in every mode | |
| Service component library change | No | |
| Apex, objects, flows, permissions | No - always a deploy |
Recovery for a non-reloading change:
Other limits: Live Preview previews Lightning web components only (no Aura), and Landing Pages cannot be previewed. Changes saved directly in the org are deployed to the live app automatically, but your local copy is not updated until you run sf project retrieve start.
5. The offline gate
local = static + jest, that is:
| Step | Command behind it | Fails when | |
|---|---|---|---|
format | prettier --check on changed Apex/LWC/XML/JS | Any file is unformatted (--fix rewrites) | |
lint | eslint on LWC/Aura JS | Any error-severity rule fires | |
analyzer | sf code-analyzer run with config/code-analyzer.yml | A violation at or above gates.analyzerFailSeverity (3) | |
jest | sfdx-lwc-jest | A test fails, coverage < gates.jestCoverageMin (80), or an LWC bundle has no __tests__ (*Harness and *Fixtures bundles are exempt - pattern 9) |
No org, no network. Exit 0 pass, 1 gate failure, 2 missing tooling, 3 org/network (not reachable for this gate). Run it before every handoff to wave 3.
6. Watch loops
Recommended terminal layout while building a component: one pane running sf lightning dev component --name <bundle> --target-org vf-dev, one running npm run test:unit:watch, one for CLI commands. Do not put sf project deploy start in a file watcher: metadata deploys are rate-limited and source tracking conflicts multiply.
7. Source tracking hygiene
Conflict rules: --ignore-conflicts (-c) exists on deploy start, deploy preview, retrieve start, and retrieve preview, and it silently overwrites the other side. Resolve conflicts by inspecting the preview output and choosing per component; reserve -c for scratch orgs you are willing to lose. Source tracking is on by default for scratch orgs and sandboxes unless they were created with --no-track-source, and never available in production.
8. Apex feedback without a deploy
sf apex run with no flags reads an interactive block from stdin (CTRL-D to execute). Anonymous Apex is a probe, not a test: it neither counts toward coverage nor proves the contract. See skills sf-apex-development and sf-apex-testing.
9. Component data without org records
sf lightning dev component renders a bundle with whatever its own defaults produce - there is no property editor and no state switcher. Seeding org records covers the happy path; the loading, empty, error and long-text states still need data you control. Never add an isDemo branch to the component to make a preview work.
The pattern: one fixture module, two consumers.
| Piece | Path | Package directory | Purpose | |
|---|---|---|---|---|
| Component | lwc/accountCard/ | default (force-app) | Ships | |
| Fixtures | lwc/accountCardFixtures/ | default (force-app) | Every state, one definition | |
| Harness | lwc/accountCardHarness/ | preview only (preview-app) | Mounts the component per state | |
| Spec | lwc/accountCard/__tests__/ | default (force-app) | Imports the same fixtures |
Fixtures sit beside the component so sfdx-lwc-jest resolves c/accountCardFixtures the same way it resolves any sibling bundle. The harness sits in its own package directory so it never reaches production.
Never include preview-app in a production deploy: deploy by --source-dir or by manifest, not by sf project deploy start with no arguments, which takes every package directory. The harness does not need to be in any org to be previewed - the component list is built from the local project
- so in practice the preview directory stays undeployed everywhere.
Naming is load-bearing. vf-check pairing exempts bundle names matching gates.previewBundlePattern (default (?:Harness|Fixtures)$) from gates.requireJestForLwc, and the reference Jest config drops the same bundles from collectCoverageFrom - a wrapper with no behaviour of its own would otherwise fail the spec gate and dilute coverage. Every exemption is named in the check log, so narrow the pattern when a shipped component's name collides. Skeletons to copy: ${CLAUDE_PLUGIN_ROOT}/templates/lwc/exampleCardFixtures/ and ${CLAUDE_PLUGIN_ROOT}/templates/lwc/exampleCardHarness/.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sf-local-development/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grzmol/vibe-force/sf-local-development)