@salesforce/afv-skills 1.37.0 → 1.38.0

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.
Files changed (247) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-generate/README.md +20 -3
  3. package/skills/agentforce-generate/SKILL.md +253 -440
  4. package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
  5. package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
  6. package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
  7. package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
  8. package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
  9. package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
  10. package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
  11. package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
  12. package/skills/agentforce-generate/assets/patterns/README.md +3 -3
  13. package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
  14. package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
  15. package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
  16. package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
  17. package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
  18. package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
  19. package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
  20. package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
  21. package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
  22. package/skills/agentforce-generate/references/actions-reference.md +2 -2
  23. package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
  24. package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
  25. package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
  26. package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
  27. package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
  28. package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
  29. package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
  30. package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
  31. package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
  32. package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
  33. package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
  34. package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
  35. package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
  36. package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
  37. package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
  38. package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
  39. package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
  40. package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
  41. package/skills/agentforce-generate/references/examples.md +22 -22
  42. package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
  43. package/skills/agentforce-generate/references/known-issues.md +1 -2
  44. package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
  45. package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
  46. package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
  47. package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
  48. package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
  49. package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
  50. package/skills/agentforce-generate/references/reference-map.md +19 -3
  51. package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
  52. package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
  53. package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
  54. package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
  55. package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
  56. package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
  57. package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
  58. package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
  59. package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
  60. package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
  61. package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
  62. package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
  63. package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
  64. package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
  65. package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
  66. package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
  67. package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
  68. package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
  69. package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
  70. package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
  71. package/skills/design-systems-slds-validate/SKILL.md +14 -13
  72. package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
  73. package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
  74. package/skills/dx-org-devhub-configure/SKILL.md +268 -0
  75. package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
  76. package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
  77. package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
  78. package/skills/dx-org-manage/SKILL.md +135 -42
  79. package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
  80. package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
  81. package/skills/dx-org-manage/examples/README.md +1 -1
  82. package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
  83. package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
  84. package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
  85. package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
  86. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
  87. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
  88. package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
  89. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
  90. package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
  91. package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
  92. package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
  93. package/skills/dx-org-manage/references/definition_file_options.md +24 -0
  94. package/skills/dx-org-manage/references/edition_types.md +10 -8
  95. package/skills/dx-org-manage/references/opening-org.md +11 -12
  96. package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
  97. package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
  98. package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
  99. package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
  100. package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
  101. package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
  102. package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
  103. package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
  104. package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
  105. package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
  106. package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
  107. package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
  108. package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
  109. package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
  110. package/skills/experience-content-media-search/SKILL.md +17 -12
  111. package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
  112. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
  113. package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
  114. package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
  115. package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
  116. package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
  117. package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
  118. package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
  119. package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
  120. package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
  121. package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
  122. package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
  123. package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
  124. package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
  125. package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
  126. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
  127. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
  128. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
  129. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
  130. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
  131. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
  132. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
  133. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
  134. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
  135. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
  136. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
  137. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
  138. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
  139. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
  140. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
  141. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
  142. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
  143. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
  144. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
  145. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
  146. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
  147. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
  148. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
  149. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
  150. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
  151. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
  152. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
  153. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
  154. package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
  155. package/skills/experience-lwc-design-generate/SKILL.md +261 -0
  156. package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
  157. package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
  158. package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
  159. package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
  160. package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
  161. package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
  162. package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
  163. package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
  164. package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
  165. package/skills/experience-lwc-security-validate/SKILL.md +151 -0
  166. package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
  167. package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
  168. package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
  169. package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
  170. package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
  171. package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
  172. package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
  173. package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
  174. package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
  175. package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
  176. package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
  177. package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
  178. package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
  179. package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
  180. package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
  181. package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
  182. package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
  183. package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
  184. package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
  185. package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
  186. package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
  187. package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
  188. package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
  189. package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
  190. package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
  191. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
  192. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
  193. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
  194. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
  195. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
  196. package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
  197. package/skills/platform-apex-generate/SKILL.md +8 -7
  198. package/skills/platform-apex-test-generate/SKILL.md +3 -1
  199. package/skills/platform-apex-test-run/SKILL.md +9 -8
  200. package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
  201. package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
  202. package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
  203. package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
  204. package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
  205. package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
  206. package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
  207. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
  208. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
  209. package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
  210. package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
  211. package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
  212. package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
  213. package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
  214. package/skills/platform-policy-rule-generate/SKILL.md +22 -12
  215. package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
  216. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
  217. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  218. package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
  219. package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
  220. package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
  221. package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
  222. package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
  223. package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
  224. package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
  225. package/skills/platform-widget-generate/SKILL.md +3 -5
  226. package/skills/platform-widget-generate/examples/conditional.json +18 -13
  227. package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
  228. package/skills/platform-widget-generate/examples/single-object.json +2 -2
  229. package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
  230. package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
  231. package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
  232. package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
  233. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
  234. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
  235. package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
  236. package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
  237. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
  238. package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
  239. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
  240. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
  241. package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
  242. package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
  243. package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
  244. package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
  245. package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
  246. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
  247. package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
@@ -0,0 +1,180 @@
1
+ # AgentScript Audit Scope and Path Review
2
+
3
+ Follow this first half of the audit workflow before selecting or applying a
4
+ repair level.
5
+
6
+ ## Contents
7
+
8
+ - [Establish Scope and Evidence](#1-establish-scope-and-evidence)
9
+ - [Reconstruct the Use Cases](#2-reconstruct-the-use-cases)
10
+ - [Audit Every Reachable Path](#3-audit-every-reachable-path)
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Establish Scope and Evidence
15
+
16
+ - Locate the complete `.agent` bundle, its metadata, action implementations,
17
+ Agent Spec, test specifications, and relevant repository instructions.
18
+ - Determine whether the input is a complete agent, one extracted subagent, or
19
+ a pasted fragment. Do not report missing bundle scaffolding as a defect in an
20
+ intentionally extracted fragment.
21
+ - Inspect the worktree before editing. Preserve unrelated user changes.
22
+ - Identify available validation surfaces: Salesforce CLI and target org,
23
+ project commands, preview, test suites, and session traces.
24
+ - Read the full agent and every directly referenced action contract needed to
25
+ understand its behavior. Do not infer action outputs from names alone.
26
+ - Create the audit ledger or report shell now. Record artifact scope, baseline
27
+ identity, evidence limits, initial use cases, and the highest-priority
28
+ supported observations. Keep incomplete entries explicitly marked instead of
29
+ withholding the artifact until the audit is complete.
30
+ - Run the strongest available read-only project check. If an authenticated
31
+ target org and complete bundle are available, run:
32
+
33
+ ```bash
34
+ sf agent validate authoring-bundle --json --api-name <BundleName>
35
+ ```
36
+
37
+ Preserve the baseline diagnostics.
38
+
39
+ If only a fragment is available, perform a bounded semantic review and state
40
+ which structural, reachability, and runtime claims cannot be verified.
41
+
42
+ #### Scale the audit before reading a large agent
43
+
44
+ As a workflow heuristic, use the indexed audit below when a file is large
45
+ enough that a single-pass review would lose cross-node context. Rough defaults
46
+ are more than 2,000 lines or 10 execution nodes; adjust them to the density and
47
+ complexity of the artifact. They are not AgentScript runtime limits.
48
+
49
+ 1. Build a deterministic index first: block boundaries, variables, actions,
50
+ action outputs, transitions, lifecycle hooks, and available diagnostics.
51
+ Follow [AgentScript Compiler Setup](agentscript-toolchain.md) to load an
52
+ ambient SDK, install the public npm package, or build the public source
53
+ fallback, then run
54
+ `node <skill-directory>/scripts/index-agent.mjs <path-to-agent-file>` and
55
+ retain its JSON outside the bundle. This helper uses the real
56
+ parser/compiler rather than regex and reports its exact provider. If both
57
+ installation paths fail, record **compiler not used** and continue with
58
+ target-org validation or a bounded static review; do not stall the audit.
59
+ 2. Seed one audit ledger keyed by execution node and use-case ID immediately
60
+ after indexing. Do not rely on a single giant narrative summary.
61
+ 3. Screen each node for user-visible harm and confidence. Add supported
62
+ Critical and High findings to the ranked ledger as soon as they are found;
63
+ do not wait for every node to be deeply traced.
64
+ 4. Deep-trace the highest-ranked affected paths first. Open another reference
65
+ or source file only after naming the decision its evidence could change.
66
+ Stop a line of inquiry when two consecutive reads or queries add no material
67
+ evidence to that decision.
68
+ 5. Checkpoint the ledger after each reviewed node or coherent cause group. Mark
69
+ remaining nodes as pending so an interrupted audit still leaves a useful,
70
+ honest deliverable.
71
+ 6. After the node screening pass, run one cross-node pass for shared variables,
72
+ instruction overrides, transition arrivals, action ownership, and reset
73
+ behavior, then revise the rankings.
74
+ 7. Repair one coherent cause group per batch. Keep a coupled group small enough
75
+ to attribute any regression, then run validation, affected regression cases,
76
+ and representative unaffected canaries before the next batch.
77
+ 8. Report deferred accepted findings after every batch. Do not hold the first
78
+ useful result until the whole file has been rewritten.
79
+
80
+ Large size is not itself a defect. Do not split an agent merely to make the
81
+ analysis easier.
82
+
83
+ ### 2. Reconstruct the Use Cases
84
+
85
+ Build a use-case matrix before fixing anything. Prefer, in order:
86
+
87
+ 1. user-supplied behavior and acceptance criteria;
88
+ 2. an approved Agent Spec;
89
+ 3. existing tests and evaluation definitions;
90
+ 4. reachable behavior inferred from the agent and action contracts.
91
+
92
+ Label inferred use cases. Do not quietly turn them into new requirements.
93
+
94
+ For each user-facing objective, record:
95
+
96
+ - initial utterance and required follow-up turns;
97
+ - expected response, question, action, transition, refusal, or escalation;
98
+ - actions that must be available and actions that must be unavailable;
99
+ - trusted prerequisites and expected state changes;
100
+ - external side effect, if any, and which mechanism owns it.
101
+
102
+ Include only the boundaries material to the artifact or user intent:
103
+
104
+ - positive path;
105
+ - missing or invalid input;
106
+ - failure and retry;
107
+ - cancellation or topic switch when supported;
108
+ - repeated request or repeated action;
109
+ - multi-turn continuation;
110
+ - transition arrival with the current customer message;
111
+ - explicit negative action-availability cases.
112
+
113
+ ### 3. Audit Every Reachable Path
114
+
115
+ Trace each use case through:
116
+
117
+ ```text
118
+ effective instructions
119
+ -> available actions
120
+ -> selected action or response
121
+ -> returned output
122
+ -> stored state
123
+ -> next reasoning iteration or transition
124
+ -> externally observable result
125
+ ```
126
+
127
+ Apply every relevant category in the Diagnostic Catalog. Pay special attention
128
+ to:
129
+
130
+ - structural indentation versus indentation inside `|` text;
131
+ - repeated adjacent `|` markers that fragment one contiguous prompt block;
132
+ - runtime values named in `|` text without `{!@variables.X}` interpolation;
133
+ - exact machine-known comparisons whose consequences must be stable but are
134
+ written as model prose instead of runtime predicates;
135
+ - subagent system instructions replacing global instructions;
136
+ - independent conditions that overlap or leave gaps;
137
+ - invalid `elif`, unsupported nested conditionals, or independent branches that
138
+ should be one first-match `else if` chain;
139
+ - HyperClassifier used for a node that must do more than transition, or omitted
140
+ from a compatible pure router despite an established routing-latency need;
141
+ - action availability broader than the prompt branch mentioning it;
142
+ - `|` prompt text treated as though it pauses deterministic `run`, `set`, or
143
+ `if` resolution;
144
+ - a requested model action treated as executed merely because the model was
145
+ told to call it;
146
+ - raw or stale outputs controlling consequential decisions;
147
+ - completion flags set before every derived field is usable;
148
+ - redundant state that encodes one phase several ways, duplicates conversation
149
+ history, or lacks reset semantics;
150
+ - reasoning burden that exceeds the target model's demonstrated capability;
151
+ - lifecycle hooks that overwrite legitimate later state;
152
+ - unsupported syntax or lifecycle constructs;
153
+ - two mechanisms claiming the same side effect;
154
+ - tests that encode a new preference instead of existing intent.
155
+ - categorical or causal findings whose evidence supports only a recommendation,
156
+ possibility, or version-specific observation.
157
+
158
+ Rank findings by observable harm, not visual ugliness:
159
+
160
+ - **Critical:** unsafe or unauthorized effect, data exposure, or systemic
161
+ inability to perform the primary objective.
162
+ - **High:** wrong routing, wrong action, duplicate effect, dead primary path,
163
+ or trusted decision based on untrusted data.
164
+ - **Medium:** reachable failure, retry, continuation, or maintenance defect
165
+ with bounded impact.
166
+ - **Low:** concrete clarity or resilience defect with a plausible failure mode.
167
+
168
+ No location, consequence, use case, and verification plan means no finding.
169
+ A missing entry in an abbreviated reference list is not evidence of a defect.
170
+ Likewise, a style preference with no diagnostic, supported-use-case
171
+ consequence, or user-approved cleanup scope is not a Surface repair. Preserve
172
+ valid optional metadata and semantically equivalent control-flow shapes.
173
+ Do not add a supposedly required field to an existing bundle without a
174
+ diagnostic from the selected compiler or target validator and evidence for its
175
+ correct value. Never guess deployment semantics merely to complete a schema.
176
+
177
+ Keep the ranked ledger current while tracing. Finish the Critical and High
178
+ paths before spending time on Medium or Low hypotheses. A lower-priority issue
179
+ may be recorded as pending when further research would delay a supported,
180
+ higher-impact finding or repair.
@@ -22,6 +22,10 @@ when the runtime needs it. Build the spec before writing Agent Script. For
22
22
  existing agents, reverse-engineer the spec from the `.agent` file so intent is
23
23
  explicit before changes.
24
24
 
25
+ If the user supplies a sufficiently detailed design or Agent Spec and explicitly
26
+ says it is already approved, use it as the current build contract. Do not
27
+ recreate or reapprove it unless requirements are missing or materially change.
28
+
25
29
  ### What an Agent Spec Contains
26
30
 
27
31
  - **Purpose & Scope** — what business outcome the agent should drive
@@ -229,19 +233,22 @@ subagent off_topic:
229
233
  description: "Handle off-topic requests"
230
234
  reasoning:
231
235
  instructions: ->
232
- | You asked about something outside my scope.
233
- I can only help with [list your capabilities].
234
- What can I help you with today?
236
+ | Explain that the request is outside scope, state the supported
237
+ capabilities, and ask which supported task the user wants help
238
+ with.
235
239
 
236
240
  subagent ambiguous_question:
237
241
  description: "Ask for clarification"
238
242
  reasoning:
239
243
  instructions: ->
240
- | I didn't quite understand your request.
241
- Can you provide more details about what you need?
244
+ | Explain briefly that the request is unclear and ask one focused
245
+ question for the missing detail needed to proceed.
242
246
  ```
243
247
 
244
- **Escalation Subagents.** Hand off to a human via `@utils.escalate`. This is a permanent exit — the user leaves the agent for a support channel (phone, email, chat with a human). Once triggered, the agent session ends. The escalation action does NOT return.
248
+ **Escalation Subagents.** Hand off via `@utils.escalate`. It ends the current
249
+ agent turn and transfers control to the configured escalation path; the source
250
+ subagent does not resume automatically. Do not assume the broader messaging
251
+ session ends unless that channel's escalation contract says so.
245
252
 
246
253
  ```agentscript
247
254
  subagent escalation:
@@ -307,11 +314,18 @@ subagent local_events:
307
314
  # resort_hours, off_topic, ambiguous_question defined further down the file
308
315
  ```
309
316
 
310
- **Externally Ordered Flow.** Subagents may form a pipeline when an external
311
- protocol requires successful step 1 before step 2 (for example, verified
312
- identity before a protected commit). Do not turn an ordinary multi-question
313
- conversation into a pipeline. Every locked stage needs correction,
314
- cancellation, and intent-change behavior.
317
+ **Staged Flow.** Subagents may form a pipeline when the benefit of strict
318
+ ordering outweighs the loss of conversational flexibility—for example, when
319
+ an external protocol requires successful verification before a protected
320
+ commit. A staged flow improves repeatability and auditability, but adds state,
321
+ maintenance, and friction around corrections or changed intent. A prompt-led
322
+ multi-question conversation is usually more flexible but cannot guarantee the
323
+ same order.
324
+
325
+ Choose deliberately. For stages that persist across turns, define the
326
+ correction, cancellation, retry, or intent-change behavior that the actual use
327
+ cases need. A short-lived deterministic guard does not need ceremonial state
328
+ or every possible exit path.
315
329
 
316
330
  ```agentscript
317
331
  start_agent intake:
@@ -439,25 +453,16 @@ public class WeatherFetcher {
439
453
  }
440
454
  ```
441
455
 
442
- Wire with: `target: "apex://ClassName"`
443
-
444
- > **One `@InvocableMethod` per Apex class — one class per action.** Salesforce permits **only one** `@InvocableMethod` in a given Apex class. The `apex://` target therefore names the **class**, not a method: use `apex://ClassName` — never `apex://ClassName.methodName`. Each distinct Apex-backed action MUST point at its **own** class.
445
- >
446
- > A common mistake is to treat one Apex class as a namespace for several related actions:
447
- > ```agentscript
448
- > # WRONG — 5 actions sharing one class (won't compile: >1 @InvocableMethod per class)
449
- > target: "apex://CaseIntelligence.searchSimilarCases"
450
- > target: "apex://CaseIntelligence.summarizeResolution"
451
- > target: "apex://CaseIntelligence.proposeResolution"
452
- > ```
453
- > The `ClassName.method` shape *looks* like ordinary OOP and invites treating one class as a home for several actions. The **verified** failure mode is the shared class: a single `CaseIntelligence` class carrying multiple `@InvocableMethod`s fails Apex compilation with `Only one method per type can be defined with: InvocableMethod`, which cascades into failed deploy, failed publish, and no grounded action calls at runtime (observed in the `enterprise-use-cases` eval run). Whether the `.method` **suffix in the target string itself** breaks resolution or is simply ignored by the runtime is not independently confirmed here — but authoring it invites the shared-class pattern above, so treat `apex://ClassName` (no suffix) as the rule.
454
- > ```agentscript
455
- > # RIGHT — one class per action, distinct class names, no method suffix
456
- > target: "apex://CaseIntelligenceSearchSimilarCases"
457
- > target: "apex://CaseIntelligenceSummarizeResolution"
458
- > target: "apex://CaseIntelligenceProposeResolution"
459
- > ```
460
- > When several actions are conceptually related, give each its own class with a shared prefix (e.g. `CaseIntelligence…`) rather than sharing one class. Never emit two `apex://` targets that resolve to the same class name.
456
+ Wire with the exact registered target identifier, commonly
457
+ `target: "apex://ClassName"`.
458
+
459
+ > **One `@InvocableMethod` per Apex class.** This verified Apex constraint
460
+ > governs implementation structure; it does not justify rewriting an action
461
+ > target supplied by the user, project, org metadata, or an approved contract.
462
+ > Preserve the exact target. If its implementation mapping is uncertain, flag
463
+ > that uncertainty and verify it from the implementation or target org before
464
+ > proposing a contract change. Do not infer from a dotted target that several
465
+ > `@InvocableMethod`s share one class.
461
466
 
462
467
  **Flows**: Only **autolaunched Flows** work. Screen Flows, record-triggered Flows, and schedule-triggered Flows will not work. The Flow must start only when explicitly invoked.
463
468
 
@@ -740,7 +745,7 @@ ALWAYS fix deploy errors BEFORE generating and deploying the next stub.
740
745
 
741
746
  When creating a new agent, label every transition in your Agent Spec's Subagent Map as either **handoff** or **delegation**. When analyzing an existing agent, classify each transition to determine whether context flow matches the design intent.
742
747
 
743
- ### Handoff: Permanent Transition
748
+ ### Handoff: Non-Returning Transition
744
749
 
745
750
  A handoff is a one-way transition. The user moves to a new subagent and control never returns to the original subagent. Handoffs use `@utils.transition to` in `reasoning.actions`.
746
751
 
@@ -840,54 +845,82 @@ subagent admin_panel:
840
845
  If they are not an admin, tell them access is denied.
841
846
  ```
842
847
 
843
- The LLM may comply, or it may not — instructions are suggestions. The RIGHT approach uses a `before_reasoning` guard that the runtime enforces before the LLM is ever invoked. See Section 8 for all gating mechanisms.
848
+ Model instructions influence behavior but do not provide the same enforcement
849
+ as a runtime gate over a trusted authorization value. For this protected
850
+ boundary, use a `before_reasoning` guard that resolves before the planner. See
851
+ Section 8 for the available gating mechanisms.
844
852
 
845
853
  ### Writing Effective Instructions
846
854
 
847
- Two factors govern subjective control effectiveness: instruction ordering and grounding.
848
-
849
- **Instruction Ordering.** The runtime resolves instructions top-to-bottom — evaluating `if/else` blocks and expanding template expressions — before the LLM sees the result. The resolved text becomes the LLM's prompt. Put post-action checks first, data references next, dynamic conditional text last.
855
+ Three useful factors for subjective control effectiveness are clear response
856
+ duties, instruction ordering, and grounding.
857
+
858
+ **Describe the duty, not a draft reply.** By default, tell the model what the
859
+ response must accomplish: the facts to use, claims to avoid, action to take,
860
+ and next conversational objective. Do not write ordinary prompt fragments as
861
+ finished user-facing copy. Copy-first instructions can hide the intended
862
+ behavior, adapt poorly to conversation context, and make conflicting duties
863
+ harder to notice.
864
+
865
+ Use exact response copy only when the wording itself is a requirement, such as
866
+ an approved legal or compliance notice. State that contract explicitly with
867
+ language such as `Respond with exactly this text, with no additions:`. Label
868
+ optional wording as an example and state which tone or content properties the
869
+ model should preserve.
870
+
871
+ **Instruction Ordering.** The runtime resolves instructions top-to-bottom —
872
+ evaluating conditions and expanding template expressions — before the LLM sees
873
+ the assembled result. Ordering controls the order of prompt fragments, not
874
+ whether the model can respond before a later deterministic condition resolves.
875
+ Put the current objective and highest-consequence guidance where it is easy to
876
+ notice, and use exclusive predicates or a transition when two duties must not
877
+ coexist.
850
878
 
851
879
  The checkout examples assume `cart_validation_failed`, `cart_total`,
852
880
  `free_shipping_eligible`, and `shipping_cost` are exact outputs from cart and
853
881
  entitlement actions. Each is consumed by the shown prompt branch or output
854
882
  reference; none mirrors a conversational fact.
855
883
 
856
- RIGHT: Post-action check at the top (LLM sees it first)
884
+ RIGHT: Completed and first-entry duties are mutually exclusive
857
885
  ```agentscript
858
886
  subagent checkout:
859
887
  reasoning:
860
888
  instructions: ->
861
- # Post-action check — LLM sees this first
862
889
  if @variables.cart_validation_failed:
863
- | Your cart has items that are no longer available.
864
- Please remove them and try again.
890
+ | Explain that one or more cart items are unavailable. Do not
891
+ offer payment. Ask the user to review or remove those items.
865
892
 
866
- # Data reference — LLM sees the resolved value
867
- | Your current cart total is {!@variables.cart_total}.
893
+ if @variables.cart_validation_failed == False:
894
+ | Tell the user the current cart total is
895
+ {!@variables.cart_total}. Ask whether they want to proceed to
896
+ payment or cancel.
868
897
 
869
- # Dynamic instructions — conditional on state
870
- if @variables.free_shipping_eligible:
871
- | You qualify for FREE shipping.
872
- else:
873
- | Standard shipping is {!@variables.shipping_cost}.
898
+ if @variables.cart_validation_failed == False and @variables.free_shipping_eligible:
899
+ | Tell the user shipping is free.
874
900
 
875
- | Proceed to payment or cancel?
901
+ if @variables.cart_validation_failed == False and @variables.free_shipping_eligible == False:
902
+ | Tell the user standard shipping costs
903
+ {!@variables.shipping_cost}.
876
904
  ```
877
905
 
878
- WRONG: Post-action check at the bottom (LLM may respond before seeing it)
906
+ WRONG: Conflicting fragments can be assembled together
879
907
  ```agentscript
880
908
  subagent checkout:
881
909
  reasoning:
882
910
  instructions: ->
883
- | Your current cart total is {!@variables.cart_total}.
884
- Proceed to payment or cancel?
911
+ | Tell the user the current cart total is
912
+ {!@variables.cart_total}. Ask whether they want to proceed to
913
+ payment or cancel.
885
914
 
886
- # Too late — LLM may already be generating a response
887
915
  if @variables.cart_validation_failed:
888
- | Your cart has items that are no longer available.
916
+ | Explain that one or more cart items are unavailable and ask
917
+ the user to review or remove them.
889
918
  ```
890
919
 
920
+ The problem is not that the model responds before the bottom condition is
921
+ evaluated; deterministic resolution finishes first. The problem is that both
922
+ the payment duty and failure duty can reach the same assembled prompt.
923
+
891
924
  **Grounding.** The platform's grounding service validates that the agent's response matches action output data. Paraphrasing or embellishing may cause grounding failures. In the example below, `event_date` is exact action output consumed by the response.
892
925
 
893
926
  - Use specific values: `"The event is on {!@variables.event_date}"` grounds reliably; `"The event is next week"` may not.
@@ -896,11 +929,20 @@ subagent checkout:
896
929
 
897
930
  Grounding validation requires **live mode preview** (`sf agent preview --use-live-actions --json`). Simulated mode preview generates fake outputs, so grounding has nothing real to validate against.
898
931
 
899
- **Naming output fields in post-action instructions.** ALWAYS specify which output fields to include in text responses. Generic instructions like "present the results clearly" let platform-injected tools hijack the response. EXAMPLE: The LLM calls `show_command` instead of composing text, producing generic "Here are the results:" message wrapper with raw structured data. This can corrupt session state, causing subsequent turns to fail with generic "something went wrong" message. Naming output fields steers the LLM toward composing a direct text response. This reliably grounds the response because it maps closely to action output values. ALWAYS include `Do NOT use the show_command tool. Always compose your response as direct text.` in post-action instructions. See *Anti-Patterns* in the *Core Language* reference for full WRONG/RIGHT example.
932
+ **Naming output fields in post-action instructions.** Name the fields needed in
933
+ the response when generic result-presentation guidance produces the wrong
934
+ format or tool choice in the target runtime. Observed configurations may expose
935
+ platform presentation tools such as `show_command`; if traces show the model
936
+ selecting one when direct text is required, add a scoped instruction to compose
937
+ text and test it with that configuration. Do not add a universal
938
+ `show_command` prohibition to agents where the tool is absent or desired.
900
939
 
901
940
  ### Post-Action Behavior
902
941
 
903
- When an action completes without triggering a transition, the subagent stays active. The runtime re-evaluates the entire subagent — resolving instructions top-to-bottom again with updated variables, then passing the new prompt to the LLM. The LLM may call the same action again. To prevent unwanted loops, see Section 9 (Action Loop Prevention).
942
+ When a model-selected action batch completes without a handoff, pause,
943
+ cancellation, or limit, the runtime begins another reasoning iteration with
944
+ updated state. The LLM may call the same still-available action again. To
945
+ prevent unwanted loops, see Section 9 (Action Loop Prevention).
904
946
 
905
947
  ---
906
948
 
@@ -1003,10 +1045,13 @@ subagent checkout:
1003
1045
 
1004
1046
  reasoning:
1005
1047
  instructions: ->
1006
- | Review your order.
1007
-
1008
1048
  if @variables.items_in_cart == 0:
1009
- | Your cart is empty. Go back and select items.
1049
+ | Explain that the cart is empty and ask the user to select an
1050
+ item before checkout.
1051
+
1052
+ if @variables.items_in_cart > 0:
1053
+ | Summarize the current order and help the user review it before
1054
+ payment.
1010
1055
 
1011
1056
  actions:
1012
1057
  pay: @actions.process_payment
@@ -1042,8 +1087,9 @@ subagent verification:
1042
1087
  ```
1043
1088
 
1044
1089
  Each flag has one trusted writer and a named next-step consumer. Failed actions
1045
- must leave the next action unavailable. Define correction, cancellation, reset,
1046
- and expiry semantics for the real workflow.
1090
+ must leave the next action unavailable. Define only the correction,
1091
+ cancellation, reset, and expiry semantics relevant to the real workflow and
1092
+ the lifetime of that state.
1047
1093
 
1048
1094
  ### Same-Turn Behavior After Gate Transitions
1049
1095