$npx -y skills add forcedotcom/sf-skills --skill omnistudio-callable-apex-generateSalesforce Industries Common Core (OmniStudio/Vlocity) Apex callable generation and review skill with 120-point scoring. Use when creating, reviewing, or migrating Industries callable Apex implementations. TRIGGER when: user creates or reviews System.Callable classes, migrates Vl
| 1 | # omnistudio-callable-apex-generate: Callable Apex for Salesforce Industries Common Core |
| 2 | |
| 3 | Specialist for Salesforce Industries Common Core callable Apex implementations. Produce secure, |
| 4 | deterministic, and configurable Apex that cleanly integrates with OmniStudio and Industries |
| 5 | extension points. |
| 6 | |
| 7 | ## Scope |
| 8 | |
| 9 | - **In scope**: Creating `System.Callable` classes for Industries extension points; reviewing callable implementations for correctness and risks; migrating `VlocityOpenInterface` / `VlocityOpenInterface2` to `System.Callable`; 120-point scoring and validation |
| 10 | - **Out of scope**: Generic Apex classes without callable interface (use `platform-apex-generate`); building Integration Procedures (use `omnistudio-integration-procedure-generate`); authoring OmniScripts (use `omnistudio-omniscript-generate`); deploying Apex classes (use `platform-metadata-deploy`) |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## Core Responsibilities |
| 15 | |
| 16 | 1. **Callable Generation**: Build `System.Callable` classes with safe action dispatch |
| 17 | 2. **Callable Review**: Audit existing callable implementations for correctness and risks |
| 18 | 3. **Validation & Scoring**: Evaluate against the 120-point rubric |
| 19 | 4. **Industries Fit**: Ensure compatibility with OmniStudio/Industries extension points |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Workflow (4-Phase Pattern) |
| 24 | |
| 25 | ### Phase 1: Requirements Gathering |
| 26 | |
| 27 | Ask for: |
| 28 | - Entry point (OmniScript, Integration Procedure, DataRaptor, or other Industries hook) |
| 29 | - Action names (strings passed into `call`) |
| 30 | - Input/output contract (required keys, types, and response shape) |
| 31 | - Data access needs (objects/fields, CRUD/FLS (Create/Read/Update/Delete and Field-Level Security) rules) |
| 32 | - Side effects (DML, callouts, async requirements) |
| 33 | |
| 34 | Then: |
| 35 | 1. Scan for existing callable classes: `Glob: **/*Callable*.cls` |
| 36 | 2. Identify shared utilities or base classes used for Industries extensions |
| 37 | 3. Create a task list |
| 38 | |
| 39 | --- |
| 40 | |
| 41 | ### Phase 2: Design & Contract Definition |
| 42 | |
| 43 | **Define the callable contract**: |
| 44 | - Action list (explicit, versioned strings) |
| 45 | - Input schema (required keys + types) |
| 46 | - Output schema (consistent response envelope) |
| 47 | |
| 48 | **Recommended response envelope**: |
| 49 | ```json |
| 50 | { |
| 51 | "success": true|false, |
| 52 | "data": {...}, |
| 53 | "errors": [ { "code": "...", "message": "..." } ] |
| 54 | } |
| 55 | ``` |
| 56 | |
| 57 | **Action dispatch rules**: |
| 58 | - Use `switch on action` |
| 59 | - Default case throws a typed exception |
| 60 | - No dynamic method invocation or reflection |
| 61 | |
| 62 | **VlocityOpenInterface / VlocityOpenInterface2 contract mapping**: |
| 63 | |
| 64 | When designing for legacy Open Interface extensions (or dual Callable + Open Interface support), map the signature: |
| 65 | |
| 66 | ```text |
| 67 | invokeMethod(String methodName, Map<String, Object> inputMap, Map<String, Object> outputMap, Map<String, Object> options) |
| 68 | ``` |
| 69 | |
| 70 | | Parameter | Role | Callable equivalent | |
| 71 | |-----------|------|---------------------| |
| 72 | | `methodName` | Action selector (same semantics as `action`) | `action` in `call(action, args)` | |
| 73 | | `inputMap` | Primary input data (required keys, types) | `args.get('inputMap')` | |
| 74 | | `outputMap` | Mutable map where results are written (out-by-reference) | Return value; Callable returns envelope instead | |
| 75 | | `options` | Additional context (parent DataRaptor/OmniScript context, invocation metadata) | `args.get('options')` | |
| 76 | |
| 77 | Design rules for Open Interface contracts: |
| 78 | - Treat `inputMap` and `options` as the combined input schema |
| 79 | - Define what keys must be written to `outputMap` per action (success and error cases) |
| 80 | - Preserve `methodName` strings so they align with Callable `action` strings |
| 81 | - Document whether `options` is required, optional, or unused for each action |
| 82 | |
| 83 | --- |
| 84 | |
| 85 | ### Phase 3: Implementation Pattern |
| 86 | |
| 87 | **Vanilla System.Callable** (flat args, no Open Interface coupling): |
| 88 | |
| 89 | **Read `assets/pattern_callable_vanilla.cls`** before generating — use when callers pass flat args and no VlocityOpenInterface integration is required. |
| 90 | |
| 91 | **Callable skeleton** (same inputs as VlocityOpenInterface): |
| 92 | |
| 93 | **Read `assets/pattern_callable_openinterface.cls`** before generating — use `inputMap` and `options` keys in `args` when integrating with Open Interface or when callers pass that structure. |
| 94 | |
| 95 | **Input format**: Callers pass `args` as `{ 'inputMap' => Map<String, Object |