sf-ai-agentscript
Agent Script DSL development skill for Salesforce Agentforce. Enables writing deterministic agents in a single .agent file with FSM architecture, instruction resolution, and hybrid reasoning. Covers syntax, debugging, testing, and CLI deployment.
SKILL.md
| Name | sf-ai-agentscript |
| Description | Agent Script DSL development skill for Salesforce Agentforce. Enables writing deterministic agents in a single .agent file with FSM architecture, instruction resolution, and hybrid reasoning. Covers syntax, debugging, testing, and CLI deployment. |
Salesforce Skills for Agentic Coding Tools
๐ Community-powered agentic coding knowledge, shared by a Salesforce Certified Technical Architect (CTA)
A collection of reusable skills for Agentic Salesforce Development, enabling AI-powered code generation, validation, testing, debugging, and deployment. Compatible with any AI coding agent via the Agent Skills open standard.
โจ Available Skills
๐ป Development
- sf-apex โ Apex generation, TAF patterns, LSP validation
- sf-flow โ Flow creation & bulk validation
- sf-lwc โ Lightning Web Components, Jest tests, LMS
- sf-soql โ Natural language โ SOQL, query optimization
๐งช Quality
- sf-testing โ Apex test runner, coverage, bulk testing
- sf-debug โ Debug log analysis, governor limit fixes
๐ฆ Foundation
- sf-metadata โ Metadata gen & org queries
- sf-data โ SOQL & test data factories
- sf-permissions โ Permission Set analysis, "Who has X?"
๐ Integration
- sf-connected-apps โ OAuth apps & ECAs
- sf-integration โ Callouts, Events, CDC
๐ค AI & Automation
- sf-ai-agentscript โ Agent Script DSL, FSM patterns
- sf-ai-agentforce-persona โ Deep persona design, identity framework, Agent Builder encoding
- sf-ai-agentforce-observability โ Session tracing (Data Cloud)
- sf-ai-agentforce-testing โ Agent test specs, agentic fix loops
- sf-ai-agentforce โ Agent Builder, PromptTemplate, Models API
๐ ๏ธ DevOps & Tooling
- sf-deploy โ CI/CD automation (sf CLI v2)
- sf-diagram-mermaid โ Mermaid diagrams & ERD
- sf-diagram-nanobananapro โ Visual ERD, LWC mockups
๐ค Agent Team
Seven specialized Claude Code agents for Salesforce implementations, installed to ~/.claude/agents/.
FDE Team (Agent-Focused)
| Agent | Role | Mode | Key Skills |
|---|---|---|---|
| fde-strategist | Orchestrator โ plans, researches, delegates | plan | sf-ai-agentforce, sf-diagram-mermaid |
| fde-engineer | Agent config, metadata, Apex, Agent Scripts | acceptEdits | sf-ai-agentforce, sf-ai-agentscript |
| fde-experience-specialist | Conversation design, persona, UX, LWC | acceptEdits | sf-ai-agentforce-persona, sf-lwc |
Cross-Cutting (Serve Both Teams)
| Agent | Role | Mode | Key Skills |
|---|---|---|---|
| fde-qa-engineer | Testing (agent + platform), debug, observability | acceptEdits | sf-testing, sf-ai-agentforce-testing |
| fde-release-engineer | Deployment, Connected Apps, CI/CD | acceptEdits | sf-deploy, sf-connected-apps |
PS Team (Platform Infrastructure)
| Agent | Role | Mode | Key Skills |
|---|---|---|---|
| ps-technical-architect | Apex, integrations, data, LWC, performance | acceptEdits | sf-apex, sf-integration, sf-lwc + 5 more |
| ps-solution-architect | Metadata, Flows, permissions, diagrams | acceptEdits | sf-metadata, sf-flow, sf-permissions + 2 more |
Hierarchy
fde-strategist (orchestrator โ plans, researches, delegates)
โโโ FDE: fde-engineer, fde-experience-specialist
โโโ QA/Release: fde-qa-engineer, fde-release-engineer
โโโ PS: ps-technical-architect, ps-solution-architect
The strategist spawns up to 4 concurrent workers via Task(). PS agents have WebSearch and WebFetch for self-directed Salesforce docs lookup.
๐ Installation
Any AI Coding Agent
Requires Node.js 18+ (provides the
npxcommand)
npx skills add Jaganpro/sf-skills
Works with Claude Code, Codex, Gemini CLI, OpenCode, Amp, and 40+ agents.
# Install a single skill
npx skills add Jaganpro/sf-skills --skill sf-apex
# List available skills before installing
npx skills add Jaganpro/sf-skills --list
Claude Code (Full Experience)
Using Claude Code? This path is recommended โ npx installs skills only, while install.py adds hooks, agents, LSP, and guardrails.
curl -sSL https://raw.githubusercontent.com/Jaganpro/sf-skills/main/tools/install.sh | bash
Adds 19 skills + 7 agents + 11 hook scripts + LSP engine. Includes guardrails, auto-validation on Write/Edit, and org preflight checks.
Restart Claude Code after installation.
Updating
| Install Method | Check for Updates | Update |
|---|---|---|
| npx | npx skills check | npx skills update |
| install.py | python3 ~/.claude/sf-skills-install.py --status | python3 ~/.claude/sf-skills-install.py --update |
Managing install.py
python3 ~/.claude/sf-skills-install.py --status # Check version
python3 ~/.claude/sf-skills-install.py --update # Update to latest
python3 ~/.claude/sf-skills-install.py --uninstall # Remove everything
python3 ~/.claude/sf-skills-install.py --cleanup # Clean legacy artifacts
python3 ~/.claude/sf-skills-install.py --dry-run # Preview without applying
Upgrading from npx to install.py? Just run the curl command above โ it auto-detects and migrates.
What Gets Installed (install.py only)
~/.claude/
โโโ skills/ # 19 Salesforce skills
โ โโโ sf-apex/SKILL.md
โ โโโ sf-flow/SKILL.md
โ โโโ ... (17 more)
โโโ agents/ # 7 FDE + PS agents
โ โโโ fde-strategist.md
โ โโโ fde-engineer.md
โ โโโ ... (5 more)
โโโ hooks/ # 11 hook scripts
โ โโโ scripts/
โ โโโ skills-registry.json
โโโ lsp-engine/ # LSP wrappers (Apex, LWC, AgentScript)
โโโ .sf-skills.json # Version + metadata
โโโ sf-skills-install.py # Installer for updates
What hooks provide:
| Hook | Function |
|---|---|
| SessionStart | Initializes session, preflights org connection, warms LSP servers |
| PreToolUse | Guardrails โ blocks dangerous DML, auto-fixes unbounded SOQL |
| PostToolUse | Validates Apex/Flow/LWC on save |
| PermissionRequest | Auto-approves safe operations (read queries, scratch deploys) |
๐ฌ Video Tutorials
| Video | Description |
|---|---|
| How to Add/Install Skills | Install the sf-skills marketplace and add skills to Claude Code |
| Skills Demo & Walkthrough | Live demo of Apex, Flow, Metadata, and Agentforce skills in action |
๐ Skill Architecture
Use the sf-deploy skill for all Salesforce deployments:
Use the sf-deploy skill: "Deploy to [org]"
</details>
๐ Plugin Features
๐ก Auto-Activation
Skills are available as slash commands (e.g., /sf-apex, /sf-flow). Claude dynamically selects the appropriate skill based on your request context โ keywords, intent, and file patterns in shared/hooks/skills-registry.json serve as documentation for skill capabilities.
Automatic Validation Hooks
Each skill includes validation hooks that run automatically on Write and Edit operations:
| Skill | File Type | Validation | |
|---|---|---|---|
| โก | sf-apex | *.cls, *.trigger | 150-pt scoring + Code Analyzer + LSP |
| ๐ | sf-flow | *.flow-meta.xml | 110-pt scoring + Flow Scanner |
| โก | sf-lwc | *.js (LWC) | 140-pt scoring + LSP syntax validation |
| โก | sf-lwc | *.html (LWC) | Template validation (directives, expressions) |
| ๐ | sf-soql | *.soql | 100-pt scoring + Live Query Plan API |
| ๐งช | sf-testing | *Test.cls | 100-pt scoring + coverage analysis |
| ๐ | sf-debug | Debug logs | 90-pt scoring + governor analysis |
| ๐ | sf-metadata | *.object-meta.xml, *.field-meta.xml, *.permissionset-meta.xml | Metadata best practices |
| ๐พ | sf-data | *.apex, *.soql | SOQL patterns + Live Query Plan |
| ๐ค | sf-ai-agentscript | *.agent | Agent Script syntax + LSP auto-fix |
| ๐งช | sf-ai-agentforce-testing | Test spec YAML | 100-pt scoring + fix loops |
| ๐ | sf-connected-apps | *.connectedApp-meta.xml | OAuth security validation |
| ๐ | sf-integration | *.namedCredential-meta.xml | 120-pt scoring + callout patterns |
| ๐ธ | sf-diagram-nanobananapro | Generated images | Prerequisites check |
All PostToolUse validations are routed through a central dispatcher (shared/hooks/scripts/validator-dispatcher.py) that receives file paths from Write/Edit hook context, matches file patterns to determine which validators to run, and returns combined validation output.
Routing Table:
| Pattern | Skill | Validators |
|---|---|---|
*.agent | sf-ai-agentscript | agentscript-syntax-validator.py |
*.cls, *.trigger | sf-apex | apex-lsp-validate.py + post-tool-validate.py |
*.flow-meta.xml | sf-flow | post-tool-validate.py |
/lwc/**/*.js | sf-lwc | lwc-lsp-validate.py + post-tool-validate.py |
/lwc/**/*.html | sf-lwc | template_validator.py |
*.object-meta.xml | sf-metadata | validate_metadata.py |
*.field-meta.xml | sf-metadata | validate_metadata.py |
*.permissionset-meta.xml | sf-metadata | validate_metadata.py |
*.namedCredential-meta.xml | sf-integration | validate_integration.py |
*.soql | sf-soql | post-tool-validate.py |
SKILL.md | (removed) | โ |
Hooks integrate Salesforce Code Analyzer V5 for OOTB linting alongside custom scoring:
| Engine | What It Checks | Dependency |
|---|---|---|
| PMD | 55 Apex rules (85% coverage) โ security, bulkification, complexity, testing | Java 11+ |
| SFGE | Data flow analysis, path-based security | Java 11+ |
| Regex | Trailing whitespace, hardcoded patterns | None |
| ESLint | JavaScript/LWC linting | Node.js |
| Flow Scanner | Flow best practices | Python 3.10+ |
Custom Validation Coverage:
| Validator | Total Checks | Categories |
|---|---|---|
| Apex (150-pt) | PMD 55 rules + Python 8 checks | Security (100%), Bulkification, Testing, Architecture, Clean Code, Error Handling, Performance, Documentation |
| Flow (110-pt) | 32+ checks (21/24 LFS rules) | Design/Naming, Logic/Structure, Error Handling, Architecture, Security, Performance |
| LWC (140-pt) | ESLint + retire-js + SLDS Linter | SLDS 2 Compliance, Naming, Accessibility, Component Patterns, Lightning Message Service, Security |
Graceful Degradation: If dependencies are missing, hooks run custom validation only and show which engines were skipped.
</details> <details> <summary><b>Live SOQL Query Plan Analysis</b></summary>Skills integrate with Salesforce's REST API explain endpoint to provide real-time query plan analysis.
Sample Output:
๐ Live Query Plan Analysis (Org: my-dev-org)
L42: โ
Cost 0.3 (Index)
L78: โ ๏ธ Cost 2.1 (TableScan) โ ๏ธ IN LOOP
๐ Field Status__c is not indexed
| Metric | Description | Threshold |
|---|---|---|
| relativeCost | Query selectivity score | โค1.0 = selective โ , >1.0 = non-selective โ ๏ธ |
| leadingOperationType | How Salesforce executes the query | Index, TableScan, Sharing |
| cardinality | Estimated rows returned | vs. total records in object |
| notes[] | WHY optimizations aren't being used | Index suggestions, filter issues |
Skills with Live Query Plan: sf-soql (.soql files), sf-apex (.cls, .trigger โ inline SOQL), sf-data (.soql for data operations).
Prerequisites: Connected Salesforce org (sf org login web). Falls back to static analysis if no org connected.
๐ค Language Server Protocol (LSP) Integration
Skills leverage official Salesforce LSP servers for real-time syntax validation with auto-fix loops:
| Skill | File Type | LSP Server | Runtime | |
|---|---|---|---|---|
| ๐ค | sf-ai-agentscript | *.agent | Agent Script Language Server | Node.js 18+ |
| โก | sf-apex | *.cls, *.trigger | apex-jorje-lsp.jar | Java 11+ |
| โก | sf-lwc | *.js, *.html | @salesforce/lwc-language-server | Node.js 18+ |
How Auto-Fix Loops Work:
- Claude writes/edits a file
- LSP hook validates syntax (~500ms)
- If errors found โ Claude receives diagnostics and auto-fixes
- Repeat up to 3 attempts
Prerequisites: See LSP table in Prerequisites section. LWC uses standalone npm package; Apex and Agent Script require VS Code extensions.
Hooks provide advisory feedback โ they inform but don't block operations.
๐ง Prerequisites
Required:
- Claude Code (latest version)
- Salesforce CLI v2.x (
sfcommand) โnpm install -g @salesforce/cli - Python 3.10+ (for validation hooks)
- Authenticated Salesforce Org โ DevHub, Sandbox, or Scratch Org
- sfdx-project.json โ Standard DX project structure
API Version Requirements:
| Skills | Minimum API | Notes |
|---|---|---|
| Most skills | 62.0 (Winter '25) | sf-apex, sf-flow, sf-lwc, sf-metadata |
| sf-connected-apps, sf-integration | 61.0 | External Client Apps |
| sf-ai-agentforce | 66.0 (Spring '26) | Full agent deployment, GenAiPlannerBundle |
Optional (enables additional features):
Code Analyzer V5 engines:
- Java 11+ โ Enables PMD, CPD, SFGE engines (
brew install openjdk@11) - Node.js 18+ โ Enables ESLint, RetireJS for LWC (
brew install node) - Code Analyzer plugin โ
sf plugins install @salesforce/sfdx-code-analyzer
LWC Testing & Linting:
- @salesforce/sfdx-lwc-jest โ Jest testing for LWC (
npm install @salesforce/sfdx-lwc-jest --save-dev) - @salesforce-ux/slds-linter โ SLDS validation (
npm install -g @salesforce-ux/slds-linter)
LSP real-time validation (auto-fix loops):
- LWC Language Server โ
npm install -g @salesforce/lwc-language-server(standalone, no VS Code needed) - VS Code with Salesforce Extensions โ Required for Apex and Agent Script only (no npm packages available)
- Apex: Install "Salesforce Extension Pack" (Java JAR bundled in extension)
- Agent Script: Install "Salesforce Agent Script" extension (server.js bundled in extension)
- Java 11+ โ Required for Apex LSP (same as Code Analyzer)
- Node.js 18+ โ Required for Agent Script and LWC LSP
| LSP | Standalone npm? | VS Code Required? |
|---|---|---|
| LWC | โ
@salesforce/lwc-language-server | โ No |
| Apex | โ No (Java JAR) | โ Yes |
| Agent Script | โ No | โ Yes |
Apex Development:
- Trigger Actions Framework (TAF) โ Optional package for sf-apex trigger patterns
- Package ID:
04tKZ000000gUEFYA2or GitHub repo
- Package ID:
โก Apex Development
"Generate an Apex trigger for Account using Trigger Actions Framework"
"Review my AccountService class for best practices"
"Create a batch job to process millions of records"
"Generate a test class with 90%+ coverage"
๐ Flow Development
"Create a screen flow for account creation with validation"
"Build a record-triggered flow for opportunity stage changes"
"Generate a scheduled flow for data cleanup"
๐ Metadata Management
"Create a custom object called Invoice with auto-number name field"
"Add a lookup field from Contact to Account"
"Generate a permission set for invoice managers with full CRUD"
"Create a validation rule to require close date when status is Closed"
"Describe the Account object in my org and list all custom fields"
๐พ Data Operations
"Query all Accounts with related Contacts and Opportunities"
"Create 251 test Account records for trigger bulk testing"
"Insert 500 records from accounts.csv using Bulk API"
"Generate test data hierarchy: 10 Accounts with 3 Contacts each"
"Clean up all test records created today"
โก LWC Development
"Create a datatable component to display Accounts with sorting"
"Build a form component for creating new Contacts"
"Generate a Jest test for my accountCard component"
"Create an Apex controller with @AuraEnabled methods for my LWC"
"Set up Lightning Message Service for cross-component communication"
๐ SOQL Queries
"Query all Accounts with more than 5 Contacts"
"Get Opportunities by Stage with total Amount per Stage"
"Find Contacts without Email addresses"
"Optimize this query: SELECT * FROM Account WHERE Name LIKE '%Corp%'"
"Generate a SOQL query to find duplicate Leads by Email"
๐งช Testing
"Run all Apex tests in my org and show coverage"
"Generate a test class for my AccountTriggerHandler"
"Create a bulk test with 251 records for trigger testing"
"Generate mock classes for HTTP callouts"
"Run tests for a specific class and show failures"
๐ Debugging
"Analyze this debug log for performance issues"
"Find governor limit violations in my log"
"What's causing this SOQL in loop error?"
"Show me how to fix this null pointer exception"
"Optimize my Apex for CPU time limits"
๐ Connected Apps & OAuth
"Create a Connected App for API integration with JWT Bearer flow"
"Generate an External Client App for our mobile application with PKCE"
"Review my Connected Apps for security best practices"
"Migrate MyConnectedApp to an External Client App"
๐ Integration & Callouts
"Create a Named Credential for Stripe API with OAuth client credentials"
"Generate a REST callout service with retry and error handling"
"Create a Platform Event for order synchronization"
"Build a CDC subscriber trigger for Account changes"
"Set up an External Service from an OpenAPI spec"
๐ค Agentforce Agents & Actions
"Create an Agentforce agent for customer support triage"
"Build a FAQ agent with topic-based routing"
"Generate an agent that calls my Apex service via Flow wrapper"
"Create a GenAiFunction for my @InvocableMethod Apex class"
"Build an agent action that calls the Stripe API"
"Generate a PromptTemplate for case summaries"
๐ Diagrams & Documentation
"Create a JWT Bearer OAuth flow diagram"
"Generate an ERD for Account, Contact, Opportunity, and Case"
"Diagram our Salesforce to SAP integration flow"
"Create a system landscape diagram for our Sales Cloud implementation"
"Generate a role hierarchy diagram for our sales org"
๐ Deployment
"Deploy my Apex classes to sandbox with tests"
"Validate my metadata changes before deploying to production"
๐ ๏ธ Skill Creation
"Create a new Claude Code skill for code analysis"
</details>
<details>
<summary><h2>๐บ๏ธ Roadmap</h2></summary>
Naming Convention
sf-{capability} # Cross-cutting (apex, flow, admin)
sf-ai-{name} # AI features (agentforce, copilot)
sf-product-{name} # Products (datacloud, omnistudio)
sf-cloud-{name} # Clouds (sales, service)
sf-industry-{name} # Industries (healthcare, finserv)
๐ง Cross-Cutting Skills
| Skill | Description | Status | |
|---|---|---|---|
| ๐ | sf-connected-apps | Connected Apps, ECAs, OAuth configuration | โ Live |
| ๐ | sf-integration | Named Credentials, External Services, REST/SOAP, Platform Events, CDC | โ Live |
| ๐ | sf-diagram-mermaid | Mermaid diagrams for OAuth, ERD, integrations, architecture | โ Live |
| โก | sf-lwc | Lightning Web Components, Jest, LMS | โ Live |
| ๐ | sf-soql | Natural language to SOQL, optimization | โ Live |
| ๐งช | sf-testing | Test execution, coverage, bulk testing | โ Live |
| ๐ | sf-debug | Debug log analysis, governor fixes | โ Live |
| ๐ธ | sf-diagram-nanobananapro | Visual ERD, LWC mockups, Gemini sub-agent | โ Live |
| ๐ | sf-permissions | Permission Set analysis, hierarchy viewer, "Who has X?" | โ Live |
| ๐ | sf-security | Sharing rules, org-wide defaults, encryption | ๐ Planned |
| ๐ฆ | sf-migration | Org-to-org, metadata comparison | ๐ Planned |
๐ค AI & Automation
| Skill | Description | Status | |
|---|---|---|---|
| ๐ค | sf-ai-agentforce | Agent Builder, PromptTemplate, Models API, GenAi metadata | โ Live |
| ๐งช | sf-ai-agentforce-testing | Agent test specs, agentic fix loops | โ Live |
| ๐ | sf-ai-agentforce-observability | Session tracing extraction & analysis (Data Cloud) | โ Live |
| ๐ | sf-ai-agentscript | Agent Script DSL, FSM patterns, 100-pt scoring | โ Live |
| ๐ฌ | sf-ai-agentforce-persona | Deep persona design, identity framework, Agent Builder encoding | โ Live |
| ๐ง | sf-ai-copilot | Einstein Copilot, Prompts | ๐ Planned |
| ๐ฎ | sf-ai-einstein | Prediction Builder, NBA | ๐ Planned |
๐ฆ Products
| Skill | Description | Status | |
|---|---|---|---|
| โ๏ธ | sf-product-datacloud | Unified profiles, segments | ๐ Planned |
| ๐จ | sf-product-omnistudio | FlexCards, DataRaptors | ๐ Planned |
โ๏ธ Clouds
| Skill | Description | Status | |
|---|---|---|---|
| ๐ฐ | sf-cloud-sales | Opportunities, Quotes, Forecasting | ๐ Planned |
| ๐ง | sf-cloud-service | Cases, Omni-Channel, Knowledge | ๐ Planned |
| ๐ | sf-cloud-experience | Communities, Portals | ๐ Planned |
๐ข Industries
| Skill | Description | Status | |
|---|---|---|---|
| ๐ฅ | sf-industry-healthcare | FHIR, Care Plans, Compliance | ๐ Planned |
| ๐ฆ | sf-industry-finserv | KYC, AML, Wealth Management | ๐ Planned |
| ๐ต | sf-industry-revenue | CPQ, Billing, Revenue Lifecycle | ๐ Planned |
Total: 29 skills (19 skills โ live, 10 planned ๐)
</details> <details> <summary><h2>๐ค Supported Agentic Coding Tools</h2></summary>CLI Compatibility
All skills follow the Agent Skills open standard. Install with npx skills add for any supported agent:
npx skills add Jaganpro/sf-skills
| Tool | Status | Install Method | |
|---|---|---|---|
| Claude Code CLI | โ Full Support | npx skills add or bash installer | |
| OpenCode CLI | โ Compatible | npx skills add | |
| Codex CLI | โ Compatible | npx skills add | |
| Gemini CLI | โ Compatible | npx skills add | |
| Amp CLI | โ Compatible | npx skills add or .claude/skills/ | |
| Droid CLI | โ Compatible | npx skills add |
</details>๐ค Call for Volunteers! This repo is community-driven. We need testers on different CLIs โ open an issue to get started.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally:
python3 tools/install.py --dry-run - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
Issues & Support
License
MIT License - Copyright (c) 2024-2026 Jag Valaiyapathy