forcedotcom/sf-skills / plugins/builder/salesforce-development/skills/platform-apex-generate
platform-apex-generate
VerifiedPrimary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 22.0 KB |
| assets/abstract.cls | other | 5.1 KB |
| assets/batch.cls | other | 4.8 KB |
| assets/domain.cls | other | 4.1 KB |
| assets/dto.cls | other | 3.5 KB |
| assets/exception.cls | other | 1.8 KB |
| assets/interface.cls | other | 747 B |
| assets/invocable.cls | other | 4.0 KB |
| assets/queueable.cls | other | 3.5 KB |
| assets/rest-resource.cls | other | 11.4 KB |
| assets/schedulable.cls | other | 2.5 KB |
| assets/selector.cls | other | 3.4 KB |
| assets/service.cls | other | 2.8 KB |
| assets/trigger.cls | other | 1.7 KB |
| assets/utility.cls | other | 3.4 KB |
| references/AccountDeduplicationBatch.cls | other | 5.8 KB |
| references/AccountSelector.cls | other | 6.3 KB |
| references/AccountService.cls | other | 7.8 KB |
assets/schedulable.cls
View on GitHub/**
* Schedulable Apex class for {describe the scheduled operation}.
* Delegates heavy processing to a Batch or Queueable job.
* Keep execute() lightweight — it should only launch other jobs.
*
* @example
* // Schedule to run daily at 2 AM
* String jobId = System.schedule(
* '{ClassName} - Daily',
* {ClassName}.CRON_DAILY_2AM,
* new {ClassName}()
* );
*
* // Or use the convenience method
* String jobId = {ClassName}.scheduleDaily();
*/
public with sharing class {ClassName} implements Schedulable {
// ─── CRON Expressions ────────────────────────────────────────────────
// Seconds Minutes Hours Day_of_month Month Day_of_week Optional_year
/** Runs daily at 2:00 AM */
public static final String CRON_DAILY_2AM = '0 0 2 * * ?';
/** Runs every weekday at 6:00 AM */
public static final String CRON_WEEKDAYS_6AM = '0 0 6 ? * MON-FRI';
/** Runs hourly at the top of the hour */
public static final String CRON_HOURLY = '0 0 * * * ?';
// ─── Schedulable Interface ───────────────────────────────────────────
/**
* Entry point for the scheduled execution.
* Delegates to a Batch or Queueable for the actual work.
* @param sc The schedulable context
*/
public void execute(SchedulableContext sc) {
// Option A: Launch a Batch job
// Database.executeBatch(new {BatchClassName}(), 200);
// Option B: Launch a Queueable job
// System.enqueueJob(new {QueueableClassName}(params));
// TODO: Implement delegation to appropriate async job
}
// ─── Convenience Scheduling Methods ──────────────────────────────────
/**
* Schedules this job to run daily at 2 AM
* @return The scheduled job Id
*/
public static String scheduleDaily() {
return System.schedule(
'{ClassName} - Daily 2AM',
CRON_DAILY_2AM,
new {ClassName}()
);
}
/**
* Aborts this scheduled job by name
* @param jobName The name used when scheduling
*/
public static void abort(String jobName) {
for (CronTrigger ct : [
SELECT Id FROM CronTrigger
WHERE CronJobDetail.Name = :jobName
]) {
System.abortJob(ct.Id);
}
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |