Source profileQuality 94/100

VincentChuWaiChow/vanguard-frontier-agentic/skills/salesforce/salesforce-apex-generator-skill/SKILL.md

salesforce-apex-generator-skill

Generates production-grade Apex classes with Service-Selector-Domain layering, correct sharing models (with sharing / without sharing / inherited sharing per class type), async patterns (Queueable, Batchable, Schedulable), and governor-limit awareness. T0 static generation — no org connection required. TRIGGER when: user asks to write an Apex class or trigger, generate a service/selector/domain layer, create an async job, implement a REST resource, scaffold a .cls file, or port business logic to

Source repository stars
21
Declared platforms
0
Static risk flags
1
Last source update
2026-08-27
Source checked
2026-08-28

Decision brief

What it does: where it fits

T0 static code generation for production-grade Apex. This skill is a forge, not a flashlight — it authors correct, deployable Apex with the right sharing model, governor-limit safety, and security defaults for each class type. No org connection required.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/VincentChuWaiChow/vanguard-frontier-agentic --skill "skills/salesforce/salesforce-apex-generator-skill"
    Safe inspection promptEditorial

    Inspect the Agent Skill "salesforce-apex-generator-skill" from https://github.com/VincentChuWaiChow/vanguard-frontier-agentic/blob/e01b936730332eca271896571d43cc2013c67f3f/skills/salesforce/salesforce-apex-generator-skill/SKILL.md at commit e01b936730332eca271896571d43cc2013c67f3f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Recommended Workflow

      Map the request to a class type using the type table below. Set defaults: - Sharing: with sharing unless type-specific exception applies - Access modifier: public unless global is required - ApexDoc: always include - API version meta XML: always generate

      Sharing: with sharing unless type-specific exception appliesAccess modifier: public unless global is requiredApexDoc: always include
    2. 02

      Step 1 — Identify class type and infer defaults

      Map the request to a class type using the type table below. Set defaults: - Sharing: with sharing unless type-specific exception applies - Access modifier: public unless global is required - ApexDoc: always include - API version meta XML: always generate

      Sharing: with sharing unless type-specific exception appliesAccess modifier: public unless global is requiredApexDoc: always include
    3. 03

      Step 2 — Choose the minimal correct pattern

      Consult references/apex-patterns.md for Service-Selector-Domain conventions, async patterns, and type-specific templates.

      Consult references/apex-patterns.md for Service-Selector-Domain conventions, async patterns, and type-specific templates.
    4. 04

      Step 3 — Apply all hard-stop constraints

      Before writing a single line, verify every constraint in the Rules section would be satisfied. If a constraint would be violated by the user's request, explain the problem and propose the correct approach.

      Before writing a single line, verify every constraint in the Rules section would be satisfied. If a constraint would be violated by the user's request, explain the problem and propose the correct approach.
    5. 05

      Step 4 — Generate the class file

      Produce {ClassName}.cls with: - Correct with sharing / without sharing / inherited sharing declaration - ApexDoc comment block (purpose, author placeholder, version) - All SOQL outside loops - All DML outside loops - No @future methods — use Queueable - Bind variables for any dy…

      Correct with sharing / without sharing / inherited sharing declarationApexDoc comment block (purpose, author placeholder, version)All SOQL outside loops

    Permission review

    Static risk signals and limitations

    Writes files

    medium · line 18

    The documentation asks the agent to create, modify, or delete local files.

    "Create a .cls file for our deduplication logic"

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score94/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars21SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    VincentChuWaiChow/vanguard-frontier-agentic
    Skill path
    skills/salesforce/salesforce-apex-generator-skill/SKILL.md
    Commit
    e01b936730332eca271896571d43cc2013c67f3f
    License
    Apache-2.0
    Collected
    2026-08-28
    Default branch
    master
    View the original SKILL.md

    salesforce-apex-generator-skill

    T0 static code generation for production-grade Apex. This skill is a forge, not a flashlight — it authors correct, deployable Apex with the right sharing model, governor-limit safety, and security defaults for each class type. No org connection required.

    When This Skill Owns the Task

    Use salesforce-apex-generator-skill when the work requires authoring new Apex code:

    • "Write an AccountService class that queries all Accounts by owner"
    • "Generate a Queueable that sends platform events for Order updates"
    • "Create a Schedulable wrapper for a batch job"
    • "Scaffold the Selector layer for the Contact object"
    • "Implement a Domain class with trigger logic for Opportunity"
    • "Write a REST resource endpoint for an external integration"
    • "Create a .cls file for our deduplication logic"

    Delegate elsewhere when:

    SituationSkill to use
    User needs test classes specificallysalesforce-apex-test-generator-skill
    User wants to run tests against a live orgsalesforce-apex-test-runner-skill
    User is debugging a log file or stack tracesalesforce-apex-log-analyzer-skill
    User needs to deploy and validatesalesforce-deployment-validator-skill
    Static code review of existing Apexsalesforce-apex-lwc-code-review-skill

    Required Context to Gather First

    Before generating, confirm:

    1. Class type — service, selector, domain, batch, queueable, schedulable, invocable, trigger, trigger-handler, REST resource, DTO, utility, interface, exception
    2. Target object(s) — the SObject API names involved (e.g., Account, Opportunity__c)
    3. Business goal — what the class must accomplish
    4. Class name — derive from naming conventions if not provided
    5. Existing patterns — does the project use a trigger framework (TAF, MetadataTriggerHandler)? Service-Selector-Domain already in place?
    6. API version — default 62.0 minimum
    7. Test class expected? — always recommend pairing with salesforce-apex-test-generator-skill

    If the user provides a clear, complete request, generate immediately without unnecessary back-and-forth. Apply defaults (see Rules section) for anything not specified.


    Recommended Workflow

    Step 1 — Identify class type and infer defaults

    Map the request to a class type using the type table below. Set defaults:

    • Sharing: with sharing unless type-specific exception applies
    • Access modifier: public unless global is required
    • ApexDoc: always include
    • API version meta XML: always generate

    Step 2 — Choose the minimal correct pattern

    Consult references/apex-patterns.md for Service-Selector-Domain conventions, async patterns, and type-specific templates.

    Step 3 — Apply all hard-stop constraints

    Before writing a single line, verify every constraint in the Rules section would be satisfied. If a constraint would be violated by the user's request, explain the problem and propose the correct approach.

    Step 4 — Generate the class file

    Produce {ClassName}.cls with:

    • Correct with sharing / without sharing / inherited sharing declaration
    • ApexDoc comment block (purpose, author placeholder, version)
    • All SOQL outside loops
    • All DML outside loops
    • No @future methods — use Queueable
    • Bind variables for any dynamic SOQL
    • Proper exception handling
    • No hardcoded Ids or credentials

    Step 5 — Generate the metadata XML

    Produce {ClassName}.cls-meta.xml using the correct apiVersion and status: Active.

    Step 6 — Score against the quality rubric

    Run the 100-point scoring rubric (see below). If the score is below 80, revise before presenting. Document score and notes in the output.

    Step 7 — Recommend test class pairing

    Always end with an explicit recommendation to generate a companion test class using salesforce-apex-test-generator-skill, noting the class name and key scenarios to cover.


    Class Type Reference

    Class TypeSharing ModelAccessKey Rules
    Servicewith sharingpublicNo SOQL/DML in loops; inject Selector
    Selectorwith sharingpublicReturns typed lists; no business logic
    Domainwith sharingpublicTrigger-context aware; delegates to Service
    TriggerN/A (handler delegates)One trigger per object; delegates to Domain/handler
    Batchablewithout sharing or with sharingpublicImplements Database.Batchable; Database.Stateful only if required
    Queueablewith sharingpublicImplements Queueable; use System.Finalizer for chaining; replaces @future
    Schedulablewith sharingpublicImplements Schedulable; delegates to Queueable or Batch
    Invocablewith sharingpublic@InvocableMethod; typed inner request/result classes
    REST Resourcewithout sharing (framework handles sharing)global@RestResource; @HttpGet/@HttpPost etc.
    DTO / WrapperN/ApublicNo methods with side effects; serializable
    Utilitywith sharingpublicStatic methods only; no instance state
    ExceptionN/ApublicExtends Exception; no override of getMessage

    Rules

    Hard-Stop Constraints (Must Enforce)

    ConstraintRationale
    Place all SOQL outside loopsAvoid query governor limit (100 queries per transaction)
    Place all DML outside loopsAvoid DML statement governor limit (150 per transaction)
    Declare sharing keyword on every classPrevent unintended without sharing defaults and data leakage
    Use Custom Metadata / Labels / describe calls instead of hardcoded IdsPortability across orgs
    Always handle exceptions (log, rethrow, or recover)Prevent silent failures
    Use bind variables for all dynamic SOQL accepting user inputPrevent SOQL injection
    Use Apex-native collection typesPrevent compile errors from Java-style types
    Never use @future methodsUse Queueable with System.Finalizer; @future cannot chain or accept non-primitive types
    No System.debug in main code pathsDebug statements consume CPU; use a logging framework
    Security: use WITH USER_MODE on SOQL in classes that touch user-controlled dataEnforces FLS/CRUD at query time
    Apply Security.stripInaccessible when constructing SObjects from user inputStrips fields the user cannot access

    Naming Conventions

    TypePatternExample
    Service{SObject}ServiceAccountService
    Selector{SObject}SelectorAccountSelector
    Domain{SObject}DomainAccountDomain
    Handler{SObject}TriggerHandlerAccountTriggerHandler
    Batch{Purpose}BatchAccountDeduplicationBatch
    Queueable{Purpose}QueueableOrderEventQueueable
    Schedulable{Purpose}SchedulerNightlyCleanupScheduler
    DTO{Purpose}Dto or {Purpose}WrapperOrderResponseDto

    Quality Scoring Rubric (100-point)

    Score the generated class before presenting. Threshold: 80+ pass, 60–79 caveat with explanation, below 60 revise before presenting.

    DimensionPointsWhat earns full marks
    Sharing model correctness25Every class has an explicit sharing declaration; with sharing is used wherever FLS/CRUD enforcement is appropriate; without sharing is justified with a comment
    Governor-limit safety25No SOQL in loops; no DML in loops; bulkified with List/Map patterns; Collections used correctly
    Security defaults20WITH USER_MODE or Security.stripInaccessible applied where appropriate; no hardcoded Ids or credentials; no SOQL injection vectors
    Naming conventions15Class and method names follow conventions table; ApexDoc present; XML meta generated
    Test class recommendation15Companion test class explicitly recommended with key scenarios listed

    Scoring penalties:

    • SOQL inside a loop: -20 (immediate caveat)
    • DML inside a loop: -20 (immediate caveat)
    • Missing sharing declaration: -15
    • @future used instead of Queueable: -10
    • Hardcoded Salesforce Id literal: -10
    • No exception handling in a method with DML: -10
    • Missing ApexDoc: -5

    T0 Contract

    This skill operates exclusively at T0 — static generation only.

    • No org connection: No sf CLI calls, no MCP tool calls, no live query or execution.
    • No OAuth required: Zero-scope, zero-credential, zero-network.
    • Output is draft code: All generated Apex is a starting point for human review and org-specific adaptation. No generated file should be deployed without a human reviewing the sharing model, naming conventions, and test coverage.
    • Handoff to T1/T2 for validation: Pair with salesforce-apex-test-generator-skill for test authoring, then salesforce-apex-test-runner-skill (T1) for execution, then salesforce-deployment-validator-skill (T2) for sandbox dry-run before any deployment.

    Refusal Triggers

    Stop and do not generate if:

    • The requested logic would require hardcoding a production org Id or session token — explain and ask for Custom Metadata or Label approach instead.
    • The request is to generate Apex that intentionally bypasses FLS/CRUD for user-visible data without a documented justification — explain the security risk and require explicit acknowledgment before generating without sharing on a user-data class.
    • The user requests @future — explain the Queueable alternative and generate Queueable instead unless the user explicitly overrides with a documented reason.

    Output Format

    verdict: "pass | caveat | reject"
    quality_score: <0-100>
    quality_notes: "<scoring rationale>"
    
    generated_files:
      - path: "{ClassName}.cls"
        content: |
          <apex code>
      - path: "{ClassName}.cls-meta.xml"
        content: |
          <meta xml>
    
    sharing_model_used: "with sharing | without sharing | inherited sharing"
    sharing_model_rationale: "<why this model was chosen>"
    
    governor_limit_notes: "<any limit-adjacent patterns noted>"
    
    security_notes: "<WITH USER_MODE / stripInaccessible usage>"
    
    test_class_recommendation:
      companion_skill: "salesforce-apex-test-generator-skill"
      class_to_test: "{ClassName}"
      key_scenarios:
        - "<positive path>"
        - "<negative/exception path>"
        - "<bulk path (200+ records)>"
    
    assumptions:
      - "<list of assumptions made>"
    
    missing_context:
      - "<what the user should provide to improve the output>"
    

    Handoff Rules

    OutputHand off to
    Generated Apex needing test classsalesforce-apex-test-generator-skill
    Generated Apex ready for test executionsalesforce-apex-test-runner-skill (T1)
    Ready for sandbox validationsalesforce-deployment-validator-skill (T2)
    Code review of existing/generated Apexsalesforce-apex-lwc-code-review-skill

    Stop Conditions

    Stop and do not continue if:

    • The requested class type is not in the class type table and cannot be safely categorized — ask for clarification.
    • The request would produce Apex that violates a hard-stop constraint and the user insists on the violating pattern after explanation — document the refusal and stop.
    • The request requires live org data (field names, object relationships, current Apex) that the user has not provided — ask for the specific context needed.

    Security Notes

    • T0 static generation only: No org connection, no OAuth, no secrets.
    • Sharing by default: Every generated class has an explicit sharing declaration. with sharing is the default; without sharing only where explicitly required by class type (REST resource, certain batch contexts) and documented.
    • No credential generation: This skill never generates hardcoded credentials, org Ids, user Ids, or session tokens in Apex code. All external references use Custom Metadata, Custom Labels, or Named Credentials.
    • Security-first patterns: WITH USER_MODE, Security.stripInaccessible, and bind variables are applied by default to all user-data-touching code.
    • Draft status: All generated code is a starting point. Human review of sharing model, FLS patterns, and business logic correctness is required before deployment.

    Reference File Index

    FileWhen to read
    references/apex-patterns.mdService-Selector-Domain pattern, sharing models, async patterns, type templates
    references/governor-limits.mdGovernor limit values, bulkification strategies, async fallback patterns
    references/security-defaults.mdWITH SHARING default policy, USER_MODE, stripInaccessible, no hardcoded credentials

    Frequently asked questions

    What to verify before installation and use

    What does the salesforce-apex-generator-skill source document cover?

    T0 static code generation for production-grade Apex. This skill is a forge, not a flashlight — it authors correct, deployable Apex with the right sharing model, governor-limit safety, and security defaults for each class type. No org connection required.

    How do I install salesforce-apex-generator-skill?

    The source record exposes this install command: npx skills add https://github.com/VincentChuWaiChow/vanguard-frontier-agentic --skill "skills/salesforce/salesforce-apex-generator-skill". Inspect the command and pinned source before running it.

    Which permission-related actions were detected?

    Static rules flagged write-files in the source; the page lists the matching lines and excerpts.

    Alternatives

    Compare before choosing