sf-ai-agentscript by jaganpro/sf-skills
npx skills add https://github.com/jaganpro/sf-skills --skill sf-ai-agentscriptAgent Script 是确定性 Agentforce 代理的代码优先路径。当用户编写 .agent 文件、构建有限状态主题流或需要对路由、变量、操作和发布行为进行可重复控制时,请使用此技能。
首先从最短的指南开始:references/activation-checklist.md
当工作涉及以下内容时,使用 sf-ai-agentscript:
.agent 文件sf agent generate、sf agent validate、sf agent publish)当用户进行以下操作时,请委托给其他技能:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
询问或推断:
在编写或修复任何 .agent 文件之前,请先验证以下内容:
start_agent 块True / Falseelse if 和嵌套的 ifactions: 块set 表达式中没有 @inputslinked 变量没有默认值linked 变量不使用 object / list 类型agent_type@actions. 前缀X 是具有 target: 的主题级操作定义时,才使用 run @actions.X@system_variables.user_input contains/startswith/endswith 进行意图路由分支判断is_displayable: False + is_used_by_planner: True@outputs.X 是标量值——在分支或赋值之前检查输出模式扩展版本请使用 references/activation-checklist.md。
| 代理类型 | 必需项 | 禁止项 / 注意事项 |
|---|---|---|
AgentforceServiceAgent | 有效的 default_agent_user,正确的权限,目标组织检查 | 在没有真实 Einstein Agent User 的情况下发布 |
AgentforceEmployeeAgent | 明确的 agent_type | 提供 default_agent_user |
config:
variables:
system:
connection:
knowledge:
language:
start_agent:
topic:
| 字段 | 规则 |
|---|---|
developer_name | 必须与文件夹 / 包名称匹配 |
agent_description | 使用此字段替代旧的 description |
agent_type | 每次都明确设置 |
default_agent_user | 仅用于服务代理 |
else ififif 主体actions:inputs: / outputs: 块description 和 label.agent 文件config、system、start_agent 和主题inputs: 和 outputs: 的目标支持的操作available when 实现确定性工具可见性instructions: -> 的顶部验证在写入/编辑时已自动运行。在发布前使用 CLI:
sf agent validate authoring-bundle --api-name MyAgent -o TARGET_ORG --json
验证器涵盖结构、运行时陷阱、目标准备情况和组织感知的服务代理检查。规则 ID 位于 references/validator-rule-catalog.md。
在发布前使用预览循环:
sf agent publish authoring-bundle --api-name MyAgent -o TARGET_ORG --json
sf agent activate --api-name MyAgent -o TARGET_ORG
发布并不激活代理。
这些像代码一样执行,而不是建议:
available when 守卫set / transition toX 是具有 target: 的主题级操作定义时,才使用 run @actions.X重要区别:
set、transition to 以及用于目标支持的主题操作的 run @actions.Xreasoning.actions: 实用程序 / 委托,例如 @utils.setVariables、@utils.transition 和 {!@actions.X} 指令引用如果需要对当前建模为推理级实用程序的内容实现确定性行为,请执行以下任一操作:
set / transition to,或run 该操作| 任务 | 委托给 | 原因 |
|---|---|---|
构建 flow:// 目标 | sf-flow | Flow 创建 / 验证 |
| 构建 Apex 操作目标 | sf-apex | @InvocableMethod 和业务逻辑 |
| 测试主题路由 / 操作 | sf-ai-agentforce-testing | 正式测试规范和修复循环 |
| 部署 / 发布 | sf-deploy | 部署编排 |
| 分数 | 含义 |
|---|---|
| 90+ | 可放心部署 |
| 75–89 | 良好,需审查警告 |
| 60–74 | 需要重点修订 |
| < 60 | 阻止发布 |
完整评分标准:references/scoring-rubric.md
每周安装次数
254
代码仓库
GitHub 星标数
219
首次出现
2026年1月22日
安全审计
安装于
cursor245
codex244
gemini-cli242
opencode242
github-copilot239
amp236
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
Use sf-ai-agentscript when the work involves:
.agent filessf agent generate, sf agent validate, sf agent publish)Delegate elsewhere when the user is:
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 defaultsFor the expanded version, use references/activation-checklist.md.
| Agent type | Required | Forbidden / caution |
|---|---|---|
AgentforceServiceAgent | Valid default_agent_user, correct permissions, target-org checks | Publishing without a real Einstein Agent User |
AgentforceEmployeeAgent | Explicit agent_type | Supplying default_agent_user |
Full details: references/agent-user-setup.md
config:
variables:
system:
connection:
knowledge:
language:
start_agent:
topic:
| Field | Rule |
|---|---|
developer_name | Must match folder / bundle name |
agent_description | Use instead of legacy description |
agent_type | Set explicitly every time |
default_agent_user | Service Agents only |
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: ->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:
Full loop: references/preview-test-loop.md
sf agent publish authoring-bundle --api-name MyAgent -o TARGET_ORG --json
sf agent activate --api-name MyAgent -o TARGET_ORG
Publishing does not activate the agent.
These execute as code, not suggestions:
available when guardsset / transition torun @actions.X only whenX 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 {!@actions.X} 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 body |
| 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
Weekly Installs
254
Repository
GitHub Stars
219
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor245
codex244
gemini-cli242
opencode242
github-copilot239
amp236
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
linked 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 assignmentif| 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 |