lwc-patterns

Provides documented Lightning Web Component patterns for Salesforce UI development.

2|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill lwc-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lwc-patterns
Source: https://github.com/bhanu91221/claude-sfdx-iq/tree/main/skills/lwc-patterns
Command: npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill lwc-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

LWC patterns and templates to help teams build consistent, reusable Salesforce UI components, reducing boilerplate and friction across projects.

Core Features & Use Cases

  • Reusable patterns: covers @wire usage, imperative calls, and Lightning Data Service workflows.
  • Eventing and communication: demonstrates CustomEvent, Lightning Message Service, and cross-component patterns.
  • Navigation and composition: includes NavigationMixin, slot-based composition, and dynamic component creation for flexible UIs.
  • Practical examples: ready-to-adapt code samples for common Salesforce UI scenarios.

Quick Start

Copy the LWC patterns into your Salesforce project and adapt the examples to fit your data model and component structure.

Frequently Asked Questions about lwc-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best patterns for building reusable Lightning Web Components in Salesforce?

Reusable Lightning Web Components rely on documented patterns for wire service usage, eventing, and composition to reduce boilerplate and ensure UI consistency. These patterns cover data display, user interactions, navigation, and inter-component communication.

How do I handle cross-component communication in LWC using Lightning Message Service?

Cross-component communication in LWC uses CustomEvent for parent-child relationships and Lightning Message Service for unrelated components. Documented communication patterns demonstrate both approaches to decouple components and pass data efficiently across the DOM.

How do I use NavigationMixin and slot-based composition in Salesforce LWC?

NavigationMixin handles record navigation while slot-based composition enables flexible UI structures in LWC. Combined patterns allow developers to create adaptable component layouts and manage page references without duplicating boilerplate code.

When should I use @wire versus imperative Apex calls in Lightning Web Components?

Use @wire for reactive read operations where data depends on reactive variables, and imperative Apex calls for user-initiated actions or complex conditional fetching. LWC patterns provide ready-to-adapt code samples demonstrating both Lightning Data Service workflows.

Do I need a specific Salesforce environment to implement these LWC patterns?

You need a standard Salesforce development environment with LWC support to implement these patterns. Copy the pattern code into your Salesforce project and adapt the examples to match your specific data model and component structure.

Can I use these LWC patterns for dynamic component creation in Salesforce?

Yes, the patterns include dynamic component creation techniques alongside standard composition methods. They provide practical code samples for flexible UI scenarios, allowing you to generate components dynamically while adhering to Salesforce LWC best practices.