forcedotcom/sf-skills / plugins/builder/agentforce-adlc/skills/agentforce-generate
agentforce-generate
FlaggedBuild, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, reviews, or changes .agent files or aiAuthoringBundle metadata; asks to fix AgentScript, audit an existing agent, run an AgentScript health check, common-pitfall review, or baseline-versus-candidate repair loop; changes a response, action, subagent, route, state flow, or Agent Spec; migrates or upgrades a legacy GenAiPlannerBundle Agentforce agent (NOT an Einstein Bot) to an aiAuthoringBundle (Agent Script) agent; previews, debugs, deploys, publishes, or tests agents; uses sf agent generate/preview/publish/test; or manages Agentforce MCP servers, tools, assets, or authentication. DO NOT TRIGGER when: Apex, Flow, Prompt Template, Experience Cloud, or general Salesforce CLI work is unrelated to Agent Script; the source is an Einstein Bot (BotDefinition/BotVersion) — use agentforce-bot-upgrade; or the primary input is a production session or trace ID rather than an agent artifact.
references/optimization-pattern-4-escalation.md
View on GitHub# Optimization Pattern 4: Repair Promised Human Handoff
## Detection Logic
Apply this pattern only when requirements or existing instructions specify
human help, live transfer, or escalation. If no such requirement or promise
exists, skip it. Do not add escalation as default boilerplate.
When it does apply, inspect both the instructions and channel capabilities:
1. Use a live handoff when the agent type, channel, and configuration support
`@utils.escalate`.
2. Give the real support path when live handoff is unavailable.
3. Never claim that a transfer occurred when no supported handoff exists.
## How to Fix
1. If instructions promise a live handoff, verify that a reachable
`@utils.escalate` action exists.
2. Put the action in the current execution block by default. Add an escalation
subagent only when it needs separate instructions, actions, or authority.
3. If live handoff is unsupported, remove the promise and state the real
support path.
4. Do not escalate merely because a request is difficult unless that trigger is
an explicit business requirement.
## Example
**Before:**
```agentscript
start_agent customer_support:
description: "Handles customer support requests"
reasoning:
instructions: ->
| Help customers with supported questions.
Transfer users to a person when they ask.
actions:
answer_question: @actions.AnswerQuestionWithKnowledge
with query = ...
```
**After:**
```agentscript
start_agent customer_support:
description: "Handles customer support requests"
reasoning:
instructions: ->
| Help customers with supported questions.
If the user explicitly asks for a person, use
{!@actions.human_handoff} without also answering the request.
actions:
answer_question: @actions.AnswerQuestionWithKnowledge
with query = ...
human_handoff: @utils.escalate
description: "Transfer the user to a human agent."
```
This example assumes a service-agent channel with live handoff configured. For
an employee agent or unsupported channel, omit `human_handoff` and replace the
instruction with a verified support URL, queue, phone number, or case-creation
action.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |