@salesforce/afv-skills 1.6.9 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -23
- package/package.json +1 -1
- package/skills/developing-agentforce/README.md +112 -0
- package/skills/{agentforce-development → developing-agentforce}/SKILL.md +109 -16
- package/skills/{agentforce-development → developing-agentforce}/assets/agents/README.md +2 -2
- package/skills/developing-agentforce/assets/agents/order-service.agent +272 -0
- package/skills/developing-agentforce/assets/agents/verification-gate.agent +280 -0
- package/skills/{agentforce-development → developing-agentforce}/assets/bundle-meta.xml +1 -1
- package/skills/{agentforce-development → developing-agentforce}/references/actions-reference.md +20 -0
- package/skills/{agentforce-development → developing-agentforce}/references/agent-design-and-spec-creation.md +1 -1
- package/skills/{agentforce-development → developing-agentforce}/references/agent-metadata-and-lifecycle.md +3 -3
- package/skills/{agentforce-development → developing-agentforce}/references/agent-script-core-language.md +40 -3
- package/skills/{agentforce-development → developing-agentforce}/references/agent-user-setup.md +60 -57
- package/skills/{agentforce-development → developing-agentforce}/references/agent-validation-and-debugging.md +22 -20
- package/skills/developing-agentforce/references/architecture-patterns.md +158 -0
- package/skills/developing-agentforce/references/complex-data-types.md +57 -0
- package/skills/developing-agentforce/references/deploy-reference.md +134 -0
- package/skills/developing-agentforce/references/discover-reference.md +102 -0
- package/skills/developing-agentforce/references/examples.md +350 -0
- package/skills/developing-agentforce/references/feature-validity.md +43 -0
- package/skills/developing-agentforce/references/instruction-resolution.md +545 -0
- package/skills/{agentforce-development → developing-agentforce}/references/known-issues.md +18 -18
- package/skills/{agentforce-development → developing-agentforce}/references/production-gotchas.md +24 -3
- package/skills/developing-agentforce/references/safety-review-reference.md +145 -0
- package/skills/{agentforce-development → developing-agentforce}/references/salesforce-cli-for-agents.md +9 -7
- package/skills/developing-agentforce/references/scaffold-reference.md +153 -0
- package/skills/developing-agentforce/references/scoring-rubric.md +24 -0
- package/skills/{agentforce-development → developing-agentforce}/references/version-history.md +2 -2
- package/skills/generating-flow/SKILL.md +3 -1
- package/skills/observing-agentforce/SKILL.md +368 -0
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +1262 -0
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls-meta.xml +5 -0
- package/skills/observing-agentforce/references/improve-reference.md +359 -0
- package/skills/observing-agentforce/references/issue-classification.md +220 -0
- package/skills/observing-agentforce/references/reproduce-reference.md +131 -0
- package/skills/observing-agentforce/references/stdm-queries.md +381 -0
- package/skills/observing-agentforce/references/stdm-schema.md +189 -0
- package/skills/testing-agentforce/SKILL.md +335 -0
- package/skills/testing-agentforce/assets/basic-test-spec.yaml +59 -0
- package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +101 -0
- package/skills/testing-agentforce/assets/standard-test-spec.yaml +123 -0
- package/skills/testing-agentforce/references/action-execution.md +241 -0
- package/skills/testing-agentforce/references/batch-testing.md +274 -0
- package/skills/testing-agentforce/references/preview-testing.md +353 -0
- package/skills/testing-agentforce/references/test-report-format.md +160 -0
- package/skills/testing-agentforce/references/troubleshooting.md +73 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/README-legacy.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agent-spec-template.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/hello-world.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/multi-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.bundle-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/simple-qa.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/apex/models-api-queueable.cls +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/apex-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/error-handling.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/escalation-setup.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/flow-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/n-ary-conditions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/topic-with-actions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/deterministic-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/escalation-pattern.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/flow-action-lookup.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/hub-and-spoke.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/invocable-apex-template.cls +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/local-info-agent-annotated.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-apex.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-flow.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-plugin.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/http-callout-flow.flow-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/minimal-starter.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/README.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/action-callbacks.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/advanced-input-bindings.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/bidirectional-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/critical-input-collection.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/delegation-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/lifecycle-events.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/llm-controlled-actions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/multi-step-workflow.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/open-gate-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/procedural-instructions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/prompt-template-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/system-instruction-overrides.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/prompt-rag-search.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/template-multi-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/template-single-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/verification-gate.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/action-prompt-templates.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/agent-access-guide.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/agent-topic-map-diagrams.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/minimal-examples.md +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# Agentforce Vibes Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This repository provides a curated collection of Salesforce agent skills for building applications. It includes skills for Agentforce agents, Lightning apps, Flow, Apex, SOQL, Lightning Web Components (LWC), UI bundles, objects and fields, permission sets, and related areas.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This repository curates Salesforce-focused skills from the wider developer community to accelerate Agentforce Vibes agentic workflows.
|
|
5
|
+
The skills are contributed by Salesforce and the broader community. It’s optimized for Agentforce Vibes and can be used with any AI tool that supports skills.
|
|
8
6
|
|
|
9
7
|
## 🗂️ Structure
|
|
10
8
|
|
|
@@ -23,44 +21,51 @@ afv-library/
|
|
|
23
21
|
└── README.md
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
##
|
|
24
|
+
## 🚀 Usage
|
|
25
|
+
|
|
26
|
+
| **Tool** | **Usage** |
|
|
27
|
+
|----------|-------------|
|
|
28
|
+
| **Agentforce Vibes** | Skills are auto-installed and auto-updated |
|
|
29
|
+
| **OpenCode, Claude Code, Codex, Cursor, [more](https://agentskills.io/)** | `npx skills add forcedotcom/afv-library` |
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
## 📦 Samples
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
The `samples/` folder contains synced sample apps. For example, `samples/ui-bundle-template-app-react-sample-b2e/` tracks the npm package `@salesforce/ui-bundle-template-app-react-sample-b2e` (nightly and on manual trigger via GitHub Actions).
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
To run the same sync locally from the repository root:
|
|
33
36
|
|
|
34
37
|
```bash
|
|
35
38
|
npm install
|
|
36
39
|
npm run sync-react-b2e-sample
|
|
37
40
|
```
|
|
38
41
|
|
|
39
|
-
The GitHub Action runs
|
|
40
|
-
|
|
42
|
+
The GitHub Action runs the same commands and opens a pull request when the npm package version changes. For more information, see [samples/README.md](samples/README.md).
|
|
41
43
|
|
|
42
44
|
## 🛠️ Agent Skills
|
|
43
45
|
|
|
44
|
-
Agent Skills
|
|
46
|
+
Agent Skills package executable workflows, scripts, and reference material into self-contained directories. This repository follows the open [Agent Skills specification](https://agentskills.io/) and can be used with OpenCode, Claude Code, Codex, Cursor, and other tools that support skills.
|
|
45
47
|
|
|
46
48
|
### Directory Structure
|
|
47
49
|
|
|
48
|
-
Each skill is a folder
|
|
49
|
-
- `SKILL.md` (required)
|
|
50
|
-
- `scripts/` (optional)
|
|
51
|
-
- `references/` (optional)
|
|
52
|
-
- `assets/` (optional)
|
|
53
|
-
|
|
50
|
+
Each skill is a folder that can include:
|
|
51
|
+
- `SKILL.md` (required): Instructions and YAML front matter.
|
|
52
|
+
- `scripts/` (optional): Executable scripts (For example, Python, Bash, or JavaScript).
|
|
53
|
+
- `references/` (optional): Extra reference documentation.
|
|
54
|
+
- `assets/` (optional): Templates, schemas, and lookup data
|
|
54
55
|
|
|
55
56
|
## 🤝 Contributing
|
|
56
57
|
|
|
57
|
-
See [Contributing](./CONTRIBUTING.md)
|
|
58
|
+
See [Contributing](./CONTRIBUTING.md).
|
|
58
59
|
|
|
60
|
+
## 💬 Feedback
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
- Open an issue in this repository
|
|
63
|
+
- Open a pull request with suggested changes
|
|
64
|
+
- Use GitHub Discussions or the pull request thread for broader conversation
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
- Open an issue in GitHub
|
|
64
|
-
- Suggest improvements via pull request
|
|
65
|
-
- Start a discussion in GitHub Discussions or the pull request thread
|
|
66
|
+
## Project Governance & Support
|
|
66
67
|
|
|
68
|
+
- [License](./LICENSE.txt)
|
|
69
|
+
- [Code of Conduct](./CODE_OF_CONDUCT.md)
|
|
70
|
+
- [Contributing](./CONTRIBUTING.md)
|
|
71
|
+
- [Security](./SECURITY.md)
|
package/package.json
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Agentforce Development Skill
|
|
2
|
+
|
|
3
|
+
A Claude Code skill for building, modifying, debugging, and deploying Agentforce agents using Agent Script — Salesforce's scripting language for next-generation AI agents on the Atlas Reasoning Engine.
|
|
4
|
+
|
|
5
|
+
## What This Skill Does
|
|
6
|
+
|
|
7
|
+
Agent Script was introduced in 2025 with zero training data in any AI model. This skill bridges that gap by providing structured reference material, design patterns, CLI workflows, and debugging guidance so that AI coding assistants can work with Agent Script accurately.
|
|
8
|
+
|
|
9
|
+
The skill covers the full Agent Script lifecycle:
|
|
10
|
+
|
|
11
|
+
| Domain | What It Handles |
|
|
12
|
+
|--------|----------------|
|
|
13
|
+
| Create an Agent | Agent Spec design, environment validation, bundle generation, code authoring |
|
|
14
|
+
| Modify an Agent | Topic/action changes, instruction refinement, flow control updates |
|
|
15
|
+
| Create or Modify Backing Logic | Invocable Apex stubs, Flow wrappers, Prompt Templates |
|
|
16
|
+
| Deploy and Publish | Source deploy, agent activation, publishing to channels |
|
|
17
|
+
| Diagnose Compilation Errors | Compiler error interpretation, syntax fixes, metadata resolution |
|
|
18
|
+
| Diagnose Behavioral Issues | Trace-based debugging, topic routing, action I/O analysis |
|
|
19
|
+
| Diagnose Production Issues | Runtime failures, reserved keyword conflicts, deployment gotchas |
|
|
20
|
+
| Test an Agent | Utterance-based validation, preview with live actions, trace analysis |
|
|
21
|
+
| Generate Diagrams | Topic map visualizations, agent architecture diagrams |
|
|
22
|
+
|
|
23
|
+
## Skill Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
developing-agentforce/
|
|
27
|
+
├── SKILL.md # Router — maps user intent to task domains and reference files
|
|
28
|
+
├── references/ # Domain knowledge (14 files)
|
|
29
|
+
│ ├── agent-script-core-language.md
|
|
30
|
+
│ ├── agent-design-and-spec-creation.md
|
|
31
|
+
│ ├── agent-validation-and-debugging.md
|
|
32
|
+
│ ├── salesforce-cli-for-agents.md
|
|
33
|
+
│ ├── agent-metadata-and-lifecycle.md
|
|
34
|
+
│ ├── agent-access-guide.md
|
|
35
|
+
│ ├── agent-user-setup.md
|
|
36
|
+
│ ├── actions-reference.md
|
|
37
|
+
│ ├── action-prompt-templates.md
|
|
38
|
+
│ ├── agent-topic-map-diagrams.md
|
|
39
|
+
│ ├── minimal-examples.md
|
|
40
|
+
│ ├── known-issues.md
|
|
41
|
+
│ ├── production-gotchas.md
|
|
42
|
+
│ └── version-history.md
|
|
43
|
+
├── assets/ # Templates, examples, and starter agents
|
|
44
|
+
│ ├── agent-spec-template.md
|
|
45
|
+
│ ├── invocable-apex-template.cls
|
|
46
|
+
│ ├── bundle-meta.xml
|
|
47
|
+
│ ├── patterns/ # Reusable Agent Script patterns
|
|
48
|
+
│ ├── agents/ # Annotated example agents
|
|
49
|
+
│ ├── apex/ # Apex backing logic examples
|
|
50
|
+
│ ├── components/ # LWC components for agent channels
|
|
51
|
+
│ ├── metadata/ # Metadata templates
|
|
52
|
+
│ └── *.agent # Starter agent templates
|
|
53
|
+
└── staging/ # Unmerged reference material awaiting review
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## How It Works
|
|
57
|
+
|
|
58
|
+
SKILL.md acts as a router. It detects user intent from task descriptions, maps to a task domain, and instructs the AI assistant to read the relevant reference files before starting work. Reference files are loaded on demand — the assistant only reads what the current task requires.
|
|
59
|
+
|
|
60
|
+
Three rules apply across all domains:
|
|
61
|
+
|
|
62
|
+
1. **Always `--json`** on every `sf` CLI command
|
|
63
|
+
2. **Diagnose before you fix** — preview with live actions and read traces before modifying code
|
|
64
|
+
3. **Spec approval is a hard gate** — never proceed past Agent Spec creation without user approval
|
|
65
|
+
|
|
66
|
+
## Prerequisites
|
|
67
|
+
|
|
68
|
+
- Salesforce org with Agentforce license
|
|
69
|
+
- API version 66.0+ (Spring '26)
|
|
70
|
+
- Einstein Agent User (for service agents)
|
|
71
|
+
- Salesforce CLI v2.x (`sf` command)
|
|
72
|
+
- Claude Code (or compatible AI coding agent)
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
Copy the `developing-agentforce` folder into your project's `.claude/skills/` directory:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
your-project/
|
|
80
|
+
└── .claude/
|
|
81
|
+
└── skills/
|
|
82
|
+
└── developing-agentforce/
|
|
83
|
+
├── SKILL.md
|
|
84
|
+
├── references/
|
|
85
|
+
└── assets/
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Restart Claude Code after installation.
|
|
89
|
+
|
|
90
|
+
## Version
|
|
91
|
+
|
|
92
|
+
Current version: **0.4.9** (2026-03-20). See [references/version-history.md](references/version-history.md) for the full changelog.
|
|
93
|
+
|
|
94
|
+
## Credits
|
|
95
|
+
|
|
96
|
+
This skill integrates knowledge from the following sources:
|
|
97
|
+
|
|
98
|
+
**Jag Valaiyapathy** ([sf-skills](https://github.com/Jaganpro/sf-skills), MIT License)
|
|
99
|
+
— Known issues catalog, production gotchas, agent access and permissions guide, and deployment patterns. Integrated starting in v0.4.2.
|
|
100
|
+
|
|
101
|
+
**Hua Xu** (Salesforce APAC FDE team)
|
|
102
|
+
— Open-gate routing pattern from Kogan agent deployment.
|
|
103
|
+
|
|
104
|
+
**Salesforce DevRel** ([agent-script-recipes](https://github.com/trailheadapps/agent-script-recipes))
|
|
105
|
+
— Canonical Agent Script examples used as grounding material.
|
|
106
|
+
|
|
107
|
+
**Dylan Zeigler, AI Platform** (llm-utils)
|
|
108
|
+
— Agent Script playground used as reference source.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Apache-2.0
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: agentforce
|
|
3
|
-
description: "
|
|
2
|
+
name: developing-agentforce
|
|
3
|
+
description: "Build, modify, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent topics, actions, tools, sub-agents, or flow control; writes or reviews an Agent Spec; previews, debugs, deploys, publishes, or tests agents; uses Agent Script CLI commands (sf agent generate/preview/publish/test). DO NOT TRIGGER when: Apex development, Flow building, Prompt Template authoring, Experience Cloud configuration, or general Salesforce CLI tasks unrelated to Agent Script."
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
compatibility: "Requires Agentforce license, API v66.0+, Einstein Agent User"
|
|
6
6
|
metadata:
|
|
7
|
-
version: "0.
|
|
8
|
-
last_updated: "2026-
|
|
7
|
+
version: "0.5.1"
|
|
8
|
+
last_updated: "2026-04-08"
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Agent Script Skill
|
|
@@ -32,9 +32,11 @@ Identify user intent from task descriptions. ALWAYS read indicated reference fil
|
|
|
32
32
|
|
|
33
33
|
## Rules That Always Apply
|
|
34
34
|
|
|
35
|
-
1. **Always `--json`.** ALWAYS include `--json` on EVERY `sf` CLI command.
|
|
35
|
+
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.
|
|
36
36
|
|
|
37
|
-
2. **
|
|
37
|
+
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>`.
|
|
38
|
+
|
|
39
|
+
3. **Diagnose before you fix.** When validating/debugging agent behavior,
|
|
38
40
|
ALWAYS `--use-live-actions` to preview authoring bundles. Send utterances
|
|
39
41
|
then read resulting session traces to ground your understanding of the
|
|
40
42
|
agent's behavior. Trace files reveal topic selection, action I/O, and
|
|
@@ -42,7 +44,7 @@ Identify user intent from task descriptions. ALWAYS read indicated reference fil
|
|
|
42
44
|
this grounding. See [Validation & Debugging](references/agent-validation-and-debugging.md)
|
|
43
45
|
for trace file locations and diagnostic patterns.
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
4. **Spec approval is a hard gate.** Never proceed past Agent Spec
|
|
46
48
|
creation without explicit user approval.
|
|
47
49
|
|
|
48
50
|
## Task Domains
|
|
@@ -57,10 +59,10 @@ User wants to build new agent from scratch. ALWAYS use Agent Script. Work with U
|
|
|
57
59
|
|
|
58
60
|
Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
|
|
59
61
|
|
|
60
|
-
1. **Design** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) to draft an Agent Spec. Always ask if you should scan for existing backing logic. Unless instructed otherwise, scan by reading `sfdx-project.json` to identify package directories, then search each for `@InvocableMethod` in `classes/`, `AutoLaunchedFlow` in `flows/`, and template metadata in `promptTemplates/`. Mark matches `EXISTS`; unmatched actions `NEEDS STUB`. **Always save Agent Spec as file.**
|
|
62
|
+
1. **Design** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) to draft an Agent Spec. Always ask if you should scan for existing backing logic. Unless instructed otherwise, scan by reading `sfdx-project.json` to identify package directories, then search each for `@InvocableMethod` in `classes/`, `AutoLaunchedFlow` in `flows/`, and template metadata in `promptTemplates/`. Mark matches `EXISTS`; unmatched actions `NEEDS STUB`. Also scan `objects/` for `.object-meta.xml` to discover custom objects — related objects often contain data the agent should expose even when not mentioned in the prompt. **Always save Agent Spec as file.**
|
|
61
63
|
2. **STOP for user approval of Agent Spec.** Present to user. Ask for approval or feedback. **Do not proceed** without approval. Once approved, proceed without stopping unless a step fails.
|
|
62
64
|
3. **Validate environment prerequisites** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md), Section 3 (Environment Prerequisites). Based on agent type from design, validate org environment:
|
|
63
|
-
- **Employee agent**: Confirm config block does NOT include `default_agent_user
|
|
65
|
+
- **Employee agent**: Confirm config block does NOT include `default_agent_user`, `connection messaging:`, or MessagingSession linked variables. Remove if present. See [Examples](references/examples.md) for a complete employee agent example.
|
|
64
66
|
- **Service agent**: Query org for Einstein Agent User. If one exists, confirm username with user. If none, guide user through creation. See [CLI for Agents](references/salesforce-cli-for-agents.md), Section 12 for creation steps and [Agent User Setup](references/agent-user-setup.md) for required permissions.
|
|
65
67
|
**Do not proceed to code generation until environment is validated.**
|
|
66
68
|
4. **Generate authoring bundle** —
|
|
@@ -81,7 +83,12 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
81
83
|
Send test utterances with:
|
|
82
84
|
`sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
|
|
83
85
|
Confirm topic routing, gating, and action invocations match Agent Spec. If behavior diverges, switch to **Diagnose Behavioral Issues** workflow. Return AFTER correcting issues.
|
|
84
|
-
|
|
86
|
+
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
87
|
+
- `validate authoring-bundle` passes with zero errors
|
|
88
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per topic
|
|
89
|
+
- Traces confirm correct topic routing and action invocation
|
|
90
|
+
- User explicitly approves deployment
|
|
91
|
+
9. **Publish** — Publish validates metadata structure, not agent behavior. Every publish creates permanent version number.
|
|
85
92
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
86
93
|
If publish fails, follow troubleshooting checklist in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md), Section 5 before retrying.
|
|
87
94
|
10. **Activate** — Makes new version available to users.
|
|
@@ -113,6 +120,12 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
113
120
|
access permissions, visibility troubleshooting
|
|
114
121
|
9. [Known Issues](references/known-issues.md) — only load when errors
|
|
115
122
|
persist after code fixes
|
|
123
|
+
10. [Architecture Patterns](references/architecture-patterns.md) — hub-and-spoke, verification gate, post-action loop
|
|
124
|
+
11. [Complex Data Types](references/complex-data-types.md) — type mapping decision tree
|
|
125
|
+
12. [Safety Review](references/safety-review-reference.md) — 7-category safety review
|
|
126
|
+
13. [Discover Reference](references/discover-reference.md) — target discovery CLI
|
|
127
|
+
14. [Scaffold Reference](references/scaffold-reference.md) — stub generation CLI
|
|
128
|
+
15. [Deploy Reference](references/deploy-reference.md) — deployment lifecycle, error recovery
|
|
116
129
|
|
|
117
130
|
### Comprehend an Existing Agent
|
|
118
131
|
|
|
@@ -168,7 +181,12 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
168
181
|
Send test utterances with:
|
|
169
182
|
`sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
|
|
170
183
|
Test changed paths first, then adjacent paths to catch regressions in existing behavior.
|
|
171
|
-
|
|
184
|
+
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
185
|
+
- `validate authoring-bundle` passes with zero errors
|
|
186
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per topic
|
|
187
|
+
- Traces confirm correct topic routing and action invocation
|
|
188
|
+
- User explicitly approves deployment
|
|
189
|
+
8. **Publish** — Publish validates metadata structure, not agent behavior. Every publish creates permanent version number.
|
|
172
190
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
173
191
|
If publish fails, follow troubleshooting checklist in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md), Section 5 before retrying.
|
|
174
192
|
9. **Activate** — Makes new version available to users.
|
|
@@ -270,8 +288,13 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
270
288
|
`sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
|
|
271
289
|
then send test utterances with:
|
|
272
290
|
`sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
|
|
273
|
-
Test key conversation paths to validate agent behavior when backed by live actions.
|
|
274
|
-
|
|
291
|
+
Test key conversation paths to validate agent behavior when backed by live actions.
|
|
292
|
+
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
293
|
+
- `validate authoring-bundle` passes with zero errors
|
|
294
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per topic
|
|
295
|
+
- Traces confirm correct topic routing and action invocation
|
|
296
|
+
- User explicitly approves deployment
|
|
297
|
+
4. **Publish** — Publish validates metadata structure, not agent behavior. DO NOT publish as part of a dev/test inner loop. ONLY publish as the FINAL step prior to activating the agent and surfacing it to end users.
|
|
275
298
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
276
299
|
If publish fails, follow *Troubleshooting Publish Failures* in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) before retrying.
|
|
277
300
|
5. **Activate** — Makes new version available to users.
|
|
@@ -357,8 +380,8 @@ User wants to create automated tests for Agent Script agent. Involves writing `A
|
|
|
357
380
|
Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
|
|
358
381
|
|
|
359
382
|
1. **Establish coverage baseline** — Read Agent Spec. If no Agent Spec exists, reverse-engineer first by following Comprehend steps. Map every topic, action, and flow control path to identify what needs test coverage.
|
|
360
|
-
2. **Design test scenarios** — For test design methodology, expectations, metrics, test spec YAML format, and templates, use **agentforce
|
|
361
|
-
3. **Write test spec YAML** — Use template and reference files from **agentforce
|
|
383
|
+
2. **Design test scenarios** — For test design methodology, expectations, metrics, test spec YAML format, and templates, use **testing-agentforce** skill. That skill owns all testing content. For each coverage target, write one or more test scenarios: user utterance, expected topic routing, expected action invocations, and expected agent response. Include both happy paths and edge cases.
|
|
384
|
+
3. **Write test spec YAML** — Use template and reference files from **testing-agentforce** skill. Save to `specs/<Agent_API_Name>-testSpec.yaml` in SFDX project.
|
|
362
385
|
4. **Create test metadata** — Generate `AiEvaluationDefinition` from test spec using CLI.
|
|
363
386
|
5. **Deploy test** — Deploy `AiEvaluationDefinition` to org.
|
|
364
387
|
6. **Run tests** — Execute test run using CLI. Capture results.
|
|
@@ -373,7 +396,7 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
373
396
|
structure for designing meaningful tests
|
|
374
397
|
3. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
|
|
375
398
|
Agent Spec as test coverage baseline
|
|
376
|
-
4. **agentforce
|
|
399
|
+
4. **testing-agentforce** skill — test spec YAML format, expectations,
|
|
377
400
|
metrics, test design methodology, and test spec template
|
|
378
401
|
|
|
379
402
|
## The Agent Spec
|
|
@@ -425,3 +448,73 @@ Planner validates ALL actions across ALL topics at startup. One missing permissi
|
|
|
425
448
|
|
|
426
449
|
**Apex action returns empty results in live preview but works in simulated:**
|
|
427
450
|
`WITH USER_MODE` + missing object permissions = silent failure (0 rows, no error). See [Agent User Setup & Permissions](references/agent-user-setup.md), Section 6.2.
|
|
451
|
+
|
|
452
|
+
## Syntax Quick Reference
|
|
453
|
+
|
|
454
|
+
- Block order: `system:` → `config:` → `variables:` → `connection:` → `knowledge:` → `language:` → `start_agent topic_selector:` → `topic:` blocks
|
|
455
|
+
- Indentation: **4 spaces** per indent level. Never use tabs. Mixing spaces and tabs breaks the parser.
|
|
456
|
+
- Booleans: `True`/`False` (capitalized)
|
|
457
|
+
- Strings: always double-quoted
|
|
458
|
+
- Numeric action I/O: bare `number` works for variables but **fails at publish** in action I/O. Use `object` + `complex_data_type_name` for numeric action parameters. See [Complex Data Types](references/complex-data-types.md) for the full decision tree.
|
|
459
|
+
- `after_reasoning:` has NO `instructions:` wrapper
|
|
460
|
+
- No `else if` — use compound `if x and y:` or sequential flat ifs
|
|
461
|
+
- Reserved `@InvocableVariable` names: `model`, `description`, `label` — cannot be used as Apex parameter names
|
|
462
|
+
- `@inputs` and `@outputs` are ephemeral: `@inputs` only in `with`; `@outputs` only in `set`/`if` immediately after the action. `@inputs` in `set` = silent failure.
|
|
463
|
+
|
|
464
|
+
See [Complex Data Types](references/complex-data-types.md) for the full Lightning type mapping decision tree. See [Instruction Resolution](references/instruction-resolution.md) for the 3-phase runtime model.
|
|
465
|
+
|
|
466
|
+
## Architecture Patterns
|
|
467
|
+
|
|
468
|
+
Three primary FSM patterns. Full details with code in [Architecture Patterns](references/architecture-patterns.md).
|
|
469
|
+
|
|
470
|
+
- **Hub-and-Spoke** (most common): `start_agent` routes to specialized topics. Each topic has "back to hub" transition. Do NOT create a separate routing topic.
|
|
471
|
+
- **Verification Gate**: Identity verification before protected topics. `available when` guards on protected transitions.
|
|
472
|
+
- **Post-Action Loop**: Post-action checks at TOP of `instructions: ->` trigger on re-resolution after action completes.
|
|
473
|
+
|
|
474
|
+
## Scoring Rubric
|
|
475
|
+
|
|
476
|
+
Score every generated agent on 100 points across 7 categories: Structure (15), Safety (15), Deterministic Logic (20), Instruction Resolution (20), FSM Architecture (10), Action Configuration (10), Deployment Readiness (10).
|
|
477
|
+
|
|
478
|
+
See [Scoring Rubric](references/scoring-rubric.md) for the complete rubric.
|
|
479
|
+
|
|
480
|
+
## Review Mode
|
|
481
|
+
|
|
482
|
+
When user provides an existing `.agent` file (e.g., `review path/to/file.agent`):
|
|
483
|
+
|
|
484
|
+
1. Read the file
|
|
485
|
+
2. Score against the 100-point rubric
|
|
486
|
+
3. List every issue grouped by category
|
|
487
|
+
4. Provide corrected code snippets
|
|
488
|
+
5. Offer to apply fixes
|
|
489
|
+
|
|
490
|
+
## Safety Review
|
|
491
|
+
|
|
492
|
+
7-category LLM-driven safety review for `.agent` files. Integrated into Phase 0 of authoring and deployment. Categories: Identity & Transparency, User Safety, Data Handling, Content Safety, Fairness, Deception, Scope & Boundaries.
|
|
493
|
+
|
|
494
|
+
See [Safety Review](references/safety-review-reference.md) for the complete framework, severity levels, false positive guidance, and adversarial test prompts.
|
|
495
|
+
|
|
496
|
+
## Discover & Scaffold
|
|
497
|
+
|
|
498
|
+
Validate action targets exist in org and generate stubs for missing ones.
|
|
499
|
+
|
|
500
|
+
See [Discover Reference](references/discover-reference.md) and [Scaffold Reference](references/scaffold-reference.md).
|
|
501
|
+
|
|
502
|
+
**CRITICAL:** Stubs must return realistic data, not `'TODO'`. Placeholder responses cause SMALL_TALK grounding because the LLM falls back to training data.
|
|
503
|
+
|
|
504
|
+
## Deploy Lifecycle
|
|
505
|
+
|
|
506
|
+
Validate → deploy metadata → publish bundle → activate. See [Deploy Reference](references/deploy-reference.md) for phases, error recovery, CI/CD, and rollback.
|
|
507
|
+
|
|
508
|
+
## Template Assets
|
|
509
|
+
|
|
510
|
+
Ready-to-use `.agent` templates in `assets/agents/` (hello-world, simple-qa, multi-topic, production-faq, order-service, verification-gate). See also `assets/patterns/` for 11+ reusable design patterns and [Examples](references/examples.md) for inline walkthroughs.
|
|
511
|
+
|
|
512
|
+
## Additional References
|
|
513
|
+
|
|
514
|
+
| Topic | File |
|
|
515
|
+
|-------|------|
|
|
516
|
+
| Architecture patterns | [architecture-patterns.md](references/architecture-patterns.md) |
|
|
517
|
+
| Type mapping decision tree | [complex-data-types.md](references/complex-data-types.md) |
|
|
518
|
+
| Feature validity by context | [feature-validity.md](references/feature-validity.md) |
|
|
519
|
+
| Instruction resolution model | [instruction-resolution.md](references/instruction-resolution.md) |
|
|
520
|
+
| Complete agent examples | [examples.md](references/examples.md) |
|
|
@@ -22,8 +22,8 @@ Templates for building complete, deployable agents.
|
|
|
22
22
|
|
|
23
23
|
2. Validate and deploy:
|
|
24
24
|
```bash
|
|
25
|
-
sf agent validate authoring-bundle --api-name My_Agent --target-org your-org
|
|
26
|
-
sf agent publish authoring-bundle --api-name My_Agent --target-org your-org
|
|
25
|
+
sf agent validate authoring-bundle --json --api-name My_Agent --target-org your-org
|
|
26
|
+
sf agent publish authoring-bundle --json --api-name My_Agent --target-org your-org
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Required Blocks
|