askill
sf-lwc

sf-lwcSafety 95Repository

Lightning Web Components development skill with PICKLES architecture methodology, component scaffolding, wire service patterns, event handling, Apex integration, GraphQL support, and Jest test generation. Build modern Salesforce UIs with proper reactivity, accessibility, dark mode compatibility, and performance patterns.

197 stars
3.9k downloads
Updated 3/17/2026

Package Files

Loading files...
SKILL.md

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

Document Map

NeedDocumentDescription
Component patternsreferences/component-patterns.mdWire, GraphQL, Modal, Navigation, TypeScript
LMS guidereferences/lms-guide.mdLightning Message Service deep dive
Jest testingreferences/jest-testing.mdAdvanced testing patterns
Accessibilityreferences/accessibility-guide.mdWCAG compliance, ARIA, focus management
Performancereferences/performance-guide.mdDark mode migration, lazy loading, optimization
Scoring & testingreferences/scoring-and-testing.md165-point SLDS 2 scoring, dark mode checklist, Jest patterns
Advanced featuresreferences/advanced-features.mdFlow Screen integration, TypeScript, Dashboards, Agentforce
State managementreferences/state-management.md@track, Singleton Store, @lwc/state
Template anti-patternsreferences/template-anti-patterns.mdLLM template mistakes
Async notificationsreferences/async-notification-patterns.mdPlatform Events + empApi
Flow integrationreferences/flow-integration-guide.mdFlow-LWC communication

PICKLES Framework (Architecture Methodology)

┌─────────────────────────────────────────────────────────────────────┐
│                     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 │
└─────────────────────────────────────────────────────────────────────┘
PrincipleKey Actions
P - PrototypeWireframes, mock data, stakeholder review, separation of concerns
I - IntegrateLDS 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 - KineticsDebounce search (300ms), disable during submit, keyboard navigation
L - LibrariesUse lightning/* modules, base components, avoid reinventing
E - ExecutionLazy load with lwc:if, cache computed values, avoid infinite loops
S - SecurityWITH SECURITY_ENFORCED, input validation, FLS/CRUD checks

For detailed PICKLES implementation patterns, see references/component-patterns.md


Key Component Patterns

Wire vs Imperative Apex Calls

AspectWire (@wire)Imperative Calls
ExecutionAutomatic / ReactiveManual / Programmatic
DMLRead-OnlyInsert/Update/Delete
Data UpdatesAuto on param changeManual refresh
CachingBuilt-inNone

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

Data Source Decision Tree

ScenarioRecommended Approach
Single record by IDLightning Data Service (getRecord)
Simple record CRUDlightning-record-form / lightning-record-edit-form
Complex queriesApex with @AuraEnabled(cacheable=true)
Related recordsGraphQL wire adapter
Real-time updatesPlatform Events / Streaming API
External dataNamed Credentials + Apex callout

Communication Patterns

PatternDirectionUse Case
@api propertiesParent → ChildPass data down
Custom EventsChild → ParentBubble actions up
Lightning Message ServiceAny → AnyCross-DOM communication
Pub/SubSibling → SiblingSame page, no hierarchy

Decision Tree: Same parent? → Events up, @api down. Different DOM trees? → LMS. LWC ↔ Aura/VF? → LMS.

Lifecycle Hook Guidance

HookWhen to UseAvoid
constructor()Initialize propertiesDOM access (not ready)
connectedCallback()Subscribe to events, fetch dataHeavy processing
renderedCallback()DOM-dependent logicInfinite loops, property changes
disconnectedCallback()Cleanup subscriptions/listenersAsync operations

SLDS 2 Validation & Dark Mode

See references/scoring-and-testing.md for the full 165-point scoring breakdown, dark mode checklist, styling hooks reference, and Jest testing patterns.

Quick summary: 8 categories, 165 total points. 150+ Production-ready | 125+ Good | 100+ Functional | <75 Needs work. Dark mode requires CSS variables only (--slds-g-color-*), no hardcoded colors.


Accessibility

WCAG compliance is mandatory for all components.

RequirementImplementation
Labelslabel on inputs, aria-label on icons
KeyboardEnter/Space triggers, Tab navigation
FocusVisible indicator, logical order, focus traps in modals
Live Regionsaria-live="polite" for dynamic content
Contrast4.5:1 minimum for text

For comprehensive guide, see references/accessibility-guide.md


Metadata Configuration

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>66.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Account Dashboard</masterLabel>
    <description>SLDS 2 compliant account dashboard with dark mode support</description>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__FlowScreen</target>
        <target>lightningCommunity__Page</target>
        <target>lightning__Dashboard</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects><object>Account</object></objects>
            <property name="title" type="String" default="Dashboard"/>
            <property name="maxRecords" type="Integer" default="10"/>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

Flow Screen & Advanced Features

See references/advanced-features.md for Flow Screen integration (FlowAttributeChangeEvent, FlowNavigationFinishEvent), TypeScript support (API 66.0 GA), LWC in Dashboards (Beta), and Agentforce discoverability.

Flow Screen quick reference: @api inputs → FlowAttributeChangeEvent outputs → FlowNavigationFinishEvent for navigation. See also references/flow-integration-guide.md.


CLI Commands

CommandPurpose
sf lightning generate component --type lwcCreate new LWC
sf lightning lwc test runRun Jest tests
sf lightning lwc test run --watchWatch mode
sf project deploy start -m LightningComponentBundleDeploy LWC
# Generate new component
sf lightning generate component \
  --name accountDashboard \
  --type lwc \
  --output-dir force-app/main/default/lwc

# Run tests with coverage
sf lightning lwc test run -- --coverage

# Specific component tests
sf lightning lwc test run --spec force-app/main/default/lwc/accountList/__tests__

Cross-Skill Integration

SkillUse Case
sf-apexGenerate Apex controllers (@AuraEnabled, @InvocableMethod)
sf-flowEmbed components in Flow Screens, pass data to/from Flow
sf-testingGenerate Jest tests
sf-deployDeploy components
sf-metadataCreate 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)


External References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

82/100Analyzed 2/23/2026

Comprehensive LWC development skill with PICKLES architecture framework, decision trees, tables, and CLI commands. Well-structured with 11 reference documents. Provides actionable guidance for component patterns, wire vs imperative calls, data source selection, and communication patterns. Contains metadata XML examples, accessibility requirements, and dark mode support. Tags and external references enhance discoverability. Slightly lower actionability as detailed implementation requires following reference documents, but core skill provides strong foundation.

95
92
88
78
72

Metadata

Licenseunknown
Version-
Updated3/17/2026
PublisherJaganpro

Tags

apici-cdgithubgraphqlllmsecuritytesting