/sf-experience:experience-lds-best-practices-applyfrom Salesforce — Experience, LWC & Mobile
Reviews LWC for LDS best practices: UIAPI vs Apex, cache invalidation with refreshApex/notifyRecordUpdateAvailable, schema imports, and record-form data patterns.
Ships in Salesforce — Experience, LWC & Mobile. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Apply the Lightning Data Service guidelines to a Lightning Web Component. Three pillars: data consistency, referential integrity, and UIAPI vs Apex. Focused on the UI API path — GraphQL and upstream data-requirements analysis are handled out-of-band.
getRecord, getRecords, createRecord, updateRecord, deleteRecord, base record form components, or Apex.@salesforce/schema/...) to replace hard-coded field/object names.Do NOT use this skill for:
design-systems-slds-apply).@salesforce/schema imports (Setup → Object Manager → <Object> → Details → API Name; or, when GraphQL serves the read, an SDL pulled from the target org).refreshApex, notifyRecordUpdateAvailable, wire result propagation.@salesforce/schema imports, field constants, object-name resolution, and their propagation through refactors.Per-adapter API reference — references/adapter-apis.md holds Syntax / Parameters / Returns / Usage for every UI API adapter, grouped by family (uiRecordApis, uiListsApis, uiRelatedListApis, uiObjectInfoApis). Each adapter is a # `<name>` block; grep for the backticked name (e.g. # `getRecord`) to jump to its entry. Read this before wiring an adapter; do not paraphrase from memory.
Type catalog — references/wire-adapter-types.md holds every type the adapters return (Record, ObjectInfo, FieldValue, etc.), grouped by category and rendered with the same formatter the legacy MCP tool used. Grep for ## <TypeName> to jump to a specific entry.
Read the applicable reference before editing code.
refreshApex(wiredResult) or notifyRecordUpdateAvailable([{ recordId }]) after any mutation.@salesforce/schema — not string literals. This protects the component against metadata renames.lightning-record-form, lightning-record-edit-form, lightning-record-view-form) for single-record UIs. They ship with validation, SLDS styling, accessibility, and field-level security.Answer Yes / No to each. Any Yes triggers a refactor.
lightning-record-form, lightning-record-edit-form, or lightning-record-view-form would suffice?record.data.fields.Name.value without schema imports?@salesforce/schema import even though it interacts with Salesforce fields?getRecord, updateRecord, or a base record form could handle?List every data operation in the component:
@wire(getRecord, …), @wire(getRecords, …), @wire(someApexMethod, …)).updateRecord, createRecord, deleteRecord, Apex imperative).Walk sections §1–§4 in order. For each section, decide whether it applies to the component under review and record the result in the report. Use the shape below — every section must appear exactly once, either as an issue (violation) under ## LDS Best Practices, or as a compliant entry under ## Sections checked (no issue). Finish with a ## Summary line listing counts and a one-paragraph narrative.
Report shape:
## LDS Best Practices
- §<N> <section title> — <file>:<lines>
Issue: <what is wrong, specifically citing the pattern in the code>
Fix: <the corrective change, naming the exact import / API to use>
Applied: <yes | no>
## Sections checked (no issue)
- §<N> <section title> — <file>:<lines>
Status: Compliant (no action).
Evidence: <what in the code makes this section compliant — cite lines, imports, and the base component or schema token being used>
## Summary
- <X> issue(s) found; <Y> fixed; <Z> deferred.
- <one-paragraph narrative of the review — what the component does, why the flagged issues matter, and why the compliant sections are compliant.>
Rules for producing this report:
## Sections checked (no issue).## LDS Best Practices, only list actual violations. If there are no violations, write "No best-practice issues found." as the first line, then move every section to the compliant block.For every hard-coded API name:
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
Use these constants everywhere the object or field is referenced — wire configs, @wire field arrays, getFieldValue(record, NAME_FIELD) calls, and base-component object-api-name / fields attributes.
Full rules: references/lds-referential-integrity.md.
updateRecord, createRecord, deleteRecord), dispatch a refresh:
import { updateRecord, getRecord } from 'lightning/uiRecordApi';
import { refreshApex } from '@salesforce/apex';
async handleSave() {
await updateRecord({ fields: { Id: this.recordId, Name: this.name } });
await refreshApex(this.wiredRecord);
}
import { notifyRecordUpdateAvailable } from 'lightning/uiRecordApi';
await notifyRecordUpdateAvailable([{ recordId: this.recordId }]);
this.wiredRecord = result; return result.data;) so refreshApex can target them.Full rules: references/lds-data-consistency.md.
getRecord (with fields + schema imports).updateRecord or lightning-record-edit-form.createRecord or lightning-record-form with mode="edit".getRelatedListRecords.getPicklistValues.getObjectInfo / getObjectInfos.When in doubt about adapter shape, grep references/adapter-apis.md for the backticked adapter name (e.g. # `getRecord`) — it has the authoritative parameters, returns, and usage. For @salesforce/schema/<Object>.<Field> paths, confirm the exact API name in Setup → Object Manager → <Object> → Details → API Name. For unfamiliar return types, grep references/wire-adapter-types.md for the type name.
refreshApex called exactly once per mutation).experience-lwc-generate — when the review surfaces the need to regenerate rather than patch the component.design-systems-slds-apply — for SLDS class / design-token cleanup surfaced by the LDS review.Base-component first (preferred)
<template>
<lightning-record-form
record-id={recordId}
object-api-name="Account"
fields={fields}
mode="edit"
onsuccess={handleSuccess}>
</lightning-record-form>
</template>
import { LightningElement, api } from 'lwc';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
export default class AccountEditor extends LightningElement {
@api recordId;
fields = [NAME_FIELD, INDUSTRY_FIELD];
handleSuccess() {
this.dispatchEvent(new CustomEvent('saved'));
}
}
Imperative update with refresh
import { LightningElement, api, wire } from 'lwc';
import { getRecord, updateRecord } from 'lightning/uiRecordApi';
import { refreshApex } from '@salesforce/apex';
import ACCOUNT_NAME from '@salesforce/schema/Account.Name';
export default class RenameAccount extends LightningElement {
@api recordId;
wiredRecord;
@wire(getRecord, { recordId: '$recordId', fields: [ACCOUNT_NAME] })
wired(result) {
this.wiredRecord = result;
}
async handleRename(event) {
await updateRecord({ fields: { Id: this.recordId, Name: event.detail } });
await refreshApex(this.wiredRecord);
}
}
@salesforce/schema/ imports — they should cover every field/object the component references.'Account', 'Name') — none should appear in wire configs or field arrays.refreshApex, notifyRecordUpdateAvailable, or a base form handling it internally).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
lightning-data-service, lwc, salesforce, cache-invalidation, ui-api
npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-experience3 plugins in 2 repositories ship this exact skill · first indexed Aug 23, 2026
48 skills in this plugin
/commerce-b2b-open-code-components-integrateIntegrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention "integrate open code components", "open source B2B commerce", "add open code components", "forcedotcom/b2b-commerce-open-source-components", or want to add open source commerce components to their store. Copies all components and labels so they become available in Experience Builder./commerce-b2b-open-code-components-replaceReplace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code `site:` component for OOTB definitions. Use when users mention "replace OOTB components", "replace commerce components with open code", "swap OOTB for open source", "replace commerce_builder:", "replace OOTB in site", "replace component in site metadata", "replace component definition", "find open code equivalent", "equivalent open code component", "OOTB to open code mapping", "what is the site component for", components "in this view" or "for a given view", or a specific list of component names — and want to update or only discover mappings in their store metadata.Other plugins' skills for the same job