sf-lwc: Lightning Web Components Development
Use this skill when the user needs Lightning Web Components: LWC bundles, wire patterns, Apex/GraphQL integration, SLDS 2 styling, accessibility, performance work, or Jest unit tests.
When This Skill Owns the Task
Use sf-lwc when the work involves:
lwc/**/*.js, .html, .css, .js-meta.xml
- component scaffolding and bundle design
- wire service, Apex integration, GraphQL integration
- SLDS 2, dark mode, and accessibility work
- Jest unit tests for LWC
Delegate elsewhere when the user is:
- writing Apex controllers or business logic first → sf-apex
- building Flow XML rather than an LWC screen component → sf-flow
- deploying metadata → sf-deploy
Required Context to Gather First
Ask for or infer:
- component purpose and target surface
- data source: LDS, Apex, GraphQL, LMS, or external system via Apex
- whether the user needs tests
- whether the component must run in Flow, App Builder, Experience Cloud, or dashboard contexts
- accessibility and styling expectations
Recommended Workflow
1. Choose the right architecture
Use the PICKLES mindset:
- prototype
- integrate the right data source
- compose component boundaries
- define interaction model
- use platform libraries
- optimize execution
- enforce security
2. Choose the right data access pattern
| Need |
Default pattern |
| single-record UI |
LDS / getRecord |
| simple CRUD form |
base record form components |
| complex server query |
Apex @AuraEnabled(cacheable=true) |
| related graph data |
GraphQL wire adapter |
| cross-DOM communication |
Lightning Message Service |
3. Start from an asset when useful
Use provided assets for:
- basic component bundles
- datatables
- modal patterns
- Flow screen components
- GraphQL components
- LMS message channels
- Jest tests
- TypeScript-enabled components
4. Validate for frontend quality
Check:
- accessibility
- SLDS 2 / dark mode compliance
- event contracts
- performance / rerender safety
- Jest coverage when required
5. Hand off supporting backend or deploy work
Use:
High-Signal Rules
- prefer platform base components over reinventing controls
- use
@wire for reactive read-only use cases; imperative calls for explicit actions and DML paths
- do not introduce inaccessible custom UI
- avoid hardcoded colors; use SLDS 2-compatible styling hooks / variables
- avoid rerender loops in
renderedCallback()
- keep component communication patterns explicit and minimal
Output Format
When finishing, report in this order:
- Component(s) created or updated
- Data access pattern chosen
- Files changed
- Accessibility / styling / testing notes
- Next implementation or deploy step
Suggested shape:
LWC work: <summary>
Pattern: <wire / apex / graphql / lms / flow-screen>
Files: <paths>
Quality: <a11y, SLDS2, dark mode, Jest>
Next step: <deploy, add controller, or run tests>
Local Development Server
Preview LWC components locally with hot reload — no deployment needed:
# Preview LWC components in isolation
sf lightning dev component --target-org <alias>
# Preview a Lightning Experience app locally
sf lightning dev app --target-org <alias>
# Preview an Experience Cloud site locally
sf lightning dev site --target-org <alias>
In current SF CLI releases, these Local Dev commands are installed just-in-time the first time you run them. They are long-running processes that open a browser with live preview. Changes to .js, .html, and .css files auto-reload instantly. Requires an active org connection for data and Apex callouts.
Cross-Skill Integration
| Need |
Delegate to |
Reason |
| Apex controller or service |
sf-apex |
backend logic |
| embed in Flow screens |
sf-flow |
declarative orchestration |
| deploy component bundle |
sf-deploy |
org rollout |
| create metadata like message channels |
sf-metadata |
supporting metadata |
Reference Map
Start here
- references/component-patterns.md
- references/slds-design-guide.md
- references/lwc-best-practices.md
- references/scoring-and-testing.md
- references/jest-testing.md
Accessibility / performance / state
- references/accessibility-guide.md
- references/performance-guide.md
- references/state-management.md
- references/template-anti-patterns.md
Integration / advanced features
- references/lms-guide.md
- references/flow-integration-guide.md
- references/advanced-features.md
- references/async-notification-patterns.md
- references/triangle-pattern.md
- assets/
Score Guide
| Score |
Meaning |
| 150+ |
production-ready LWC bundle |
| 125–149 |
strong component with minor polish left |
| 100–124 |
functional but review recommended |
| < 100 |
needs significant improvement |
1---
2name: sf-lwc
3description: >
4 Lightning Web Components with PICKLES methodology and 165-point scoring.
5 TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html,
6 .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests.
7 DO NOT TRIGGER when: Apex classes (use sf-apex), Aura components, or Visualforce.
8license: MIT
9metadata:
10 source: https://skillmd.com/skills/om-scogo/sf-lwc
11 version: "2.1.0"
12 author: "Jag Valaiyapathy"
13 scoring: "165 points across 8 categories (SLDS 2 + Dark Mode compliant)"
14---
15
16# sf-lwc: Lightning Web Components Development
17
18Use this skill when the user needs **Lightning Web Components**: LWC bundles, wire patterns, Apex/GraphQL integration, SLDS 2 styling, accessibility, performance work, or Jest unit tests.
19
20## When This Skill Owns the Task
21
22Use `sf-lwc` when the work involves:
23- `lwc/**/*.js`, `.html`, `.css`, `.js-meta.xml`
24- component scaffolding and bundle design
25- wire service, Apex integration, GraphQL integration
26- SLDS 2, dark mode, and accessibility work
27- Jest unit tests for LWC
28
29Delegate elsewhere when the user is:
30- writing Apex controllers or business logic first → [sf-apex](../sf-apex/SKILL.md)
31- building Flow XML rather than an LWC screen component → [sf-flow](../sf-flow/SKILL.md)
32- deploying metadata → [sf-deploy](../sf-deploy/SKILL.md)
33
34---
35
36## Required Context to Gather First
37
38Ask for or infer:
39- component purpose and target surface
40- data source: LDS, Apex, GraphQL, LMS, or external system via Apex
41- whether the user needs tests
42- whether the component must run in Flow, App Builder, Experience Cloud, or dashboard contexts
43- accessibility and styling expectations
44
45---
46
47## Recommended Workflow
48
49### 1. Choose the right architecture
50Use the **PICKLES** mindset:
51- prototype
52- integrate the right data source
53- compose component boundaries
54- define interaction model
55- use platform libraries
56- optimize execution
57- enforce security
58
59### 2. Choose the right data access pattern
60| Need | Default pattern |
61|---|---|
62| single-record UI | LDS / `getRecord` |
63| simple CRUD form | base record form components |
64| complex server query | Apex `@AuraEnabled(cacheable=true)` |
65| related graph data | GraphQL wire adapter |
66| cross-DOM communication | Lightning Message Service |
67
68### 3. Start from an asset when useful
69Use provided assets for:
70- basic component bundles
71- datatables
72- modal patterns
73- Flow screen components
74- GraphQL components
75- LMS message channels
76- Jest tests
77- TypeScript-enabled components
78
79### 4. Validate for frontend quality
80Check:
81- accessibility
82- SLDS 2 / dark mode compliance
83- event contracts
84- performance / rerender safety
85- Jest coverage when required
86
87### 5. Hand off supporting backend or deploy work
88Use:
89- [sf-apex](../sf-apex/SKILL.md) for controllers / services
90- [sf-deploy](../sf-deploy/SKILL.md) for deployment
91- [sf-testing](../sf-testing/SKILL.md) only for Apex-side test loops, not Jest
92
93---
94
95## High-Signal Rules
96
97- prefer platform base components over reinventing controls
98- use `@wire` for reactive read-only use cases; imperative calls for explicit actions and DML paths
99- do not introduce inaccessible custom UI
100- avoid hardcoded colors; use SLDS 2-compatible styling hooks / variables
101- avoid rerender loops in `renderedCallback()`
102- keep component communication patterns explicit and minimal
103
104---
105
106## Output Format
107
108When finishing, report in this order:
1091. **Component(s) created or updated**
1102. **Data access pattern chosen**
1113. **Files changed**
1124. **Accessibility / styling / testing notes**
1135. **Next implementation or deploy step**
114
115Suggested shape:
116
117```text
118LWC work: <summary>
119Pattern: <wire / apex / graphql / lms / flow-screen>
120Files: <paths>
121Quality: <a11y, SLDS2, dark mode, Jest>
122Next step: <deploy, add controller, or run tests>
123```
124
125---
126
127## Local Development Server
128
129Preview LWC components locally with hot reload — no deployment needed:
130
131```bash
132# Preview LWC components in isolation
133sf lightning dev component --target-org <alias>
134
135# Preview a Lightning Experience app locally
136sf lightning dev app --target-org <alias>
137
138# Preview an Experience Cloud site locally
139sf lightning dev site --target-org <alias>
140```
141
142In current SF CLI releases, these Local Dev commands are installed just-in-time the first time you run them. They are long-running processes that open a browser with live preview. Changes to `.js`, `.html`, and `.css` files auto-reload instantly. Requires an active org connection for data and Apex callouts.
143
144---
145
146## Cross-Skill Integration
147
148| Need | Delegate to | Reason |
149|---|---|---|
150| Apex controller or service | [sf-apex](../sf-apex/SKILL.md) | backend logic |
151| embed in Flow screens | [sf-flow](../sf-flow/SKILL.md) | declarative orchestration |
152| deploy component bundle | [sf-deploy](../sf-deploy/SKILL.md) | org rollout |
153| create metadata like message channels | [sf-metadata](../sf-metadata/SKILL.md) | supporting metadata |
154
155---
156
157## Reference Map
158
159### Start here
160- [references/component-patterns.md](references/component-patterns.md)
161- [references/slds-design-guide.md](references/slds-design-guide.md)
162- [references/lwc-best-practices.md](references/lwc-best-practices.md)
163- [references/scoring-and-testing.md](references/scoring-and-testing.md)
164- [references/jest-testing.md](references/jest-testing.md)
165
166### Accessibility / performance / state
167- [references/accessibility-guide.md](references/accessibility-guide.md)
168- [references/performance-guide.md](references/performance-guide.md)
169- [references/state-management.md](references/state-management.md)
170- [references/template-anti-patterns.md](references/template-anti-patterns.md)
171
172### Integration / advanced features
173- [references/lms-guide.md](references/lms-guide.md)
174- [references/flow-integration-guide.md](references/flow-integration-guide.md)
175- [references/advanced-features.md](references/advanced-features.md)
176- [references/async-notification-patterns.md](references/async-notification-patterns.md)
177- [references/triangle-pattern.md](references/triangle-pattern.md)
178- [assets/](assets/)
179
180---
181
182## Score Guide
183
184| Score | Meaning |
185|---|---|
186| 150+ | production-ready LWC bundle |
187| 125–149 | strong component with minor polish left |
188| 100–124 | functional but review recommended |
189| < 100 | needs significant improvement |