Agent Skill
2/7/2026

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.

J
jaganpro
75GitHub Stars
3Views
npx skills add Jaganpro/sf-skills

SKILL.md

Namesf-ai-agentscript
DescriptionAgent 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)

Author License: MIT

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

๐Ÿ”Œ Integration

๐Ÿค– AI & Automation

๐Ÿ› ๏ธ DevOps & Tooling

๐Ÿค– Agent Team

Seven specialized Claude Code agents for Salesforce implementations, installed to ~/.claude/agents/.

FDE Team (Agent-Focused)

AgentRoleModeKey Skills
fde-strategistOrchestrator โ€” plans, researches, delegatesplansf-ai-agentforce, sf-diagram-mermaid
fde-engineerAgent config, metadata, Apex, Agent ScriptsacceptEditssf-ai-agentforce, sf-ai-agentscript
fde-experience-specialistConversation design, persona, UX, LWCacceptEditssf-ai-agentforce-persona, sf-lwc

Cross-Cutting (Serve Both Teams)

AgentRoleModeKey Skills
fde-qa-engineerTesting (agent + platform), debug, observabilityacceptEditssf-testing, sf-ai-agentforce-testing
fde-release-engineerDeployment, Connected Apps, CI/CDacceptEditssf-deploy, sf-connected-apps

PS Team (Platform Infrastructure)

AgentRoleModeKey Skills
ps-technical-architectApex, integrations, data, LWC, performanceacceptEditssf-apex, sf-integration, sf-lwc + 5 more
ps-solution-architectMetadata, Flows, permissions, diagramsacceptEditssf-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 npx command)

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 MethodCheck for UpdatesUpdate
npxnpx skills checknpx skills update
install.pypython3 ~/.claude/sf-skills-install.py --statuspython3 ~/.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:

HookFunction
SessionStartInitializes session, preflights org connection, warms LSP servers
PreToolUseGuardrails โ€” blocks dangerous DML, auto-fixes unbounded SOQL
PostToolUseValidates Apex/Flow/LWC on save
PermissionRequestAuto-approves safe operations (read queries, scratch deploys)

๐ŸŽฌ Video Tutorials

VideoDescription
How to Add/Install SkillsInstall the sf-skills marketplace and add skills to Claude Code
Skills Demo & WalkthroughLive demo of Apex, Flow, Metadata, and Agentforce skills in action

๐Ÿ”— Skill Architecture

Skill Architecture Diagram

<details> <summary><b>๐Ÿš€ Deployment Note</b></summary>

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:

SkillFile TypeValidation
โšกsf-apex*.cls, *.trigger150-pt scoring + Code Analyzer + LSP
๐Ÿ”„sf-flow*.flow-meta.xml110-pt scoring + Flow Scanner
โšกsf-lwc*.js (LWC)140-pt scoring + LSP syntax validation
โšกsf-lwc*.html (LWC)Template validation (directives, expressions)
๐Ÿ”sf-soql*.soql100-pt scoring + Live Query Plan API
๐Ÿงชsf-testing*Test.cls100-pt scoring + coverage analysis
๐Ÿ›sf-debugDebug logs90-pt scoring + governor analysis
๐Ÿ“‹sf-metadata*.object-meta.xml, *.field-meta.xml, *.permissionset-meta.xmlMetadata best practices
๐Ÿ’พsf-data*.apex, *.soqlSOQL patterns + Live Query Plan
๐Ÿค–sf-ai-agentscript*.agentAgent Script syntax + LSP auto-fix
๐Ÿงชsf-ai-agentforce-testingTest spec YAML100-pt scoring + fix loops
๐Ÿ”sf-connected-apps*.connectedApp-meta.xmlOAuth security validation
๐Ÿ”—sf-integration*.namedCredential-meta.xml120-pt scoring + callout patterns
๐Ÿ“ธsf-diagram-nanobananaproGenerated imagesPrerequisites check
<details> <summary><b>Validator Dispatcher Architecture</b></summary>

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:

PatternSkillValidators
*.agentsf-ai-agentscriptagentscript-syntax-validator.py
*.cls, *.triggersf-apexapex-lsp-validate.py + post-tool-validate.py
*.flow-meta.xmlsf-flowpost-tool-validate.py
/lwc/**/*.jssf-lwclwc-lsp-validate.py + post-tool-validate.py
/lwc/**/*.htmlsf-lwctemplate_validator.py
*.object-meta.xmlsf-metadatavalidate_metadata.py
*.field-meta.xmlsf-metadatavalidate_metadata.py
*.permissionset-meta.xmlsf-metadatavalidate_metadata.py
*.namedCredential-meta.xmlsf-integrationvalidate_integration.py
*.soqlsf-soqlpost-tool-validate.py
SKILL.md(removed)โ€”
</details> <details> <summary><b>Code Analyzer V5 Integration</b></summary>

Hooks integrate Salesforce Code Analyzer V5 for OOTB linting alongside custom scoring:

EngineWhat It ChecksDependency
PMD55 Apex rules (85% coverage) โ€” security, bulkification, complexity, testingJava 11+
SFGEData flow analysis, path-based securityJava 11+
RegexTrailing whitespace, hardcoded patternsNone
ESLintJavaScript/LWC lintingNode.js
Flow ScannerFlow best practicesPython 3.10+

Custom Validation Coverage:

ValidatorTotal ChecksCategories
Apex (150-pt)PMD 55 rules + Python 8 checksSecurity (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 LinterSLDS 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
MetricDescriptionThreshold
relativeCostQuery selectivity scoreโ‰ค1.0 = selective โœ…, >1.0 = non-selective โš ๏ธ
leadingOperationTypeHow Salesforce executes the queryIndex, TableScan, Sharing
cardinalityEstimated rows returnedvs. total records in object
notes[]WHY optimizations aren't being usedIndex 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.

</details>

๐Ÿ”ค Language Server Protocol (LSP) Integration

Skills leverage official Salesforce LSP servers for real-time syntax validation with auto-fix loops:

SkillFile TypeLSP ServerRuntime
๐Ÿค–sf-ai-agentscript*.agentAgent Script Language ServerNode.js 18+
โšกsf-apex*.cls, *.triggerapex-jorje-lsp.jarJava 11+
โšกsf-lwc*.js, *.html@salesforce/lwc-language-serverNode.js 18+

How Auto-Fix Loops Work:

  1. Claude writes/edits a file
  2. LSP hook validates syntax (~500ms)
  3. If errors found โ†’ Claude receives diagnostics and auto-fixes
  4. 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 (sf command) โ€” 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:

SkillsMinimum APINotes
Most skills62.0 (Winter '25)sf-apex, sf-flow, sf-lwc, sf-metadata
sf-connected-apps, sf-integration61.0External Client Apps
sf-ai-agentforce66.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
LSPStandalone 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
<details> <summary><h2>๐Ÿ’ฌ Usage Examples</h2></summary>

โšก 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

SkillDescriptionStatus
๐Ÿ”sf-connected-appsConnected Apps, ECAs, OAuth configurationโœ… Live
๐Ÿ”—sf-integrationNamed Credentials, External Services, REST/SOAP, Platform Events, CDCโœ… Live
๐Ÿ“Šsf-diagram-mermaidMermaid diagrams for OAuth, ERD, integrations, architectureโœ… Live
โšกsf-lwcLightning Web Components, Jest, LMSโœ… Live
๐Ÿ”sf-soqlNatural language to SOQL, optimizationโœ… Live
๐Ÿงชsf-testingTest execution, coverage, bulk testingโœ… Live
๐Ÿ›sf-debugDebug log analysis, governor fixesโœ… Live
๐Ÿ“ธsf-diagram-nanobananaproVisual ERD, LWC mockups, Gemini sub-agentโœ… Live
๐Ÿ”sf-permissionsPermission Set analysis, hierarchy viewer, "Who has X?"โœ… Live
๐Ÿ”’sf-securitySharing rules, org-wide defaults, encryption๐Ÿ“‹ Planned
๐Ÿ“ฆsf-migrationOrg-to-org, metadata comparison๐Ÿ“‹ Planned

๐Ÿค– AI & Automation

SkillDescriptionStatus
๐Ÿค–sf-ai-agentforceAgent Builder, PromptTemplate, Models API, GenAi metadataโœ… Live
๐Ÿงชsf-ai-agentforce-testingAgent test specs, agentic fix loopsโœ… Live
๐Ÿ“ˆsf-ai-agentforce-observabilitySession tracing extraction & analysis (Data Cloud)โœ… Live
๐Ÿ“sf-ai-agentscriptAgent Script DSL, FSM patterns, 100-pt scoringโœ… Live
๐Ÿ’ฌsf-ai-agentforce-personaDeep persona design, identity framework, Agent Builder encodingโœ… Live
๐Ÿง sf-ai-copilotEinstein Copilot, Prompts๐Ÿ“‹ Planned
๐Ÿ”ฎsf-ai-einsteinPrediction Builder, NBA๐Ÿ“‹ Planned

๐Ÿ“ฆ Products

SkillDescriptionStatus
โ˜๏ธsf-product-datacloudUnified profiles, segments๐Ÿ“‹ Planned
๐ŸŽจsf-product-omnistudioFlexCards, DataRaptors๐Ÿ“‹ Planned

โ˜๏ธ Clouds

SkillDescriptionStatus
๐Ÿ’ฐsf-cloud-salesOpportunities, Quotes, Forecasting๐Ÿ“‹ Planned
๐ŸŽงsf-cloud-serviceCases, Omni-Channel, Knowledge๐Ÿ“‹ Planned
๐ŸŒsf-cloud-experienceCommunities, Portals๐Ÿ“‹ Planned

๐Ÿข Industries

SkillDescriptionStatus
๐Ÿฅsf-industry-healthcareFHIR, Care Plans, Compliance๐Ÿ“‹ Planned
๐Ÿฆsf-industry-finservKYC, AML, Wealth Management๐Ÿ“‹ Planned
๐Ÿ’ตsf-industry-revenueCPQ, 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
ToolStatusInstall Method
Claude Code CLIโœ… Full Supportnpx skills add or bash installerClaude
OpenCode CLIโœ… Compatiblenpx skills addOpenCode
Codex CLIโœ… Compatiblenpx skills addOpenAI
Gemini CLIโœ… Compatiblenpx skills addGoogle
Amp CLIโœ… Compatiblenpx skills add or .claude/skills/Amp
Droid CLIโœ… Compatiblenpx skills addFactory

๐Ÿค Call for Volunteers! This repo is community-driven. We need testers on different CLIs โ€” open an issue to get started.

</details>

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test locally: python3 tools/install.py --dry-run
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.

Issues & Support

License

MIT License - Copyright (c) 2024-2026 Jag Valaiyapathy

Skills Info
Original Name:sf-ai-agentscriptAuthor:jaganpro