skills/sf-ai-agentscript/SKILL.md
Agent Script DSL for deterministic Agentforce agents. TRIGGER when: user writes or edits .agent files, builds FSM-based agents, uses Agent Script CLI (sf agent generate authoring-bundle, sf agent validate authoring-bundle, sf agent preview, sf agent publish authoring-bundle, sf agent activate), or asks about deterministic agent patterns, slot filling, or instruction resolution. DO NOT TRIGGER when: Builder metadata work (use sf-ai-agentforce), agent testing (use sf-ai-agentforce-testing), or persona design (use sf-ai-agentforce-persona).
npx skillsauth add jaganpro/claude-code-sfskills sf-ai-agentscriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Agent Script is the code-first path for deterministic Agentforce agents. Use this skill when the user is authoring .agent files, building finite-state topic flows, or needs repeatable control over routing, variables, actions, and publish behavior.
Start with the shortest guide first: references/activation-checklist.md
Migrating from the Builder UI? Use references/migration-guide.md
Use sf-ai-agentscript when the work involves:
.agent filessf agent generate authoring-bundle, sf agent validate authoring-bundle, sf agent preview, sf agent publish authoring-bundle, sf agent activate)Delegate elsewhere when the user is:
GenAiFunction, GenAiPlugin, GenAiPromptTemplate, Models API, custom Lightning types) → sf-ai-agentforceIf the user is in Builder Script / Canvas view but the outcome is a .agent authoring bundle, keep the work in sf-ai-agentscript.
Ask for or infer:
Before you author or fix any .agent file, verify these first:
start_agent blockTrue / Falseelse if and no nested ifactions: block@inputs in set expressionslinked variables have no defaultslinked variables do not use object / list typesagent_type@actions. prefixes consistentlyrun @actions.X only when X is a topic-level action definition with target:@system_variables.user_input contains/startswith/endswith for intent routingis_displayable: False + is_used_by_planner: True@outputs.X is scalar — inspect the output schema before branching or assignmentFor the expanded version, use references/activation-checklist.md.
| Agent type | Required | Forbidden / caution |
|---|---|---|
| AgentforceServiceAgent | Valid default_agent_user, correct permissions, target-org checks, prefer sf org create agent-user | Publishing without a real Einstein Agent User |
| AgentforceEmployeeAgent | Explicit agent_type | Supplying default_agent_user |
Full details: references/agent-user-setup.md
Use this order for consistency in this skill's examples and reviews:
config:
variables:
system:
connection:
knowledge:
language:
start_agent:
topic:
Official Salesforce materials present top-level blocks in differing sequences, and local validation evidence indicates multiple orderings compile. Treat this as a style convention, not a standalone correctness or publish blocker.
| Field | Rule |
|---|---|
| developer_name | Must match folder / bundle name |
| description | Public docs/examples should use this config field |
| agent_type | Set explicitly every time |
| default_agent_user | Service Agents only |
Local tooling also accepts agent_description: for compatibility, but this skill's public docs and examples should prefer description:.
else ififif bodiesactions:inputs: / outputs: blocksdescription and labelCanonical rule set: references/syntax-reference.md and references/validator-rule-catalog.md
.agentconfig, system, start_agent, and topics firstinputs: and outputs:available when for deterministic tool visibilityinstructions: ->.agent authoring and edits in source control.sf agent generate authoring-bundle --no-spec only when the user wants local bundle scaffolding.sf agent generate agent-spec as optional ideation / topic bootstrap, not the default workflow.sf agent create or sf agent generate template.Validation already runs automatically on write/edit. Use the CLI before publish:
sf agent validate authoring-bundle --api-name MyAgent -o TARGET_ORG --json
The validator covers structure, runtime gotchas, target readiness, and org-aware Service Agent checks. Rule IDs live in references/validator-rule-catalog.md.
Use the preview loop before publish:
start / send / end subcommands, not bare sf agent preview--authoring-bundle, always choose a mode explicitly: --simulate-actions or --use-live-actionsFull loop: references/preview-test-loop.md
sf agent publish authoring-bundle --api-name MyAgent -o TARGET_ORG --json
# Manual activation
sf agent activate --api-name MyAgent -o TARGET_ORG
# CI / deterministic activation of a known BotVersion
sf agent activate --api-name MyAgent --version <n> -o TARGET_ORG --json
Publishing does not activate the agent.
For automation, prefer --version <n> --json so activation is deterministic and machine-readable.
These execute as code, not suggestions:
available when guardsset / transition torun @actions.X only when X is a topic-level action definition with target:Important distinction:
set, transition to, and run @actions.X for a target-backed topic actionreasoning.actions: utilities / delegations such as @utils.setVariables, @utils.transition, and {[email protected]} instruction referencesIf you need deterministic behavior for something that is currently modeled as a reasoning-level utility, either:
set / transition to, orrun that actionSee references/instruction-resolution.md and references/architecture-patterns.md.
| Task | Delegate to | Why |
|---|---|---|
| Build flow:// targets | sf-flow | Flow creation / validation |
| Build Apex action targets | sf-apex | @InvocableMethod and business logic |
| Test topic routing / actions | sf-ai-agentforce-testing | Formal test specs and fix loops |
| Deploy / publish | sf-deploy | Deployment orchestration |
| Symptom | Likely cause | Read next |
|---|---|---|
| Internal Error during publish | invalid Service Agent user or missing action I/O | references/agent-user-setup.md, references/actions-reference.md |
| invalid input/output parameters on prompt template action | Target template is in Draft status — activate it first | references/action-prompt-templates.md |
| Parser rejects conditionals | else if, nested if, empty if body | references/syntax-reference.md |
| Action target issues | missing Flow / Apex target, inactive Flow, bad schemas | references/actions-reference.md |
| Prompt template runs but user sees blank response | prompt output marked is_displayable: True | references/production-gotchas.md, references/action-prompt-templates.md |
| Prompt action runs but planner behaves like output is missing | output hidden from direct display but not planner-visible | references/production-gotchas.md, references/actions-reference.md |
| ACTION_NOT_IN_SCOPE on run @actions.X | run points at a utility / delegation / unresolved action instead of a topic-level target-backed definition | references/syntax-reference.md, references/instruction-resolution.md |
| Deterministic cancel / revise / URL checks behave inconsistently | raw @system_variables.user_input matching or string-method guards are being used as control-flow-critical validation | references/syntax-reference.md, references/production-gotchas.md |
| @outputs.X comparisons or assignments behave unexpectedly | the action output is structured/wrapped, not a plain scalar | references/actions-reference.md, references/syntax-reference.md |
| Preview and runtime disagree | linked vars / context / known platform issues | references/known-issues.md |
| Validate passes but publish fails | org-specific user / permission / retrieve-back issue | references/production-gotchas.md, references/cli-guide.md |
| Score | Meaning | |---|---| | 90+ | Deploy with confidence | | 75–89 | Good, review warnings | | 60–74 | Needs focused revision | | < 60 | Block publish |
Full rubric: references/scoring-rubric.md
development
Lightning Web Components with PICKLES methodology and 165-point scoring. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use sf-apex), Aura components, or Visualforce.
tools
Use this skill whenever users want to build, inspect, debug, automate, or publish workflows in Agentforce Grid (AI Workbench) using Salesforce plus the Grid MCP or direct Grid REST calls. Trigger it for Grid workbook creation, worksheet setup, Object/Reference/AI/Agent/AgentTest/Evaluation/PromptTemplate/InvocableAction column design, prompt drafting inside Grid, worksheet execution troubleshooting, Grid YAML `apply_grid` specs, and Windows-specific Grid setup issues. Also use it when users mention AI Workbench, Grid Studio, workbook IDs, worksheet IDs, Grid Connect, or ask for recipes like "top opportunities with AI email drafts", "agent test suite in Grid", or "build this worksheet from YAML". Do not use it for generic Salesforce work unrelated to Agentforce Grid.
development
Salesforce Flex Credit estimation for Agentforce and Data Cloud workloads. TRIGGER when: user needs cost projections, scenario planning, budget sizing, or architecture tradeoff analysis for Agentforce prompts/actions, Data Cloud meters, or monthly Flex Credit usage. DO NOT TRIGGER when: user is building Agentforce metadata or .agent files themselves (use sf-ai-agentforce or sf-ai-agentscript), implementing Data Cloud assets (use sf-datacloud-*), or asking for contract-specific commercial approval that depends on non-public pricing terms.
testing
Permission Set analysis, hierarchy viewer, and access auditing. TRIGGER when: user asks "who has access to X?", analyzes permission sets/groups, or touches .permissionset-meta.xml / .permissionsetgroup-meta.xml files. DO NOT TRIGGER when: creating new metadata (use sf-metadata), deploying permission sets (use sf-deploy), or Apex sharing logic (use sf-apex).