sf-ai-agentscript▌
jaganpro/sf-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
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.
SF-AI-AgentScript Skill
Agent Script is the code-first path for deterministic Agentforce agents. Use this skill when the user is authoring .agent files, building finite-state topic flows, or needs repeatable control over routing, variables, actions, and publish behavior.
Start with the shortest guide first: references/activation-checklist.md
Migrating from the Builder UI? Use references/migration-guide.md
When This Skill Owns the Task
Use sf-ai-agentscript when the work involves:
- creating or editing
.agentfiles - deterministic topic routing, guards, and transitions
- Agent Script CLI workflows (
sf agent generate authoring-bundle,sf agent validate authoring-bundle,sf agent preview,sf agent publish authoring-bundle,sf agent activate) - slot filling, instruction resolution, post-action loops, or FSM design
Delegate elsewhere when the user is:
- maintaining Builder metadata agents (
GenAiFunction,GenAiPlugin,GenAiPromptTemplate, Models API, custom Lightning types) → sf-ai-agentforce - designing persona / tone / voice → sf-ai-agentforce-persona
- building formal test plans or coverage loops → sf-ai-agentforce-testing
If the user is in Builder Script / Canvas view but the outcome is a .agent authoring bundle, keep the work in sf-ai-agentscript.
Required Context to Gather First
Ask for or infer:
- agent purpose and whether Agent Script is truly the right fit
- Service Agent vs Employee Agent
- target org and publish intent
- expected actions / targets (Flow, Apex, PromptTemplate, etc.)
- whether the request is authoring, validation, preview, or publish troubleshooting
Activation Checklist
Before you author or fix any .agent file, verify these first:
- Exactly one
start_agentblock - No mixed tabs and spaces
- Booleans are
True/False - No
else ifand no nestedif - No top-level
actions:block - No
@inputsinsetexpressions linkedvariables have no defaultslinkedvariables do not useobject/listtypes- Use explicit
agent_type - Use
@actions.prefixes consistently - Use
run @actions.Xonly whenXis a topic-level action definition withtarget: - Do not branch directly on raw
@system_variables.user_input contains/startswith/endswithfor intent routing - On prompt-template outputs, prefer
is_displayable: False+is_used_by_planner: True - Do not assume
@outputs.Xis scalar — inspect the output schema before branching or assignment
For the expanded version, use references/activation-checklist.md.
Non-Negotiable Rules
1) Service Agent vs Employee Agent
| Agent type | Required | Forbidden / caution |
|---|---|---|
AgentforceServiceAgent |
Valid default_agent_user, correct permissions, target-org checks, prefer sf org create agent-user |
Publishing without a real Einstein Agent User |
AgentforceEmployeeAgent |
Explicit agent_type |
Supplying default_agent_user |
Full details: references/agent-user-setup.md
2) Recommended top-level block convention
Use this order for consistency in this skill's examples and reviews:
config:
variables:
system:
connection:
knowledge:
language:
start_agent:
topic:
Official Salesforce materials present top-level blocks in differing sequences, and local validation evidence indicates multiple orderings compile. Treat this as a style convention, not a standalone correctness or publish blocker.
3) Critical config fields
| Field | Rule |
|---|---|
developer_name |
Must match folder / bundle name |
description |
Public docs/examples should use this config field |
agent_type |
Set explicitly every time |
default_agent_user |
Service Agents only |
Local tooling also accepts agent_description: for compatibility, but this skill's public docs and examples should prefer description:.
4) Syntax blockers you should treat as immediate failures
else if- nested
if - comment-only
ifbodies - top-level
actions: - invocation-level
inputs:/outputs:blocks - reserved variable / field names like
descriptionandlabel
Canonical rule set: references/syntax-reference.md and references/validator-rule-catalog.md
Recommended Workflow
Recommended Authoring Workflow
Phase 1 — design the agent
- decide whether the problem is actually deterministic enough for Agent Script
- model topics as states and transitions as edges
- define only the variables you truly need
Phase 2 — author the .agent
- create
config,system,start_agent, and topics first - add target-backed actions with full
inputs:andoutputs: - use
available whenfor deterministic tool visibility - normalize raw intent/validation signals into booleans or enums before branching; avoid direct substring checks on raw user utterances for critical control flow
- keep post-action checks at the top of
instructions: ->
Default authoring stance
- Default to direct
.agentauthoring and edits in source control. - Use
sf agent generate authoring-bundle --no-speconly when the user wants local bundle scaffolding. - Treat
sf agent generate agent-specas optional ideation / topic bootstrap, not the default workflow. - Do not route Agent Script users toward
sf agent createorsf agent generate template.
Phase 3 — validate continuously
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.
Phase 4 — preview smoke test
Use the preview loop before publish:
- derive 3–5 smoke utterances
- start preview
- inspect topic routing / action invocation / safety / grounding
- fix and rerun up to 3 times
Full loop: references/preview-test-loop.md
Phase 5 — publish and activate
sf agent publish authoring-bundle --api-name MyAgent -o TARGET_ORG --json
# Manual activation
sf agent activate --api-name MyAgent -o TARGET_ORG
# CI / deterministic activation of a known BotVersion
sf agent activate --api-name MyAgent --version <n> -o TARGET_ORG --json
Publishing does not activate the agent.
For automation, prefer --version <n> --json so activation is deterministic and machine-readable.
Deterministic Building Blocks
These execute as code, not suggestions:
- conditionals
available whenguards- variable checks
- direct
set/transition to run @actions.Xonly whenXis a topic-level action definition withtarget:- variable injection into LLM-facing text
Important distinction:
- Deterministic:
set,transition to, andrun @actions.Xfor a target-backed topic action - LLM-directed:
reasoning.actions:utilities / delegations such as@utils.setVariables,@utils.transition, and{[email protected]}instruction references
If you need deterministic behavior for something that is currently modeled as a reasoning-level utility, either:
- rewrite it as direct
set/transition to, or - promote it to a topic-level target-backed action and
runthat action
See references/instruction-resolution.md and references/architecture-patterns.md.
Cross-Skill Integration
Cross-Skill Orchestration
| 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 |
High-Signal Failure Patterns
| Symptom | Likely cause | Read next |
|---|---|---|
Internal Error during publish |
invalid Service Agent user or missing action I/O | references/agent-user-setup.md, references/actions-reference.md |
invalid input/output parameters on prompt template action |
Target template is in Draft status — activate it first | references/action-prompt-templates.md |
| Parser rejects conditionals | else if, nested if, empty if body |
references/syntax-reference.md |
| Action target issues | missing Flow / Apex target, inactive Flow, bad schemas | references/actions-reference.md |
| Prompt template runs but user sees blank response | prompt output marked is_displayable: True |
references/production-gotchas.md, references/action-prompt-templates.md |
| Prompt action runs but planner behaves like output is missing | output hidden from direct display but not planner-visible | references/production-gotchas.md, references/actions-reference.md |
ACTION_NOT_IN_SCOPE on run @actions.X |
run points at a utility / delegation / unresolved action instead of a topic-level target-backed definition |
references/syntax-reference.md, references/instruction-resolution.md |
| Deterministic cancel / revise / URL checks behave inconsistently | raw @system_variables.user_input matching or string-method guards are being used as control-flow-critical validation |
references/syntax-reference.md, references/production-gotchas.md |
@outputs.X comparisons or assignments behave unexpectedly |
the action output is structured/wrapped, not a plain scalar | references/actions-reference.md, references/syntax-reference.md |
| Preview and runtime disagree | linked vars / context / known platform issues | references/known-issues.md |
| Validate passes but publish fails | org-specific user / permission / retrieve-back issue | references/production-gotchas.md, references/cli-guide.md |
Reference Map
Start here
Publish / runtime safety
- references/agent-user-setup.md
- references/production-gotchas.md
- references/customer-web-client.md
- references/known-issues.md
Architecture / reasoning
- references/architecture-patterns.md
- references/instruction-resolution.md
- references/fsm-architecture.md
- references/patterns-quick-ref.md
Validation / testing / debugging
- references/preview-test-loop.md
- references/testing-guide.md
- references/debugging-guide.md
- references/validator-rule-catalog.md
Examples / scaffolds
How to use sf-ai-agentscript on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add sf-ai-agentscript
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches sf-ai-agentscript from GitHub repository jaganpro/sf-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate sf-ai-agentscript. Access the skill through slash commands (e.g., /sf-ai-agentscript) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★38 reviews- ★★★★★Kofi Lopez· Dec 16, 2024
Keeps context tight: sf-ai-agentscript is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Shikha Mishra· Dec 12, 2024
Solid pick for teams standardizing on skills: sf-ai-agentscript is focused, and the summary matches what you get after install.
- ★★★★★Ganesh Mohane· Dec 8, 2024
Keeps context tight: sf-ai-agentscript is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Tariq Liu· Dec 8, 2024
We added sf-ai-agentscript from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Dev Kapoor· Nov 27, 2024
Solid pick for teams standardizing on skills: sf-ai-agentscript is focused, and the summary matches what you get after install.
- ★★★★★Yash Thakker· Nov 3, 2024
We added sf-ai-agentscript from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Dhruvi Jain· Oct 22, 2024
sf-ai-agentscript fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Dev Haddad· Oct 18, 2024
sf-ai-agentscript has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arya Sanchez· Sep 21, 2024
sf-ai-agentscript reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Emma Lopez· Sep 13, 2024
Registry listing for sf-ai-agentscript matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 38