> Extracted from SKILL.md Section 17. This file is loaded on demand when scaffold details are needed.
## Overview
Generates stub metadata files (Flow XML, Apex classes) for Agent Script targets that don't exist in the org, with SObject-aware field discovery when connected.
## Usage
Generate stub metadata files directly using the type mapping and action classification rules below. Parse the `.agent` file to extract action targets and their I/O schemas, then generate Flow XML or Apex classes as appropriate.
Scaffolded stubs MUST return **realistic-looking data**, not `'TODO'` or empty strings. When the platform LLM invokes an action and gets `'TODO'` back, it has no useful data to present — so it falls back to its training data (SMALL_TALK grounding) or fabricates results (hallucination).
**Evidence:** Comcast eval stubs returned realistic comparison data → 93% grounding rate. JPMorgan eval stubs returned `'TODO'` → 40% grounding rate.
**Rule of thumb:** If the action does a single record lookup or update with no callouts, Flow is often a good fit. If it involves callouts, complex logic, or bulk operations, Apex is often a better fit. Choose based on requirement fit and team ownership, not a default preference.
sf api request rest --json "/services/data/v63.0/tooling/query?q=SELECT+DeveloperName+FROM+Flow+WHERE+IsActive=true+AND+ProcessType='AutoLaunchedFlow'" -o myorg
sf api request rest --json "/services/data/v63.0/tooling/query?q=SELECT+Name+FROM+ApexClass+WHERE+Body+LIKE+'%25InvocableMethod%25'" -o myorg
# 2. Generate stubs for missing targets (use type mapping + action classification above)
# 3. Edit stubs with business logic
# 4. Deploy to org
sf project deploy start --json --source-dir force-app/main/default -o myorg
# 5. Verify targets exist
sf api request rest --json "/services/data/v63.0/tooling/query?q=SELECT+DeveloperName+FROM+Flow+WHERE+IsActive=true+AND+ProcessType='AutoLaunchedFlow'" -o myorg
The `scaffold.py` script automates stub generation with SObject-aware field discovery. It is bundled with this skill under `scripts/` — no external clone required. Run it from the skill directory (stdlib only, no extra dependencies):