🎯

sf-lwc

🎯Skill

from jaganpro/claude-code-sfskills

VibeIndex|
What it does

Generates production-ready Lightning Web Components for Salesforce using PICKLES architecture, ensuring robust, accessible, and performant UI development with comprehensive testing and integration.

πŸ“¦

Part of

jaganpro/claude-code-sfskills(20 items)

sf-lwc

Installation

Install ScriptRun install script
curl -sSL https://raw.githubusercontent.com/Jaganpro/sf-skills/main/tools/install.sh | bash
git cloneClone repository
git clone https://github.com/Jaganpro/sf-skills
PythonRun Python server
python tools/installer.py --cli opencode --all # OpenCode
PythonRun Python server
python tools/installer.py --cli codex --all # Codex (OpenAI)
PythonRun Python server
python tools/installer.py --cli gemini --all # Gemini (Google)

+ 17 more commands

πŸ“– Extracted from docs: jaganpro/claude-code-sfskills
2Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

>

Overview

# sf-lwc: Lightning Web Components Development

Expert frontend engineer specializing in Lightning Web Components for Salesforce. Generate production-ready LWC components using the PICKLES Framework for architecture, with proper data binding, Apex/GraphQL integration, event handling, SLDS 2 styling, and comprehensive Jest tests.

Core Responsibilities

  1. Component Scaffolding: Generate complete LWC bundles (JS, HTML, CSS, meta.xml)
  2. PICKLES Architecture: Apply structured design methodology for robust components
  3. Wire Service Patterns: Implement @wire decorators for data fetching (Apex & GraphQL)
  4. Apex/GraphQL Integration: Connect LWC to backend with @AuraEnabled and GraphQL
  5. Event Handling: Component communication (CustomEvent, LMS, pubsub)
  6. Lifecycle Management: Proper use of connectedCallback, renderedCallback, etc.
  7. Jest Testing: Generate comprehensive unit tests with advanced patterns
  8. Accessibility: WCAG compliance with ARIA attributes, focus management
  9. Dark Mode: SLDS 2 compliant styling with global styling hooks
  10. Performance: Lazy loading, virtual scrolling, debouncing, efficient rendering

---

PICKLES Framework (Architecture Methodology)

The PICKLES Framework provides a structured approach to designing robust Lightning Web Components. Apply each principle during component design and implementation.

```

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ πŸ₯’ PICKLES FRAMEWORK β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ P β†’ Prototype β”‚ Validate ideas with wireframes & mock data β”‚

β”‚ I β†’ Integrate β”‚ Choose data source (LDS, Apex, GraphQL, API) β”‚

β”‚ C β†’ Composition β”‚ Structure component hierarchy & communication β”‚

β”‚ K β†’ Kinetics β”‚ Handle user interactions & event flow β”‚

β”‚ L β†’ Libraries β”‚ Leverage platform APIs & base components β”‚

β”‚ E β†’ Execution β”‚ Optimize performance & lifecycle hooks β”‚

β”‚ S β†’ Security β”‚ Enforce permissions, FLS, and data protection β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

Quick Reference

| Principle | Key Actions |

|-----------|-------------|

| P - Prototype | Wireframes, mock data, stakeholder review, separation of concerns |

| I - Integrate | LDS for single records, Apex for complex queries, GraphQL for related data |

| C - Composition | @api for parent→child, CustomEvent for child→parent, LMS for cross-DOM |

| K - Kinetics | Debounce search (300ms), disable during submit, keyboard navigation |

| L - Libraries | Use lightning/* modules, base components, avoid reinventing |

| E - Execution | Lazy load with lwc:if, cache computed values, avoid infinite loops |

| S - Security | WITH SECURITY_ENFORCED, input validation, FLS/CRUD checks |

For detailed PICKLES implementation patterns, see [resources/component-patterns.md](resources/component-patterns.md)

---

Key Component Patterns

Wire vs Imperative Apex Calls

| Aspect | Wire (@wire) | Imperative Calls |

|--------|--------------|------------------|

| Execution | Automatic / Reactive | Manual / Programmatic |

| DML | ❌ Read-Only | βœ… Insert/Update/Delete |

| Data Updates | βœ… Auto on param change | ❌ Manual refresh |

| Control | Low (framework decides) | Full (you decide) |

| Caching | βœ… Built-in | ❌ None |

Quick Decision: Use @wire for read-only display with auto-refresh. Use imperative for user actions, DML, or when you need control over timing.

For complete comparison with code examples and decision tree, see [resources/component-patterns.md](resources/component-patterns.md#wire-vs-imperative-apex-calls)

Data Source Decision Tree

| Scenario | Recommended Approach |

|----------|---------------------|

| Single record by ID | Lightning Data Service (getRecord) |

| Simple record CRUD | lightning-record-form / lightning-record-edit-form |

| Complex queries | Apex with @AuraEnabled(cacheable=true) |

| Related records | GraphQL wire adapter |

| Real-time updates | Platform Events / Streaming API |

| External data | Named Credentials + Apex callout |

Communication Patterns

| Pattern | Direction | Use Case |

|---------|-----------|----------|

| @api properties | Parent β†’ Child | Pass data down |

| Custom Events | Child β†’ Parent | Bubble actions up |

| Lightning Message Service | Any β†’ Any | Cross-DOM communication |

| Pub/Sub | Sibling β†’ Sibling | Same page, no hierarchy |

Communication Pattern Quick Reference

```

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ LWC COMMUNICATION - MADE SIMPLE β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ β”‚

β”‚ Parent β†’ Child β”‚ [Parent] ─────→ [Child] β”‚ @api properties β”‚

β”‚ β”‚

β”‚ Child β†’ Parent β”‚ [Child] ─────→ [Parent] β”‚ Custom Events β”‚

β”‚ β”‚

β”‚ Sibling Components β”‚ [A] β†’ [Parent] β†’ [B] β”‚ Events + @api β”‚

β”‚ β”‚

β”‚ Unrelated β”‚ [Comp 1] ←─LMS─→ [Comp 2] β”‚ Message Service β”‚

β”‚ β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

Decision Tree:

  • Same parent? β†’ Use parent as middleware (events up, @api down)
  • Different DOM trees? β†’ Use Lightning Message Service
  • LWC ↔ Aura/VF? β†’ Use Lightning Message Service

For complete sibling communication code example, see [resources/component-patterns.md](resources/component-patterns.md#sibling-communication-via-parent)

Lifecycle Hook Guidance

| Hook | When to Use | Avoid |

|------|-------------|-------|

| constructor() | Initialize properties | DOM access (not ready) |

| connectedCallback() | Subscribe to events, fetch data | Heavy processing |

| renderedCallback() | DOM-dependent logic | Infinite loops, property changes |

| disconnectedCallback() | Cleanup subscriptions/listeners | Async operations |

For complete code examples (Wire Service, GraphQL, Modal, Navigation, TypeScript), see:

  • [resources/component-patterns.md](resources/component-patterns.md) - Comprehensive patterns with full source code
  • [resources/lms-guide.md](resources/lms-guide.md) - Lightning Message Service deep dive

---

SLDS 2 Validation (165-Point Scoring)

The sf-lwc skill includes automated SLDS 2 validation that ensures dark mode compatibility, accessibility, and modern styling.

| Category | Points | Key Checks |

|----------|--------|------------|

| SLDS Class Usage | 25 | Valid class names, proper slds-* utilities |

| Accessibility | 25 | ARIA labels, roles, alt-text, keyboard navigation |

| Dark Mode Readiness | 25 | No hardcoded colors, CSS variables only |

| SLDS Migration | 20 | No deprecated SLDS 1 patterns/tokens |

| Styling Hooks | 20 | Proper --slds-g-* variable usage |

| Component Structure | 15 | Uses lightning-* base components |

| Performance | 10 | Efficient selectors, no !important |

| PICKLES Compliance | 25 | Architecture methodology adherence (optional) |

Scoring Thresholds:

```

⭐⭐⭐⭐⭐ 150-165 pts β†’ Production-ready, full SLDS 2 + Dark Mode

⭐⭐⭐⭐ 125-149 pts β†’ Good component, minor styling issues

⭐⭐⭐ 100-124 pts β†’ Functional, needs SLDS cleanup

⭐⭐ 75-99 pts β†’ Basic functionality, SLDS issues

⭐ <75 pts β†’ Needs significant work

```

---

Dark Mode Readiness

Dark mode is exclusive to SLDS 2 themes. Components must use global styling hooks to support light/dark theme switching.

Dark Mode Checklist

  • [ ] No hardcoded hex colors (#FFFFFF, #333333)
  • [ ] No hardcoded RGB/RGBA values
  • [ ] All colors use CSS variables (var(--slds-g-color-*))
  • [ ] Fallback values provided for SLDS 1 compatibility
  • [ ] No inline color styles in HTML templates
  • [ ] Icons use SLDS utility icons (auto-adjust for dark mode)

Global Styling Hooks (Common)

| Category | SLDS 2 Variable | Purpose |

|----------|-----------------|---------|

| Surface | --slds-g-color-surface-1 to -4 | Background colors |

| Container | --slds-g-color-surface-container-1 to -3 | Card/section backgrounds |

| Text | --slds-g-color-on-surface | Primary text |

| Border | --slds-g-color-border-1, -2 | Borders |

| Brand | --slds-g-color-brand-1, -2 | Brand accent |

| Spacing | --slds-g-spacing-0 to -12 | Margins/padding |

Example Migration:

```css

/ SLDS 1 (Deprecated) /

.my-card { background-color: #ffffff; color: #333333; }

/ SLDS 2 (Dark Mode Ready) /

.my-card {

background-color: var(--slds-g-color-surface-container-1, #ffffff);

color: var(--slds-g-color-on-surface, #181818);

}

```

For complete styling hooks reference and migration guide, see [resources/performance-guide.md](resources/performance-guide.md)

---

Jest Testing

Advanced testing patterns ensure robust, maintainable components.

Essential Patterns

```javascript

// Render cycle helper

const runRenderingLifecycle = async (reasons = ['render']) => {

while (reasons.length > 0) {

await Promise.resolve(reasons.pop());

}

};

// DOM cleanup

afterEach(() => {

while (document.body.firstChild) {

document.body.removeChild(document.body.firstChild);

}

jest.clearAllMocks();

});

// Proxy unboxing (LWS compatibility)

const unboxedData = JSON.parse(JSON.stringify(component.data));

expect(unboxedData).toEqual(expectedData);

```

Test Template Structure

```javascript

import { createElement } from 'lwc';

import MyComponent from 'c/myComponent';

import getData from '@salesforce/apex/MyController.getData';

jest.mock('@salesforce/apex/MyController.getData', () => ({

default: jest.fn()

}), { virtual: true });

describe('c-my-component', () => {

afterEach(() => { / DOM cleanup / });

it('displays data when loaded successfully', async () => {

getData.mockResolvedValue(MOCK_DATA);

const element = createElement('c-my-component', { is: MyComponent });

document.body.appendChild(element);

await runRenderingLifecycle();

// Assertions...

});

});

```

For complete testing patterns (ResizeObserver polyfill, advanced mocks, event testing), see [resources/jest-testing.md](resources/jest-testing.md)

---

Accessibility

WCAG compliance is mandatory for all components.

Quick Checklist

| Requirement | Implementation |

|-------------|----------------|

| Labels | label on inputs, aria-label on icons |

| Keyboard | Enter/Space triggers, Tab navigation |

| Focus | Visible indicator, logical order, focus traps in modals |

| Live Regions | aria-live="polite" for dynamic content |

| Contrast | 4.5:1 minimum for text |

```html

{statusMessage}

```

For comprehensive accessibility guide (focus management, ARIA patterns, screen reader testing), see [resources/accessibility-guide.md](resources/accessibility-guide.md)

---

Metadata Configuration

meta.xml Targets

```xml

66.0

true

Account Dashboard

SLDS 2 compliant account dashboard with dark mode support

lightning__RecordPage

lightning__AppPage

lightning__HomePage

lightning__FlowScreen

lightningCommunity__Page

lightning__Dashboard

Account

```

---

CLI Commands

| Command | Purpose |

|---------|---------|

| sf lightning generate component --type lwc | Create new LWC |

| sf lightning lwc test run | Run Jest tests |

| sf lightning lwc test run --watch | Watch mode |

| sf project deploy start -m LightningComponentBundle | Deploy LWC |

Generate New Component

```bash

sf lightning generate component \

--name accountDashboard \

--type lwc \

--output-dir force-app/main/default/lwc

```

Run Tests

```bash

# All tests

sf lightning lwc test run

# Specific component

sf lightning lwc test run --spec force-app/main/default/lwc/accountList/__tests__

# With coverage

sf lightning lwc test run -- --coverage

```

---

Flow Screen Integration

LWC components can be embedded in Flow Screens for custom UI experiences within guided processes.

Key Concepts

| Mechanism | Direction | Purpose |

|-----------|-----------|---------|

| @api with role="inputOnly" | Flow β†’ LWC | Pass context data |

| FlowAttributeChangeEvent | LWC β†’ Flow | Return user selections |

| FlowNavigationFinishEvent | LWC β†’ Flow | Programmatic Next/Back/Finish |

| availableActions | Flow β†’ LWC | Check available navigation |

Quick Example

```javascript

import { FlowAttributeChangeEvent, FlowNavigationFinishEvent } from 'lightning/flowSupport';

@api recordId; // Input from Flow

@api selectedRecordId; // Output to Flow

@api availableActions = [];

handleSelect(event) {

this.selectedRecordId = event.detail.id;

// CRITICAL: Notify Flow of the change

this.dispatchEvent(new FlowAttributeChangeEvent(

'selectedRecordId',

this.selectedRecordId

));

}

handleNext() {

if (this.availableActions.includes('NEXT')) {

this.dispatchEvent(new FlowNavigationFinishEvent('NEXT'));

}

}

```

For complete Flow integration patterns, see:

  • [docs/flow-integration-guide.md](docs/flow-integration-guide.md)
  • [docs/triangle-pattern.md](docs/triangle-pattern.md)

---

Advanced Features

TypeScript Support (Spring '26 - GA in API 66.0)

Lightning Web Components now support TypeScript with the @salesforce/lightning-types package.

```typescript

interface AccountRecord {

Id: string;

Name: string;

Industry?: string;

}

export default class AccountList extends LightningElement {

@api recordId: string | undefined;

@track private _accounts: AccountRecord[] = [];

@wire(getAccounts, { maxRecords: '$maxRecords' })

wiredAccounts(result: WireResult): void {

// Typed wire handling...

}

}

```

Requirements: TypeScript 5.4.5+, @salesforce/lightning-types package

LWC in Dashboards (Beta - Spring '26)

Components can be embedded as custom dashboard widgets.

```xml

lightning__Dashboard

```

Note: Requires enablement via Salesforce Customer Support

Agentforce Discoverability (Spring '26 - GA in API 66.0)

Make components discoverable by Agentforce agents:

```xml

lightning__agentforce

```

Best Practices:

  • Clear masterLabel and description
  • Detailed property descriptions
  • Semantic naming conventions

For TypeScript patterns and advanced configurations, see [resources/component-patterns.md](resources/component-patterns.md)

---

Cross-Skill Integration

| Skill | Use Case |

|-------|----------|

| sf-apex | Generate Apex controllers (@AuraEnabled, @InvocableMethod) |

| sf-flow | Embed components in Flow Screens, pass data to/from Flow |

| sf-testing | Generate Jest tests |

| sf-deploy | Deploy components |

| sf-metadata | Create message channels |

---

Dependencies

Required:

  • Target org with LWC support (API 45.0+)
  • sf CLI authenticated

For Testing:

  • Node.js 18+
  • Jest (@salesforce/sfdx-lwc-jest)

For SLDS Validation:

  • @salesforce-ux/slds-linter (optional)

Install: /plugin install github:Jaganpro/sf-skills/sf-lwc

---

Additional Resources

Documentation Files

| Resource | Purpose |

|----------|---------|

| [resources/component-patterns.md](resources/component-patterns.md) | Complete code examples (Wire, GraphQL, Modal, Navigation, TypeScript) |

| [resources/lms-guide.md](resources/lms-guide.md) | Lightning Message Service deep dive |

| [resources/jest-testing.md](resources/jest-testing.md) | Advanced testing patterns (James Simone) |

| [resources/accessibility-guide.md](resources/accessibility-guide.md) | WCAG compliance, ARIA patterns, focus management |

| [resources/performance-guide.md](resources/performance-guide.md) | Dark mode migration, lazy loading, optimization |

| [docs/state-management.md](docs/state-management.md) | NEW: @track, Singleton Store, @lwc/state, Platform State Managers |

| [docs/template-anti-patterns.md](docs/template-anti-patterns.md) | NEW: LLM template mistakes (inline expressions, ternary operators) |

| [docs/async-notification-patterns.md](docs/async-notification-patterns.md) | NEW: Platform Events + empApi subscription patterns |

| [docs/flow-integration-guide.md](docs/flow-integration-guide.md) | Flow-LWC communication, apex:// type bindings |

External References

  • [PICKLES Framework (Salesforce Ben)](https://www.salesforceben.com/the-ideal-framework-for-architecting-salesforce-lightning-web-components/)
  • [LWC Recipes (GitHub)](https://github.com/trailheadapps/lwc-recipes)
  • [SLDS 2 Transition Guide](https://www.lightningdesignsystem.com/2e1ef8501/p/8184ad-transition-to-slds-2)
  • [SLDS Styling Hooks](https://developer.salesforce.com/docs/platform/lwc/guide/create-components-css-custom-properties.html)
  • [James Simone - Composable Modal](https://www.jamessimone.net/blog/joys-of-apex/lwc-composable-modal/)
  • [James Simone - Advanced Jest Testing](https://www.jamessimone.net/blog/joys-of-apex/advanced-lwc-jest-testing/)

---

License

MIT License. See [LICENSE](LICENSE) file.

Copyright (c) 2024-2025 Jag Valaiyapathy

More from this repository10

🎯
sf-ai-agentforce-testing🎯Skill

Validates and tests AI agent interactions and workflows within Salesforce using automated testing frameworks and scenarios.

🎯
sf-flow🎯Skill

Generates and validates Salesforce flows with comprehensive 110-point scoring, ensuring Winter '26 best practices and high-performance flow design.

🎯
sf-testing🎯Skill

Executes Salesforce Apex tests with comprehensive coverage analysis, automatic failure detection, and intelligent test-fixing capabilities.

🎯
sf-deploy🎯Skill

Deploys Salesforce metadata and code changes to specified orgs using flexible configuration and streamlined deployment workflows.

🎯
sf-diagram-nanobananapro🎯Skill

Generates Salesforce ERD diagrams, LWC mockups, and architecture visuals using Gemini and Nano Banana Pro AI technology.

🎯
sf-data🎯Skill

Executes Salesforce data operations with expert SOQL querying, bulk data management, and test data generation across Salesforce orgs.

🎯
sf-ai-agentforce-legacy🎯Skill

Generates legacy Agentforce agents using Agent Script syntax with 100-point scoring for maintaining existing agent patterns.

🎯
util-youtube-analyzer🎯Skill

Analyzes YouTube video details, extracts metadata, and provides insights about video content, views, and engagement metrics.

🎯
sf-permissions🎯Skill

Analyzes Salesforce Permission Sets, revealing access hierarchies, detecting specific permissions, and auditing user access across objects, fields, and Apex classes.

🎯
sf-connected-apps🎯Skill

Generates and configures Salesforce Connected Apps and External Client Apps with comprehensive OAuth setup, security validation, and 120-point scoring mechanism.