Develops Apex classes, triggers, and Lightning Web Components on Salesforce. Enforces bulkification, governor limits, test coverage ≥90%, and SFDX source-driven deployment.
Ships in 10-platform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
适用:
@wire、事件、@api/@track 组合页面。不该用(负边界):
核心判据:先问「能否声明式实现」;要写代码就必须批量化(bulkify)+ 守治理限额 + 测试覆盖 ≥90%(含 200 条批量场景),三者缺一不可。
@IsTest 测试类,覆盖率 ≥90%,必须含 200 条批量插入/更新场景,并用 Test.startTest()/stopTest() 隔离限额。硬约束(MUST):
WHERE,善用关系子查询减少往返。Database.update(scope, false)。禁止(MUST NOT):
批量化触发器(正确:循环外查询一次):
trigger AccountTrigger on Account (before insert, before update) {
AccountTriggerHandler.handleBeforeInsert(Trigger.new);
}
public class AccountTriggerHandler {
public static void handleBeforeInsert(List<Account> newAccounts) {
Set<Id> parentIds = new Set<Id>();
for (Account acc : newAccounts) {
if (acc.ParentId != null) parentIds.add(acc.ParentId);
}
Map<Id, Account> parentMap = new Map<Id, Account>(
[SELECT Id, Name FROM Account WHERE Id IN :parentIds]
);
for (Account acc : newAccounts) {
if (acc.ParentId != null && parentMap.containsKey(acc.ParentId)) {
acc.Description = 'Child of: ' + parentMap.get(acc.ParentId).Name;
}
}
}
}
反例(错误:循环内 SOQL,必然触限):
trigger AccountTrigger on Account (before insert) {
for (Account acc : Trigger.new) {
Account parent = [SELECT Id, Name FROM Account WHERE Id = :acc.ParentId]; // BAD
acc.Description = 'Child of: ' + parent.Name;
}
}
Batch Apex(允许部分成功):
public class ContactBatchUpdate implements Database.Batchable<SObject> {
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator([SELECT Id, Email FROM Contact WHERE Email = null]);
}
public void execute(Database.BatchableContext bc, List<Contact> scope) {
for (Contact c : scope) { c.Email = '[email protected]'; }
Database.update(scope, false); // 部分成功,不让单条失败回滚整批
}
public void finish(Database.BatchableContext bc) { /* 通知或链式启动下一批 */ }
}
// 执行:Database.executeBatch(new ContactBatchUpdate(), 200);
测试类(覆盖 200 条批量场景):
@IsTest
private class AccountTriggerHandlerTest {
@TestSetup
static void makeData() {
Account parent = new Account(Name = 'Parent Co');
insert parent;
}
@IsTest
static void testBulkInsert() {
Account parent = [SELECT Id FROM Account WHERE Name = 'Parent Co' LIMIT 1];
List<Account> children = new List<Account>();
for (Integer i = 0; i < 200; i++) {
children.add(new Account(Name = 'Child ' + i, ParentId = parent.Id));
}
Test.startTest();
insert children;
Test.stopTest();
List<Account> updated = [SELECT Description FROM Account WHERE ParentId = :parent.Id];
System.assert(!updated.isEmpty(), 'Children should have descriptions set');
System.assert(updated[0].Description.startsWith('Child of:'), 'Description format mismatch');
}
}
选择性 SOQL + 关系查询(用索引字段,子查询减往返):
List<Opportunity> opps = [
SELECT Id, Name, Amount, StageName
FROM Opportunity
WHERE AccountId IN :accountIds // 索引字段
AND CloseDate >= :Date.today() // 索引字段
ORDER BY CloseDate ASC LIMIT 200
];
List<Account> accounts = [
SELECT Id, Name,
(SELECT Id, LastName, Email FROM Contacts WHERE Email != null)
FROM Account WHERE Id IN :accountIds
];
最小 LWC(计数器,含三件套):
// counterComponent.js
import { LightningElement, track } from 'lwc';
export default class CounterComponent extends LightningElement {
@track count = 0;
handleIncrement() { this.count += 1; }
}
<!-- counterComponent.html -->
<template>
<lightning-card title="Counter">
<div class="slds-p-around_medium">
<p>Count: {count}</p>
<lightning-button label="Increment" onclick={handleIncrement}></lightning-button>
</div>
</lightning-card>
</template>
<!-- counterComponent.js-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>
Test.startTest()/stopTest() 之间限额重置,把被测异步逻辑放进去。Database.update(scope, false),再读 SaveResult 处理失败行,别让一条坏数据回滚整批。with sharing 运行,查询/写入前校验字段级安全,尤其面向 community/guest 用户。rest-api-endpoint-builder —— 做 Salesforce 外部集成/回调前,先掌握 REST 端点设计。api-design-reviewer、web-component-design、shopify-app-development、code-reviewerci-cd-pipeline-builder —— 把 SFDX 元数据部署接入流水线,实现 scratch org 自动化交付。—— 本条采编自 jeffallan/claude-skills(MIT 许可)。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
salesforce, apex, lwc, soql, governor-limits, sfdx
/10-platform:salesforce-apex-developerfrom 10-platform
npx claudepluginhub findscripter/everything-skills --plugin 10-platform66 skills in this plugin
/agentmail-email-infra当 AI 智能体需要真实邮箱完成注册/验证码/事务通信时使用;通过 AgentMail REST API 开通账号、收发邮件、注册 Webhook、查询 karma 余额并产出可执行调用;不适用于自建/企业 SMTP/IMAP 或个人邮箱代收。触发词:AgentMail、智能体邮箱、theagentmail.net/agentphone-voice-sms-agents当需要给 AI 代理配备电话号码、发起/接听语音通话、收发短信、查看通话转写或配置 Webhook 时使用;调用 AgentPhone REST API(base=https://api.agentphone.to/v1)完成代理/号码/通话/短信/Webhook/用量的全生命周期管理,产出可直接执行的 curl 与 Webhook 处理代码;不适用于自建 Twilio/SIP/STUN 等底层电信栈或非 AgentPhone 平台。触发词:电话代理、语音通话、短信、号码、Webhook、转写。/ai-native-cli-design当设计/改造供 AI 智能体调用的命令行工具时使用;按 core/recommended/ecosystem 三层产出 JSON 优先、可校验的 CLI 契约(默认 JSON、结构化错误、退出码、护栏、agent/ 目录与自描述);不适用于纯人类交互 CLI、GUI 或库 API 设计;触发词:agent CLI、AI 友好命令行、CLI JSON 输出、退出码规范、agent/ 目录Other plugins' skills for the same job