Provides Salesforce platform expertise for Apex, LWC, Flow, and declarative development. The agent invokes this skill when working on Salesforce code, discussing platform constraints, or troubleshooting Salesforce-specific issues.
This skill provides deep Salesforce platform expertise for development tasks. It covers Apex programming, Lightning Web Components, Flow automation, and declarative configurations.
// Trigger delegates to handler
trigger AccountTrigger on Account (before insert, before update, after insert, after update) {
AccountTriggerHandler handler = new AccountTriggerHandler();
handler.run();
}
// Handler implements logic with bulkification
public class AccountTriggerHandler {
public void run() {
if (Trigger.isBefore && Trigger.isInsert) {
handleBeforeInsert(Trigger.new);
}
}
private void handleBeforeInsert(List<Account> accounts) {
// Process all records in bulk
for (Account acc : accounts) {
// Logic here
}
}
}
// BAD: SOQL in loop
for (Account acc : accounts) {
Contact c = [SELECT Id FROM Contact WHERE AccountId = :acc.Id LIMIT 1]; // Governor limit violation
}
// GOOD: Bulkified query
Set<Id> accountIds = new Set<Id>();
for (Account acc : accounts) {
accountIds.add(acc.Id);
}
Map<Id, Contact> contactsByAccount = new Map<Id, Contact>(
[SELECT Id, AccountId FROM Contact WHERE AccountId IN :accountIds]
);
public class AccountService {
public static void processAccounts(List<Account> accounts) {
List<Database.SaveResult> results = Database.update(accounts, false);
for (Integer i = 0; i < results.size(); i++) {
if (!results[i].isSuccess()) {
for (Database.Error err : results[i].getErrors()) {
System.debug(LoggingLevel.ERROR,
'Error on record ' + accounts[i].Id + ': ' + err.getMessage());
}
}
}
}
}
| Limit | Synchronous | Asynchronous | |-------|-------------|--------------| | SOQL Queries | 100 | 200 | | SOQL Rows | 50,000 | 50,000 | | DML Statements | 150 | 150 | | DML Rows | 10,000 | 10,000 | | CPU Time | 10,000 ms | 60,000 ms | | Heap Size | 6 MB | 12 MB | | Callouts | 100 | 100 |
// lwc/accountList/accountList.js
import { LightningElement, wire } from 'lwc';
import getAccounts from '@salesforce/apex/AccountController.getAccounts';
export default class AccountList extends LightningElement {
accounts;
error;
@wire(getAccounts)
wiredAccounts({ error, data }) {
if (data) {
this.accounts = data;
this.error = undefined;
} else if (error) {
this.error = error;
this.accounts = undefined;
}
}
}
// Check permissions before DML
if (Schema.sObjectType.Account.isUpdateable()) {
update accounts;
} else {
throw new SecurityException('Insufficient privileges');
}
// Check field-level security
if (Schema.sObjectType.Account.fields.Name.isAccessible()) {
String name = acc.Name;
}
// BAD: String concatenation
String query = 'SELECT Id FROM Account WHERE Name = \'' + userInput + '\'';
// GOOD: Bind variables
String query = 'SELECT Id FROM Account WHERE Name = :userInput';
List<Account> accounts = Database.query(query);
sf org create scratch -f config/project-scratch-def.json -a my-scratch -d 7
sf project deploy start -o my-scratch
sf apex run test -o my-scratch -r human -c -w 10
sf org delete scratch -o my-scratch -p
下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer