$npx -y skills add SalesforceAIResearch/agentforce-adlc --skill agentforce-generateBuild, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent actions, tools, subag
| 1 | # Agent Script Skill |
| 2 | |
| 3 | ## What This Skill Is For |
| 4 | |
| 5 | This skill is for developing Agentforce agents, primarily with Agent Script, Salesforce's scripting language for AI agents. |
| 6 | |
| 7 | **CRITICAL:** Agent Script is NOT AppleScript, JavaScript, Python, or any other |
| 8 | language. Do NOT confuse Agent Script syntax or semantics with any other |
| 9 | language you have been trained on. |
| 10 | |
| 11 | Agent Script agents are defined by `AiAuthoringBundle` metadata: a `.agent` file (agent behavior) plus `bundle-meta.xml` (bundle metadata). Actions can be implemented with invocable Apex, autolaunched Flows, Prompt Templates, and other supported types. |
| 12 | |
| 13 | This skill covers the full Agent Script lifecycle: designing agents, |
| 14 | writing Agent Script code, validating and debugging, deploying and |
| 15 | publishing, and testing. |
| 16 | |
| 17 | ## How to Use This Skill |
| 18 | |
| 19 | This file maps user intent to task domains and relevant reference files in `references/`. Treat this file as the execution router for end-to-end agent development, and use references for deep detail. |
| 20 | |
| 21 | Identify user intent from task descriptions. ALWAYS read indicated reference files BEFORE starting work. |
| 22 | |
| 23 | ## Rules That Always Apply |
| 24 | |
| 25 | 1. **Always `--json`.** ALWAYS include `--json` on EVERY `sf` CLI command. Do NOT pipe CLI output through `jq` or `2>/dev/null`. Read the full JSON response directly — LLMs parse JSON natively. |
| 26 | |
| 27 | 2. **Verify target org.** Before any org interaction, run `sf config get target-org --json` to confirm a target org is set. If none configured, ask the user to set one with `sf config set target-org <alias>`. |
| 28 | |
| 29 | 3. **Diagnose before you fix.** When validating/debugging agent behavior, |
| 30 | ALWAYS `--use-live-actions` to preview authoring bundles. Send utterances |
| 31 | then read resulting session traces to ground your understanding of the |
| 32 | agent's behavior. Trace files reveal subagent selection, action I/O, and |
| 33 | LLM reasoning. DO NOT modify `.agent` files or action implementations without |
| 34 | this grounding. See [Validation & Debugging](references/agent-validation-and-debugging.md) |
| 35 | for trace file locations and diagnostic patterns. |
| 36 | |
| 37 | 4. **Spec approval is a hard gate.** Never proceed past Agent Spec |
| 38 | creation without explicit user approval. |
| 39 | |
| 40 | 5. **Don't stall.** After a step completes successfully, announce the |
| 41 | next step and start it. Do not wait for the user to say "what's next" |
| 42 | or "ok, continue." The only checkpoints that require explicit user |
| 43 | approval are: (a) Agent Spec approval, (b) the pre-Publish CHECKPOINT, |
| 44 | (c) any A/B branch the skill explicitly surfaces (e.g., Data Cloud |
| 45 | not provisioned during ADL setup). Long-running async work like ADL |
| 46 | indexing should run in the background while the skill continues with |
| 47 | work that doesn't depend on the result. |
| 48 | |
| 49 | 6. **Draft-first lifecycle.** During normal authoring, stay in draft iteration: |
| 50 | edit `.agent` + action implementations, validate, deploy, and preview as many |
| 51 | times as needed. Do NOT publish/activate by default. Publish + activate are |
| 52 | explicit release actions that require the user to confirm they are ready to |
| 53 | commit the current draft to metadata and expose it to end users. |
| 54 | |
| 55 | 7. **Default agentic, pin with cause.** Use the most agentic posture that meets |
| 56 | each subagent's requirement, and add deterministic controls only for |
| 57 | regulation/trust gates or observed failures. For detailed posture rules, see |
| 58 | [Posture & Determinism](references/posture-and-determinism.md). |
| 59 | |
| 60 | 8. **No nested `if` or `else if`.** Agent Script only supports flat `if`/`else` blocks. No `else if`, no `if` inside `else`, no `if` inside `if`. For multi-branch logic, use sequential `if` statements or compound conditions (`if A and B:`). Nested structures cause silent compile failures. |
| 61 | |
| 62 | 9. **Action implementation is a user decision.** During planning/spec work, |
| 63 | default new actions to `NEEDS STUB` placeholders. Always ask the user whether |
| 64 | they want to scan org/project for existing implementations and/or generate |
| 65 | new Apex/Flow/Prompt implementations before taking either path. |
| 66 | |
| 67 | ## Task Domains |
| 68 | |
| 69 | Every task domain below has **Required Steps**. Follow verbatim, in order. The default path is: design -> draft implementation lo |