Langsung ke konten
Skillpedia
Website & UI (frontend)40k Β· #7413

salesforce-component-standards

Fungsinya

Panduan ini membantu Anda membuat komponen antarmuka pengguna Salesforce yang aman, mudah diakses, dan mengikuti praktik terbaik. Panduan ini memastikan komponen bekerja dengan baik bersama sistem desain Salesforce (SLDS) dan mudah digunakan.

Kapan dipakai

  • βœ“Saat membangun bagian visual (komponen) baru untuk Salesforce.
  • βœ“Saat meninjau komponen yang sudah ada untuk memastikan komponen aman dan efisien.
  • βœ“Saat Anda ingin komponen mengikuti standar kualitas Salesforce.

Link skill

https://github.com/github/awesome-copilot/blob/main/skills/salesforce-component-standards/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/github/awesome-copilot/blob/main/skills/salesforce-component-standards/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBagaimana cara memastikan Lightning Web component saya dapat diakses oleh semua pengguna?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Panduan ini merinci aturan khusus untuk setiap jenis komponen (LWC, Aura, Visualforce). Panduan ini menjelaskan cara menangani data, keamanan, gaya visual, dan pengujian, sehingga semuanya sesuai dengan standar yang ditetapkan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Salesforce Component Quality Standards

Apply these checks to every LWC, Aura component, and Visualforce page you write or review.

Section 1 β€” LWC Quality Standards

1.1 Data Access Pattern Selection

Choose the right data access pattern before writing JavaScript controller code:

Use case Pattern Why
Read a single record reactively (follows navigation) @wire(getRecord, { recordId, fields }) Lightning Data Service β€” cached, reactive
Standard CRUD form for a single object <lightning-record-form> or <lightning-record-edit-form> Built-in FLS, CRUD, and accessibility
Complex server query or filtered list @wire(apexMethodName, { param }) on a cacheable=true method Allows caching; wire re-fires on param change
User-triggered action, DML, or non-cacheable server call Imperative apexMethodName(params).then(...).catch(...) Required for DML β€” wired methods cannot be @AuraEnabled without cacheable=true
Cross-component communication (no shared parent) Lightning Message Service (LMS) Decoupled, works across DOM boundaries
Multi-object graph relationships GraphQL @wire(gql, { query, variables }) Single round-trip for complex related data

1.2 Security Rules

Rule Enforcement
No raw user data in innerHTML Use {expression} binding in the template β€” the framework auto-escapes. Never use this.template.querySelector('.el').innerHTML = userValue
Apex @AuraEnabled methods enforce CRUD/FLS Use WITH USER_MODE in SOQL or explicit Schema.sObjectType checks
No hardcoded org-specific IDs in component JavaScript Query or pass as a prop β€” never embed record IDs in source
@api properties from parent: validate before use A parent can pass anything β€” validate type and range before using as a query parameter

1.3 SLDS 2 and Styling Standards

  • Never hardcode colours: color: #FF3366 β†’ use color: var(--slds-c-button-brand-color-background) or a semantic SLDS token.
  • Never override SLDS classes with !important β€” compose with custom CSS properties.
  • Use <lightning-*> base components wherever they exist: lightning-button, lightning-input, lightning-datatable, lightning-card, etc.
  • Base components include built-in SLDS 2, dark mode, and accessibility β€” avoid reimplementing their behaviour.
  • If using custom CSS, test in both light mode and dark mode before declaring done.

1.4 Accessibility Requirements (WCAG 2.1 AA)

Every LWC component must pass all of these before it is considered done:

  • All form inputs have <label> or aria-label β€” never use placeholder as the only label
  • All icon-only buttons have alternative-text or aria-label describing the action
  • All interactive elements are reachable and operable by keyboard (Tab, Enter, Space, Escape)
  • Colour is not the only means of conveying status β€” pair with text, icon, or aria-* attributes
  • Error messages are associated with their input via aria-describedby
  • Focus management is correct in modals β€” focus moves into the modal on open and back on close

1.5 Component Communication Rules

Direction Mechanism
Parent β†’ Child @api property or calling a @api method
Child β†’ Parent CustomEvent β€” this.dispatchEvent(new CustomEvent('eventname', { detail: data }))
Sibling / unrelated components Lightning Message Service (LMS)
Never use document.querySelector, window.*, or Pub/Sub libraries

For Flow screen components:

  • Events that need to reach the Flow runtime must set bubbles: true and composed: true.
  • Expose @api value for two-way binding with the Flow variable.

1.6 JavaScript Performance Rules

  • No side effects in connectedCallback: it runs on every DOM attach β€” avoid DML, heavy computation, or rendering state mutations here.
  • Guard renderedCallback: always use a boolean guard to prevent infinite render loops.
  • Avoid reactive property traps: setting a reactive property inside renderedCallback causes a re-render β€” use it only when necessary and guarded.
  • Do not store large datasets in component state β€” paginate or stream large results instead.

1.7 Jest Test Requirements

Every component that handles user interaction or retrieves Apex data must have a Jest test:

// Minimum test coverage expectations

…
Pertanyaan umum

Apa itu LWC, Aura, dan Visualforce?

Ini adalah teknologi berbeda yang digunakan untuk membangun antarmuka pengguna di dalam Salesforce.

Apa itu SLDS 2?

Itu adalah sistem desain Salesforce yang mengatur tampilan dan nuansa komponen agar tetap konsisten secara visual.

Apa arti 'accessibility' (WCAG 2.1 AA)?

Artinya komponen harus dapat digunakan oleh semua orang, termasuk penyandang disabilitas penglihatan, pendengaran, atau motorik, sesuai dengan standar internasional.

Detail

Deskripsi asli dari pembuat

Quality standards for Salesforce Lightning Web Components (LWC), Aura components, and Visualforce pages. Covers SLDS 2 compliance, accessibility (WCAG 2.1 AA), data access pattern selection, component communication rules, XSS prevention, CSRF enforcement, FLS/CRUD in AuraEnabled methods, view state management, and Jest test requirements. Use this skill when building or reviewing any Salesforce UI

repo: github/awesome-copilot

Popularitas

Bintang GitHub
40k
Peringkat
#7413
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa