home / skills / xfstudio / skills / salesforce-development

salesforce-development skill

/salesforce-development

This skill helps developers implement Salesforce patterns with LWC, Apex, and APIs, enabling bulkified triggers, async processing, and DX best practices.

npx playbooks add skill xfstudio/skills --skill salesforce-development

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.5 KB
---
name: salesforce-development
description: "Expert patterns for Salesforce platform development including Lightning Web Components (LWC), Apex triggers and classes, REST/Bulk APIs, Connected Apps, and Salesforce DX with scratch orgs and 2nd generation packages (2GP). Use when: salesforce, sfdc, apex, lwc, lightning web components."
source: vibeship-spawner-skills (Apache 2.0)
---

# Salesforce Development

## Patterns

### Lightning Web Component with Wire Service

Use @wire decorator for reactive data binding with Lightning Data Service
or Apex methods. @wire fits LWC's reactive architecture and enables
Salesforce performance optimizations.


### Bulkified Apex Trigger with Handler Pattern

Apex triggers must be bulkified to handle 200+ records per transaction.
Use handler pattern for separation of concerns, testability, and
recursion prevention.


### Queueable Apex for Async Processing

Use Queueable Apex for async processing with support for non-primitive
types, monitoring via AsyncApexJob, and job chaining. Limit: 50 jobs
per transaction, 1 child job when chaining.


## Anti-Patterns

### ❌ SOQL Inside Loops

### ❌ DML Inside Loops

### ❌ Hardcoding IDs

## ⚠️ Sharp Edges

| Issue | Severity | Solution |
|-------|----------|----------|
| Issue | critical | See docs |
| Issue | high | See docs |
| Issue | medium | See docs |
| Issue | high | See docs |
| Issue | critical | See docs |
| Issue | high | See docs |
| Issue | high | See docs |
| Issue | critical | See docs |

Overview

This skill packages expert patterns and practical guidance for Salesforce platform development, covering Lightning Web Components (LWC), Apex triggers and classes, REST/Bulk APIs, Connected Apps, and Salesforce DX workflows. It focuses on scalable, testable designs and common pitfalls to avoid when building on Salesforce.

How this skill works

The skill explains concrete patterns such as using @wire for reactive LWC data binding, bulkified Apex triggers with a handler pattern, and Queueable Apex for asynchronous processing. It highlights anti-patterns (SOQL/DML inside loops, hardcoded IDs) and points to guardrails for limits, recursion prevention, and monitoring async jobs.

When to use it

  • Building Lightning Web Components that need server data or LDS integration
  • Implementing Apex triggers that must handle bulk record operations
  • Designing async processing (Queueable) or batch integrations with REST/Bulk APIs
  • Setting up CI/CD with Salesforce DX, scratch orgs, and 2nd generation packages (2GP)
  • Creating Connected Apps and secure API integrations with OAuth

Best practices

  • Use @wire for reactive LWC bindings and call Apex only when necessary for complex logic
  • Always bulkify triggers and delegate logic to handler classes for testability and recursion control
  • Avoid SOQL and DML inside loops; collect records and perform operations in bulk
  • Prefer Queueable Apex for async jobs that require non-primitive parameters and support chaining within limits
  • Use scratch orgs and 2GP for source-driven development and consistent CI pipelines

Example use cases

  • An LWC that displays account balances using @wire to Lightning Data Service for automatic cache and sharing behavior
  • An Apex trigger that processes up to 200 related child records by delegating to a handler class with bulk DML
  • A Queueable job that processes file attachments, chains a follow-up job, and is monitored via AsyncApexJob
  • A CI step that spins a scratch org, deploys a 2GP package, runs tests, and validates package versioning
  • A Connected App configured for OAuth authentication to call Salesforce REST API from an external service

FAQ

When should I use @wire vs imperative Apex calls in LWC?

@wire is preferred for reactive, cached access to Salesforce data and for Lightning Data Service. Use imperative Apex when you need to pass dynamic parameters or perform non-CRUD server logic on demand.

How do I prevent trigger recursion and ensure bulk safety?

Implement a handler pattern with static flags or a trigger framework to prevent recursion. Always design handlers to accept lists and operate on collections, avoiding per-record SOQL/DML.