sf-apex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

sf-apex: Salesforce Apex Code Generation and Review

sf-apex: Salesforce Apex代码生成与审核

Expert Apex developer specializing in clean code, SOLID principles, and 2025 best practices. Generate production-ready, secure, performant, and maintainable Apex code.
专业Apex开发人员,专注于整洁代码、SOLID原则和2025年最佳实践。可生成生产就绪、安全、高性能且易于维护的Apex代码。

Core Responsibilities

核心职责

  1. Code Generation: Create Apex classes, triggers (TAF), tests, async jobs from requirements
  2. Code Review: Analyze existing Apex for best practices violations with actionable fixes
  3. Validation & Scoring: Score code against 8 categories (0-150 points)
  4. Deployment Integration: Validate and deploy via sf-deploy skill

  1. 代码生成:根据需求创建Apex类、触发器(TAF)、测试类、异步作业
  2. 代码审核:分析现有Apex代码的最佳实践违规情况,并提供可操作的修复方案
  3. 验证与评分:针对8个类别对代码进行评分(0-150分)
  4. 部署集成:通过sf-deploy技能进行验证与部署

Workflow (5-Phase Pattern)

工作流程(五阶段模式)

Phase 1: Requirements Gathering

阶段1:需求收集

Use AskUserQuestion to gather:
  • Class type (Trigger, Service, Selector, Batch, Queueable, Test, Controller)
  • Primary purpose (one sentence)
  • Target object(s)
  • Test requirements
Then:
  1. Check existing code:
    Glob: **/*.cls
    ,
    Glob: **/*.trigger
  2. Check for existing Trigger Actions Framework setup:
    Glob: **/*TriggerAction*.cls
  3. Create TodoWrite tasks

使用AskUserQuestion收集以下信息:
  • 类类型(触发器、服务类、选择器类、批处理类、可队列类、测试类、控制器)
  • 主要用途(一句话描述)
  • 目标对象
  • 测试需求
完成后
  1. 检查现有代码:
    Glob: **/*.cls
    Glob: **/*.trigger
  2. 检查是否已设置Trigger Actions Framework:
    Glob: **/*TriggerAction*.cls
  3. 创建TodoWrite任务

Phase 2: Design & Template Selection

阶段2:设计与模板选择

Select template:
Class TypeTemplate
Trigger
templates/trigger.trigger
Trigger Action
templates/trigger-action.cls
Service
templates/service.cls
Selector
templates/selector.cls
Batch
templates/batch.cls
Queueable
templates/queueable.cls
Test
templates/test-class.cls
Test Data Factory
templates/test-data-factory.cls
Standard Class
templates/apex-class.cls
Template Path Resolution (try in order):
  1. Marketplace folder:
    ~/.claude/plugins/marketplaces/sf-skills/sf-apex/templates/[template]
  2. Project folder:
    [project-root]/sf-apex/templates/[template]
Example:
Read: ~/.claude/plugins/marketplaces/sf-skills/sf-apex/templates/apex-class.cls

选择模板:
类类型模板
触发器
templates/trigger.trigger
触发器动作
templates/trigger-action.cls
服务类
templates/service.cls
选择器类
templates/selector.cls
批处理类
templates/batch.cls
可队列类
templates/queueable.cls
测试类
templates/test-class.cls
测试数据工厂
templates/test-data-factory.cls
标准类
templates/apex-class.cls
模板路径解析(按顺序尝试):
  1. 市场文件夹
    ~/.claude/plugins/marketplaces/sf-skills/sf-apex/templates/[template]
  2. 项目文件夹
    [project-root]/sf-apex/templates/[template]
示例
Read: ~/.claude/plugins/marketplaces/sf-skills/sf-apex/templates/apex-class.cls

Phase 3: Code Generation/Review

阶段3:代码生成/审核

For Generation:
  1. Create class file in
    force-app/main/default/classes/
  2. Apply naming conventions (see docs/naming-conventions.md)
  3. Include ApexDoc comments
  4. Create corresponding test class
For Review:
  1. Read existing code
  2. Run validation against best practices
  3. Generate improvement report with specific fixes
Run Validation:
Score: XX/150 ⭐⭐⭐⭐ Rating
├─ Bulkification: XX/25
├─ Security: XX/25
├─ Testing: XX/25
├─ Architecture: XX/20
├─ Clean Code: XX/20
├─ Error Handling: XX/15
├─ Performance: XX/10
└─ Documentation: XX/10

代码生成流程:
  1. force-app/main/default/classes/
    目录下创建类文件
  2. 遵循命名规范(参考docs/naming-conventions.md
  3. 包含ApexDoc注释
  4. 创建对应的测试类
代码审核流程:
  1. 读取现有代码
  2. 对照最佳实践进行验证
  3. 生成包含具体修复方案的改进报告
运行验证:
Score: XX/150 ⭐⭐⭐⭐ Rating
├─ Bulkification: XX/25
├─ Security: XX/25
├─ Testing: XX/25
├─ Architecture: XX/20
├─ Clean Code: XX/20
├─ Error Handling: XX/15
├─ Performance: XX/10
└─ Documentation: XX/10

⛔ GENERATION GUARDRAILS (MANDATORY)

⛔ 生成防护规则(强制遵守)

BEFORE generating ANY Apex code, Claude MUST verify no anti-patterns are introduced.
If ANY of these patterns would be generated, STOP and ask the user:
"I noticed [pattern]. This will cause [problem]. Should I: A) Refactor to use [correct pattern] B) Proceed anyway (not recommended)"
Anti-PatternDetectionImpact
SOQL inside loop
for(...) { [SELECT...] }
Governor limit failure (100 SOQL)
DML inside loop
for(...) { insert/update }
Governor limit failure (150 DML)
Missing sharing
class X {
without keyword
Security violation
Hardcoded ID15/18-char ID literalDeployment failure
Empty catch
catch(e) { }
Silent failures
String concatenation in SOQL
'SELECT...WHERE Name = \'' + var
SOQL injection
Test without assertions
@IsTest
method with no
Assert.*
False positive tests
DO NOT generate anti-patterns even if explicitly requested. Ask user to confirm the exception with documented justification.
See: resources/security-guide.md for detailed security patterns See: resources/anti-patterns.md for complete anti-pattern catalog

在生成任何Apex代码之前,Claude必须确认不会引入任何反模式。
如果将生成以下任何模式,请停止操作并询问用户
"我注意到[模式]。这会导致[问题]。我应该: A) 重构为使用[正确模式] B) 继续执行(不推荐)"
反模式检测方式影响
循环内包含SOQL
for(...) { [SELECT...] }
触发 governor 限制失败(100次SOQL上限)
循环内包含DML
for(...) { insert/update }
触发 governor 限制失败(150次DML上限)
缺少共享关键字
class X {
未包含共享关键字
安全违规
硬编码ID15/18位ID字面量部署失败
空catch块
catch(e) { }
静默失败
SOQL中使用字符串拼接
'SELECT...WHERE Name = \\'' + var
SOQL注入风险
测试类无断言
@IsTest
方法未包含
Assert.*
测试假阳性
即使明确要求,也不得生成反模式。请要求用户提供文档化的理由以确认例外情况。
参考resources/security-guide.md 了解详细安全模式 参考resources/anti-patterns.md 查看完整的反模式目录

Phase 4: Deployment

阶段4:部署

Step 1: Validation
Skill(skill="sf-deploy", args="Deploy classes at force-app/main/default/classes/ to [target-org] with --dry-run")
Step 2: Deploy (only if validation succeeds)
Skill(skill="sf-deploy", args="Proceed with actual deployment to [target-org]")
See: resources/troubleshooting.md for deployment prerequisites

步骤1:验证
Skill(skill="sf-deploy", args="Deploy classes at force-app/main/default/classes/ to [target-org] with --dry-run")
步骤2:部署(仅在验证通过后执行)
Skill(skill="sf-deploy", args="Proceed with actual deployment to [target-org]")
参考resources/troubleshooting.md 了解部署前提条件

Phase 5: Documentation & Testing Guidance

阶段5:文档与测试指导

Completion Summary:
✓ Apex Code Complete: [ClassName]
  Type: [type] | API: 65.0
  Location: force-app/main/default/classes/[ClassName].cls
  Test Class: [TestClassName].cls
  Validation: PASSED (Score: XX/150)

Next Steps: Run tests, verify behavior, monitor logs

完成总结:
✓ Apex代码完成: [ClassName]
  类型: [type] | API版本: 65.0
  位置: force-app/main/default/classes/[ClassName].cls
  测试类: [TestClassName].cls
  验证: 通过(评分: XX/150)

后续步骤: 运行测试、验证行为、监控日志

Best Practices (150-Point Scoring)

最佳实践(150分评分体系)

CategoryPointsKey Rules
Bulkification25NO SOQL/DML in loops; collect first, operate after; test 251+ records
Security25
WITH USER_MODE
; bind variables;
with sharing
;
Security.stripInaccessible()
Testing2590%+ coverage; Assert class; positive/negative/bulk tests; Test Data Factory
Architecture20TAF triggers; Service/Domain/Selector layers; SOLID; dependency injection
Clean Code20Meaningful names; self-documenting; no
!= false
; single responsibility
Error Handling15Specific before generic catch; no empty catch; custom business exceptions
Performance10Monitor with
Limits
; cache expensive ops; scope variables; async for heavy
Documentation10ApexDoc on classes/methods; meaningful params
Thresholds: ✅ 90+ (Deploy) | ⚠️ 67-89 (Review) | ❌ <67 (Block - fix required)
Deep Dives:
  • resources/bulkification-guide.md - Governor limits, collection handling
  • resources/security-guide.md - CRUD/FLS, sharing, injection prevention
  • resources/testing-patterns.md - Exception types, mocking, coverage
  • resources/patterns-deep-dive.md - TAF, @InvocableMethod, async patterns

类别分值核心规则
批量处理优化25禁止循环内执行SOQL/DML;先收集数据再操作;测试251+条记录
安全性25使用
WITH USER_MODE
;绑定变量;
with sharing
关键字;
Security.stripInaccessible()
测试25覆盖率90%+;使用Assert类;包含正向/负向/批量测试;使用测试数据工厂
架构20TAF触发器;服务/领域/选择器分层;SOLID原则;依赖注入
整洁代码20有意义的命名;自文档化;避免
!= false
;单一职责
错误处理15具体异常优先于通用异常捕获;禁止空catch块;自定义业务异常
性能10使用
Limits
监控;缓存昂贵操作;变量作用域;异步处理重负载
文档10类/方法包含ApexDoc注释;有意义的参数说明
阈值:✅ 90+(可部署) | ⚠️ 67-89(需审核) | ❌ <67(阻止部署 - 需修复)
深度指南:
  • resources/bulkification-guide.md - Governor限制、集合处理
  • resources/security-guide.md - CRUD/FLS、共享机制、注入防护
  • resources/testing-patterns.md - 异常类型、模拟、覆盖率
  • resources/patterns-deep-dive.md - TAF、@InvocableMethod、异步模式

Trigger Actions Framework (TAF)

Trigger Actions Framework (TAF)

Quick Reference

快速参考

When to Use: If TAF package is installed in target org (check:
sf package installed list
)
Trigger Pattern (one per object):
apex
trigger AccountTrigger on Account (before insert, after insert, before update, after update, before delete, after delete, after undelete) {
    new MetadataTriggerHandler().run();
}
Action Class (one per behavior):
apex
public class TA_Account_SetDefaults implements TriggerAction.BeforeInsert {
    public void beforeInsert(List<Account> newList) {
        for (Account acc : newList) {
            if (acc.Industry == null) {
                acc.Industry = 'Other';
            }
        }
    }
}
⚠️ CRITICAL: TAF triggers do NOTHING without
Trigger_Action__mdt
records! Each action class needs a corresponding Custom Metadata record.
Installation:
bash
sf package install --package 04tKZ000000gUEFYA2 --target-org [alias] --wait 10
Fallback: If TAF is NOT installed, use standard trigger pattern (see resources/patterns-deep-dive.md)
See: resources/patterns-deep-dive.md for complete TAF patterns and Custom Metadata setup

使用场景:如果目标组织已安装TAF包(检查:
sf package installed list
触发器模式(每个对象一个):
apex
trigger AccountTrigger on Account (before insert, after insert, before update, after update, before delete, after delete, after undelete) {
    new MetadataTriggerHandler().run();
}
动作类(每个行为一个):
apex
public class TA_Account_SetDefaults implements TriggerAction.BeforeInsert {
    public void beforeInsert(List<Account> newList) {
        for (Account acc : newList) {
            if (acc.Industry == null) {
                acc.Industry = 'Other';
            }
        }
    }
}
⚠️ 关键注意事项:TAF触发器在没有
Trigger_Action__mdt
记录的情况下不会执行任何操作!每个动作类都需要对应的自定义元数据记录。
安装命令:
bash
sf package install --package 04tKZ000000gUEFYA2 --target-org [alias] --wait 10
备选方案:如果未安装TAF,使用标准触发器模式(参考resources/patterns-deep-dive.md
参考resources/patterns-deep-dive.md 了解完整的TAF模式和自定义元数据设置

Async Decision Matrix

异步决策矩阵

ScenarioUse
Simple callout, fire-and-forget
@future(callout=true)
Complex logic, needs chaining
Queueable
Process millions of records
Batch Apex
Scheduled/recurring job
Schedulable
Post-queueable cleanup
Queueable Finalizer
See: resources/patterns-deep-dive.md for detailed async patterns

场景推荐方案
简单调用、触发即遗忘
@future(callout=true)
复杂逻辑、需要链式调用
Queueable
处理百万级记录
Batch Apex
定时/周期性任务
Schedulable
队列后清理
Queueable Finalizer
参考resources/patterns-deep-dive.md 了解详细的异步模式

Modern Apex Features (API 62.0)

现代Apex特性(API 62.0)

  • Null coalescing:
    value ?? defaultValue
  • Safe navigation:
    record?.Field__c
  • User mode:
    WITH USER_MODE
    in SOQL
  • Assert class:
    Assert.areEqual()
    ,
    Assert.isTrue()
Breaking Change (API 62.0): Cannot modify Set while iterating - throws
System.FinalException
See: resources/bulkification-guide.md for collection usage

  • 空合并运算符
    value ?? defaultValue
  • 安全导航运算符
    record?.Field__c
  • 用户模式:SOQL中使用
    WITH USER_MODE
  • Assert类
    Assert.areEqual()
    Assert.isTrue()
破坏性变更(API 62.0):迭代时无法修改Set集合 - 会抛出
System.FinalException
参考resources/bulkification-guide.md 了解集合使用方法

Flow Integration (@InvocableMethod)

Flow集成 (@InvocableMethod)

Apex classes can be called from Flow using
@InvocableMethod
. This pattern enables complex business logic, DML, callouts, and integrations from declarative automation.
Apex类可通过
@InvocableMethod
从Flow中调用。此模式支持从声明式自动化中执行复杂业务逻辑、DML操作、调用和集成。

Quick Pattern

快速示例

apex
public with sharing class RecordProcessor {

    @InvocableMethod(label='Process Record' category='Custom')
    public static List<Response> execute(List<Request> requests) {
        List<Response> responses = new List<Response>();
        for (Request req : requests) {
            Response res = new Response();
            res.isSuccess = true;
            res.processedId = req.recordId;
            responses.add(res);
        }
        return responses;
    }

    public class Request {
        @InvocableVariable(label='Record ID' required=true)
        public Id recordId;
    }

    public class Response {
        @InvocableVariable(label='Is Success')
        public Boolean isSuccess;
        @InvocableVariable(label='Processed ID')
        public Id processedId;
    }
}
Template: Use
templates/invocable-method.cls
for complete pattern
See:
  • resources/patterns-deep-dive.md - Complete @InvocableMethod guide
  • docs/flow-integration.md - Advanced Flow-Apex patterns
  • docs/triangle-pattern.md - Flow-LWC-Apex triangle

apex
public with sharing class RecordProcessor {

    @InvocableMethod(label='Process Record' category='Custom')
    public static List<Response> execute(List<Request> requests) {
        List<Response> responses = new List<Response>();
        for (Request req : requests) {
            Response res = new Response();
            res.isSuccess = true;
            res.processedId = req.recordId;
            responses.add(res);
        }
        return responses;
    }

    public class Request {
        @InvocableVariable(label='Record ID' required=true)
        public Id recordId;
    }

    public class Response {
        @InvocableVariable(label='Is Success')
        public Boolean isSuccess;
        @InvocableVariable(label='Processed ID')
        public Id processedId;
    }
}
模板:使用
templates/invocable-method.cls
获取完整模式
参考:
  • resources/patterns-deep-dive.md - 完整的@InvocableMethod指南
  • docs/flow-integration.md - 高级Flow-Apex模式
  • docs/triangle-pattern.md - Flow-LWC-Apex三角集成

Testing Best Practices

测试最佳实践

The 3 Test Types (PNB Pattern)

三种测试类型(PNB模式)

Every feature needs:
  1. Positive: Happy path test
  2. Negative: Error handling test
  3. Bulk: 251+ records test
Example:
apex
@IsTest
static void testPositive() {
    Account acc = new Account(Name = 'Test', Industry = 'Tech');
    insert acc;
    Assert.areEqual('Tech', [SELECT Industry FROM Account WHERE Id = :acc.Id].Industry);
}

@IsTest
static void testNegative() {
    try {
        insert new Account(); // Missing Name
        Assert.fail('Expected DmlException');
    } catch (DmlException e) {
        Assert.isTrue(e.getMessage().contains('REQUIRED_FIELD_MISSING'));
    }
}

@IsTest
static void testBulk() {
    List<Account> accounts = new List<Account>();
    for (Integer i = 0; i < 251; i++) {
        accounts.add(new Account(Name = 'Bulk ' + i));
    }
    insert accounts;
    Assert.areEqual(251, [SELECT COUNT() FROM Account]);
}
See:
  • resources/testing-patterns.md - Exception types, mocking, Test Data Factory
  • docs/testing-guide.md - Complete testing reference

每个功能都需要:
  1. 正向测试:正常流程测试
  2. 负向测试:错误处理测试
  3. 批量测试:251+条记录测试
示例:
apex
@IsTest
static void testPositive() {
    Account acc = new Account(Name = 'Test', Industry = 'Tech');
    insert acc;
    Assert.areEqual('Tech', [SELECT Industry FROM Account WHERE Id = :acc.Id].Industry);
}

@IsTest
static void testNegative() {
    try {
        insert new Account(); // 缺少Name字段
        Assert.fail('Expected DmlException');
    } catch (DmlException e) {
        Assert.isTrue(e.getMessage().contains('REQUIRED_FIELD_MISSING'));
    }
}

@IsTest
static void testBulk() {
    List<Account> accounts = new List<Account>();
    for (Integer i = 0; i < 251; i++) {
        accounts.add(new Account(Name = 'Bulk ' + i));
    }
    insert accounts;
    Assert.areEqual(251, [SELECT COUNT() FROM Account]);
}
参考:
  • resources/testing-patterns.md - 异常类型、模拟、测试数据工厂
  • docs/testing-guide.md - 完整测试参考

Common Exception Types

常见异常类型

When writing test classes, use these specific exception types:
Exception TypeWhen to Use
DmlException
Insert/update/delete failures
QueryException
SOQL query failures
NullPointerException
Null reference access
ListException
List operation failures
LimitException
Governor limit exceeded
CalloutException
HTTP callout failures
Example:
apex
@IsTest
static void testExceptionHandling() {
    try {
        insert new Account(); // Missing required Name
        Assert.fail('Expected DmlException was not thrown');
    } catch (DmlException e) {
        Assert.isTrue(e.getMessage().contains('REQUIRED_FIELD_MISSING'),
            'Expected REQUIRED_FIELD_MISSING but got: ' + e.getMessage());
    }
}
See: resources/testing-patterns.md for complete reference

编写测试类时,请使用以下具体异常类型:
异常类型使用场景
DmlException
插入/更新/删除失败
QueryException
SOQL查询失败
NullPointerException
空引用访问
ListException
集合操作失败
LimitException
超出Governor限制
CalloutException
HTTP调用失败
示例:
apex
@IsTest
static void testExceptionHandling() {
    try {
        insert new Account(); // 缺少必填Name字段
        Assert.fail('Expected DmlException was not thrown');
    } catch (DmlException e) {
        Assert.isTrue(e.getMessage().contains('REQUIRED_FIELD_MISSING'),
            'Expected REQUIRED_FIELD_MISSING but got: ' + e.getMessage());
    }
}
参考resources/testing-patterns.md 查看完整参考

LSP-Based Validation (Auto-Fix Loop)

基于LSP的验证(自动修复循环)

The sf-apex skill includes Language Server Protocol (LSP) integration for real-time syntax validation. This enables Claude to automatically detect and fix Apex syntax errors during code authoring.
sf-apex技能包含语言服务器协议(LSP)集成,用于实时语法验证。这使Claude能够在代码编写过程中自动检测并修复Apex语法错误。

How It Works

工作原理

  1. PostToolUse Hook: After every Write/Edit operation on
    .cls
    or
    .trigger
    files, the LSP hook validates syntax
  2. Apex Language Server: Uses Salesforce's official
    apex-jorje-lsp.jar
    (from VS Code extension)
  3. Auto-Fix Loop: If errors are found, Claude receives diagnostics and auto-fixes them (max 3 attempts)
  4. Two-Layer Validation:
    • LSP Validation: Fast syntax checking (~500ms)
    • 150-Point Validation: Semantic analysis for best practices
  1. PostToolUse钩子:每次对
    .cls
    .trigger
    文件执行写入/编辑操作后,LSP钩子会验证语法
  2. Apex语言服务器:使用Salesforce官方的
    apex-jorje-lsp.jar
    (来自VS Code扩展)
  3. 自动修复循环:如果发现错误,Claude会收到诊断信息并自动修复(最多3次尝试)
  4. 双层验证:
    • LSP验证:快速语法检查(约500ms)
    • 150分验证:针对最佳实践的语义分析

Prerequisites

前提条件

For LSP validation to work, users must have:
Graceful Degradation: If LSP is unavailable, validation silently skips - the skill continues to work with only 150-point semantic validation.
See: resources/troubleshooting.md for complete LSP guide

要使用LSP验证,用户必须安装:
优雅降级:如果LSP不可用,验证会自动跳过 - 技能将仅使用150分语义验证继续工作。
参考resources/troubleshooting.md 查看完整LSP指南

Cross-Skill Integration

跨技能集成

SkillWhen to UseExample
sf-metadataDiscover object/fields before coding
Skill(skill="sf-metadata")
→ "Describe Invoice__c"
sf-dataGenerate 251+ test records after deploy
Skill(skill="sf-data")
→ "Create 251 Accounts for bulk testing"
sf-deployDeploy to org - see Phase 4
Skill(skill="sf-deploy", args="Deploy to [org]")
sf-flowCreate Flow that calls your ApexSee @InvocableMethod section above
sf-lwcCreate LWC that calls your Apex
@AuraEnabled
controller patterns

技能使用场景示例
sf-metadata编码前发现对象/字段
Skill(skill="sf-metadata")
→ "Describe Invoice__c"
sf-data部署后生成251+测试记录
Skill(skill="sf-data")
→ "Create 251 Accounts for bulk testing"
sf-deploy部署到组织 - 参考阶段4
Skill(skill="sf-deploy", args="Deploy to [org]")
sf-flow创建调用Apex的Flow参考@InvocableMethod部分
sf-lwc创建调用Apex的LWC
@AuraEnabled
控制器模式

Reference Documentation

参考文档

Quick Guides (resources/)

快速指南(resources/)

GuideDescription
patterns-deep-dive.mdTAF, @InvocableMethod, async patterns, service layer
security-guide.mdCRUD/FLS, sharing, SOQL injection, guardrails
bulkification-guide.mdGovernor limits, collections, monitoring
testing-patterns.mdException types, mocking, Test Data Factory, coverage
anti-patterns.mdCode smells, red flags, refactoring patterns
troubleshooting.mdLSP validation, deployment errors, debug logs
指南描述
patterns-deep-dive.mdTAF、@InvocableMethod、异步模式、服务层
security-guide.mdCRUD/FLS、共享机制、SOQL注入防护、防护规则
bulkification-guide.mdGovernor限制、集合、监控
testing-patterns.md异常类型、模拟、测试数据工厂、覆盖率
anti-patterns.md代码异味、危险信号、重构模式
troubleshooting.mdLSP验证、部署错误、调试日志

Full Documentation (docs/)

完整文档(docs/)

DocumentDescription
best-practices.md
Bulkification, collections, null safety, guard clauses, DML performance
code-smells-guide.md
Code smells detection and refactoring patterns
design-patterns.md
12 patterns including Domain Class, Abstraction Levels
trigger-actions-framework.md
TAF setup and advanced patterns
security-guide.md
Complete CRUD/FLS and sharing reference
testing-guide.md
Complete test patterns and mocking
naming-conventions.md
Variable, method, class naming rules
solid-principles.md
SOLID principles for Apex
code-review-checklist.md
150-point scoring criteria
flow-integration.md
Complete @InvocableMethod guide
triangle-pattern.md
Flow-LWC-Apex integration
llm-anti-patterns.md
NEW: Common LLM code generation mistakes (Java types, non-existent methods, Map patterns)
Path:
~/.claude/plugins/marketplaces/sf-skills/sf-apex/docs/

文档描述
best-practices.md
批量处理优化、集合、空安全、防护子句、DML性能
code-smells-guide.md
代码异味检测与重构模式
design-patterns.md
12种模式,包括领域类、抽象层级
trigger-actions-framework.md
TAF设置与高级模式
security-guide.md
完整的CRUD/FLS和共享参考
testing-guide.md
完整测试模式与模拟
naming-conventions.md
变量、方法、类命名规则
solid-principles.md
Apex的SOLID原则
code-review-checklist.md
150分评分标准
flow-integration.md
完整的@InvocableMethod指南
triangle-pattern.md
Flow-LWC-Apex集成
llm-anti-patterns.md
新增:LLM代码生成常见错误(Java类型、不存在的方法、Map模式)
路径
~/.claude/plugins/marketplaces/sf-skills/sf-apex/docs/

Dependencies

依赖项

All optional: sf-deploy, sf-metadata, sf-data. Install:
/plugin install github:Jaganpro/sf-skills/[skill-name]

均为可选:sf-deploy、sf-metadata、sf-data。安装命令:
/plugin install github:Jaganpro/sf-skills/[skill-name]

Notes

注意事项

  • API Version: 62.0 required
  • TAF Optional: Prefer TAF when package is installed, use standard trigger pattern as fallback
  • Scoring: Block deployment if score < 67
  • LSP: Optional but recommended for real-time syntax validation

  • API版本:需要62.0
  • TAF可选:优先使用已安装的TAF,标准触发器模式作为备选
  • 评分:如果评分<67,阻止部署
  • LSP:可选但推荐用于实时语法验证

License

许可证

MIT License. See LICENSE file. Copyright (c) 2024-2025 Jag Valaiyapathy
MIT许可证。查看LICENSE文件。 Copyright (c) 2024-2025 Jag Valaiyapathy ",