Salesforce Apex and LWC Delivery

Build and fix Apex, LWC, SOQL, and integrations with bulk-safe logic, explicit permissions, and focused tests.

by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Build a custom Apex trigger that auto-syncs account changes to an external webhook on update.”
Beforegeneric AI agent
Salesforce development uses Apex, a proprietary Java-like language. When you want to react to data changes, triggers let you run code when records are created or updated. You'd need to write Apex code that captures the change, processes it, and sends data somewhere. Salesforce has limits on how much code you can run, so efficiency is important. You might need to handle bulk operations carefully since triggers fire for each record. Error handling is important so you don't create bad data. Testing in Salesforce is required before deploying to production.
Afterwith Salesforce Apex and LWC Delivery
SALESFORCE APEX WEBHOOK SYNC IMPLEMENTATION:

TRIGGER DEFINITION
   trigger AccountSyncWebhook on Account (after insert, after update) {
     List<Account> changedAccounts = new List<Account>();
     
     for (Account acc : Trigger.new) {
       Account oldAcc = Trigger.oldMap.get(acc.Id);
       if (oldAcc == null || hasRelevantChanges(acc, oldAcc)) {
         changedAccounts.add(acc);
       }
     }
     
     if (!changedAccounts.isEmpty()) {
       AccountWebhookDispatcher.enqueueSync(changedAccounts);
     }
   }

QUEUEABLE BATCH HANDLER (respects governor limits)
   public class AccountWebhookDispatcher implements Queueable, Database.AllowsCallouts {
     static void enqueueSync(List<Account> accounts) {
       System.enqueueJob(new AccountWebhookDispatcher(accounts));
     }
     
     public void execute(QueueableContext ctx) {
       for (Account acc : accounts) {
         Map<String, Object> payload = new Map<String, Object>{
           'id' => acc.Id,
           'name' => acc.Name,
           'industry' => acc.Industry,
           'webhook_timestamp' => DateTime.now().getTime()
         };
         
         HttpRequest req = new HttpRequest();
         req.setEndpoint('https://api.example.com/webhooks/account-sync');
         req.setMethod('POST');
         req.setBody(JSON.serialize(payload));
         
         Http http = new Http();
         HttpResponse res = http.send(req);
         if (res.getStatusCode() >= 400) {
           logWebhookFailure(acc.Id, res.getBody());
         }
       }
     }
   }

TEST CLASS (required for deployment)
   @isTest static void testAccountChangeTriggersWebhook() {
     Test.setMock(HttpCalloutMock.class, new WebhookMockResponse());
     Account testAcc = new Account(Name='Test Co', Industry='Tech');
     insert testAcc;
     // Assert webhook was called with correct payload
   }

GOVERNOR LIMITS STRATEGY
   - Batch changes in Queueable (async job avoids callout limits)
   - Max 1 webhook callout per account update
   - Retry logic with exponential backoff (future method)

About this skill

Your trigger works for one record but fails during imports. Your LWC saves successfully yet still shows old data. This skill builds and repairs Salesforce features by tracing transaction boundaries, permissions, bulk behavior, and cache ownership before changing code.

What it does

  • Refactors triggers into bulk-safe handlers with change detection and targeted recursion control.
  • Diagnoses SOQL failures using query count, returned rows, filter selectivity, and query-plan evidence.
  • Separates record sharing, object permissions, and field permissions instead of treating with sharing as complete security.
  • Builds LWC reads and mutations with appropriate Lightning Data Service, Apex, refresh behavior, and error handling.
  • Chooses Queueable, Batch Apex, or Platform Events around transaction size, delivery guarantees, and retry behavior.
  • Produces focused tests and Salesforce deployment checks, including partial failures and permission boundaries.

What you get

Implementation code or a targeted patch, its execution and permission assumptions, and tests that exercise the relevant failure modes. Reviews prioritize concrete defects with reproduction conditions and fixes; quick debugging requests stay concise.

Best for

Salesforce developers and engineering teams shipping Apex, Lightning Web Components, bulk automation, integrations, and Salesforce DX deployment pipelines.

SKILL.md preview

SKILL.md
---
name: salesforce-apex-and-lwc-delivery
description: >-
  Build and debug Salesforce Apex, Lightning Web Components, SOQL, triggers, asynchronous jobs, integrations, and deployment workflows by tracing transaction limits, permission boundaries, and bulk behavior. Use when the user says "write a bulk-safe trigger", "my Apex keeps hitting governor limits", "this SOQL query times out", "build an LWC that saves records", "fix this Queueable job", "connect Salesforce to our API", or "review our Salesforce deployment".
---

# Salesforce Apex and LWC Delivery

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →