Token导航 LogoToken导航

Agent Skill · 前端设计

apex-class(顶尖级)

apex-class 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

apex-class 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描有未通过项,按安装量在前端设计类的 10,216 个 Skill 里排第 7,947。

总安装 326周安装 14GitHub Stars 228下载 114核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:apex-class(顶尖级)
来源仓库:https://github.com/forcedotcom/afv-library
仓库路径:skills/apex-class
安装命令:
npx skills add https://github.com/forcedotcom/afv-library --skill apex-class
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/forcedotcom/afv-library --skill apex-class

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

apex-class 用于生成结构良好、可直接投入生产的 Salesforce Apex 类代码。适合在 Codex、Claude、Cursor、Gemini CLI 中开发服务层、查询封装、批处理或队列化逻辑时使用。

可生成 Service、Selector、Domain、Batch、Queueable、Schedulable 等类别的 Apex 代码,但不包括触发器和单元测试。安装前请确认权限范围和维护状态,避免触发不必要的联网或文件操作。建议结合原始 README 和项目实际需求核验输出是否符合业务语义和安全规范。

来源仓库内路径:skills/apex-class

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/forcedotcom/afv-library --skill apex-class;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

apex-class 怎么安装?

在终端执行 npx skills add https://github.com/forcedotcom/afv-library --skill apex-class。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

apex-class 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

apex-class 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

apex-class 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

apex-class 用的人多吗?

公开数据是累计安装 326 次,近一周安装 14 次,下载 114 次,GitHub 228 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

apex-class 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
apex-class

顶尖级 · 本页

326228需要联网未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Apex Class

Generate well-structured, production-ready Apex classes for Salesforce development.

Scope

Generates:

  • Service classes (business logic layer)
  • Selector / query classes (SOQL encapsulation)
  • Domain classes (SObject-specific logic)
  • Batch Apex classes (Database.Batchable)
  • Queueable Apex classes (Queueable, optionally Finalizer)
  • Schedulable Apex classes (Schedulable)
  • DTO / wrapper / request-response classes
  • Utility / helper classes
  • Custom exception classes
  • Interfaces and abstract classes

Does NOT generate:

  • Triggers (use a trigger framework skill)
  • Unit tests (use a test writer skill)
  • Aura controllers
  • LWC JavaScript controllers

Gathering Requirements

Before generating code, gather these inputs from the user (ask if not provided):

  1. Class type — Service, Selector, Batch, Queueable, Schedulable, Domain, DTO, Utility, Interface, Abstract, Exception
  2. Class name — or enough context to derive a meaningful name
  3. SObject(s) involved — if applicable
  4. Business requirements — plain-language description of what the class should do
  5. Optional preferences:

- Sharing model (with sharing, without sharing, inherited sharing) - Access modifier (public or global) - API version (default: 62.0) - Whether to include ApexDoc comments (default: yes)

If the user provides a clear, complete request, generate immediately without unnecessary back-and-forth.


Code Standards — ALWAYS Follow These

Separation of Concerns

  • Service classes contain business logic. They call Selectors for data and may call Domain classes for SObject-specific behavior.
  • Selector classes encapsulate all SOQL queries. Services never contain inline SOQL.
  • Domain classes encapsulate SObject-specific logic (field defaults, validation, transformation).
  • Keep classes focused on a single responsibility.

Bulkification

  • All methods must operate on collections (List, Set, Map) by default.
  • Never accept a single SObject when a List<SObject> is appropriate.
  • Provide convenience overloads for single-record callers only when it makes the API cleaner, and have them delegate to the bulk method.

Governor Limit Safety

  • No SOQL or DML inside loops. Ever.
  • Collect IDs/records first, query/DML once outside the loop.
  • Use Limits class checks in batch/bulk operations where appropriate.
  • Prefer Database.insert(records, false) with error handling in batch contexts.

Sharing Model

  • Default to with sharing unless the user specifies otherwise.
  • If without sharing or inherited sharing is used, add an ApexDoc @description comment explaining WHY.

Naming Conventions

Class TypePatternExample
Service{SObject}ServiceAccountService
Selector{SObject}SelectorAccountSelector
Domain{SObject}DomainOpportunityDomain
Batch{Descriptive}BatchAccountDeduplicationBatch
Queueable{Descriptive}QueueableExternalSyncQueueable
Schedulable{Descriptive}SchedulableDailyCleanupSchedulable
DTO{Descriptive}DTOAccountMergeRequestDTO
Wrapper{Descriptive}WrapperOpportunityLineWrapper
Utility{Descriptive}UtilStringUtil, DateUtil
InterfaceI{Descriptive}INotificationService
AbstractAbstract{Descriptive}AbstractIntegrationService
Exception{Descriptive}ExceptionAccountServiceException

ApexDoc Comments

Include ApexDoc on every public and global method and on the class itself:

/**
 * @description Brief description of what the class does
 * @author Generated by Apex Class Writer Skill
 */
/**
 * @description Brief description of what the method does
 * @param paramName Description of the parameter
 * @return Description of the return value
 * @example
 * List<Account> results = AccountService.deduplicateAccounts(accountIds);
 */

Null Safety

  • Use guard clauses at the top of methods for null/empty inputs.
  • Use safe navigation (?.) where appropriate.
  • Return empty collections rather than null.

Constants

  • No magic strings or numbers in logic.
  • Use private static final constants or a dedicated constants class.
  • Use Label. custom labels for user-facing strings when appropriate.

Custom Exceptions

  • Each service class should define or reference a corresponding custom exception.
  • Inner exception classes are preferred for simple cases: public class AccountServiceException extends Exception {}
  • Include meaningful error messages with context.

Error Handling

  • Catch specific exceptions, not generic Exception unless re-throwing.
  • Log errors meaningfully (assume a logging utility exists or stub one).
  • In batch contexts, use Database.SaveResult / Database.UpsertResult with partial success.

Output Format

For every class, produce TWO files:

  1. {ClassName}.cls — The Apex class source code
  2. {ClassName}.cls-meta.xml — The metadata file

Meta XML Template

<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>{API_VERSION}</apiVersion>
    <status>Active</status>
</ApexClass>

Default apiVersion is 62.0 unless the user specifies otherwise.


Class Type–Specific Instructions

Service Classes

  • Read and follow: templates/service.cls
  • Stateless — no instance variables holding mutable state
  • All public methods should be static unless there's a compelling reason for instance methods
  • Delegate queries to a Selector class
  • Wrap business logic errors in a custom exception

Selector Classes

  • Read and follow: templates/selector.cls
  • One Selector per SObject (or per logical query domain)
  • Return List<SObject> or Map<Id, SObject>
  • Accept filter criteria as method parameters, not hardcoded
  • Include a private method that returns the base field list to keep DRY

Domain Classes

  • Read and follow: templates/domain.cls
  • Encapsulate field-level defaults, derivations, and validations
  • Operate on List<SObject> — designed to be called from triggers or services
  • No SOQL or DML — only in-memory SObject manipulation

Batch Classes

  • Read and follow: templates/batch.cls
  • Implement Database.Batchable<SObject> and optionally Database.Stateful
  • Use Database.QueryLocator in start() for large datasets
  • Handle partial failures in execute() using Database.SaveResult
  • Implement meaningful finish() — at minimum, log completion

Queueable Classes

  • Read and follow: templates/queueable.cls
  • Implement Queueable and optionally Database.AllowsCallouts
  • Accept data through the constructor — queueables are stateful
  • For chaining, include guard logic to prevent infinite chains
  • Optionally implement Finalizer for error recovery

Schedulable Classes

  • Read and follow: templates/schedulable.cls
  • Implement Schedulable
  • Keep execute() lightweight — delegate to a Batch or Queueable
  • Include a static method that returns a CRON expression for convenience
  • Document the expected schedule in ApexDoc

DTO / Wrapper Classes

  • Read and follow: templates/dto.cls
  • Use public properties — no getters/setters unless validation is needed
  • Include a no-arg constructor and optionally a parameterized constructor
  • Implement Comparable if sorting is needed
  • Keep them serialization-friendly (no transient state unless intentional)

Utility Classes

  • Read and follow: templates/utility.cls
  • All methods public static
  • Class should be public with sharing with a private constructor to prevent instantiation
  • Group related utilities (e.g., StringUtil, DateUtil, CollectionUtil)
  • Every method must be side-effect-free (no DML, no SOQL)

Interfaces

  • Read and follow: templates/interface.cls
  • Define the contract clearly with ApexDoc on every method signature
  • Use meaningful names that describe the capability: INotificationService, IRetryable

Abstract Classes

  • Read and follow: templates/abstract.cls
  • Provide default implementations for common behavior
  • Mark extension points as protected virtual or protected abstract
  • Include a concrete example in the ApexDoc showing how to extend

Custom Exceptions

  • Read and follow: templates/exception.cls
  • Extend Exception
  • Keep them simple — Apex exceptions don't support custom constructors well
  • Name them descriptively: AccountServiceException, IntegrationTimeoutException

Generation Workflow

  1. Determine the class type from the user's request
  2. Read the corresponding template from templates/
  3. Read relevant examples from examples/ if the class type has one
  4. Apply the user's requirements to the template pattern
  5. Generate the .cls file with full ApexDoc
  6. Generate the .cls-meta.xml file
  7. Present both files to the user
  8. Include a brief note on design decisions if any non-obvious choices were made

Anti-Patterns to Avoid

  • ❌ SOQL or DML inside loops
  • ❌ Hardcoded IDs or record type names (use Schema.SObjectType or Custom Metadata)
  • ❌ God classes that mix query + logic + DML
  • ❌ public fields on service classes
  • ❌ Returning null from methods that should return collections
  • ❌ Generic catch (Exception e) without re-throwing or meaningful handling
  • ❌ Business logic in Batch start() methods
  • ❌ Tight coupling between classes — use interfaces for extensibility
  • ❌ Magic strings or numbers
  • ❌ Methods longer than ~40 lines — break them into private helpers

平台分布

Codex

31.97%
按下载量换算36

Claude

30.4%
按下载量换算35

Cursor

18.97%
按下载量换算22

Gemini CLI

9.49%
按下载量换算11

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills