Use Salesforce Agent Skills to Analyze Code in Natural Language

Skills are folders of instructions, scripts, and resources that load dynamically to improve performance on specialized tasks. While tools like Model Context Protocol (MCP) give an agent the ability to interact with your system such as running a test or querying a database, they don’t tell the agent how to do a job properly. A Salesforce Skill fills that gap. It lets you bundle natural language guidance, team coding standards, best practices, and automated testing tools directly into a portable file that your agent reads and follows.

The Running Code Analyzer skill turns your developer agent into an automated code-review assistant. Instead of typing long, complicated terminal commands to scan your code, you can just ask your agent in plain English to check your code, find bugs.

With Skills you can:

  • Translates Plain English to CLI Commands: You type “find duplicate code in my project” and the agent automatically builds and runs the exact sf code-analyzer run --rule-selector cpd --output-file "./code-analyzer-results-20260512-172653.json"
    command in the background.

  • Scans Multiple Languages: It automatically detects what you are working on and applies the right engines (like PMD for Apex or ESLint for Lightning Web Components).

  • Offers Safe Auto-Fixes: If an error can be automatically repaired, the agent will show you the solution, ask for your permission, and safely update the file for you.

How your environment accesses and activates your team’s Code Analyzer skills depends on your primary workspace configuration:

  • If you use Agentforce Vibes 2.0, built-in Salesforce application development skills are pre-installed. Agentforce Vibes natively discovers configuration blueprints in your workspace, linking natural language coding commands directly to Code Analyzer’s core checking engines.

  • If you use standalone agentic tools (such as Claude Code, Cursor, or Windsurf), you can install and manage portable skills via the core Salesforce Skills Library (@forcedotcom/sf-skills). This library provides community-supported, tool-agnostic open specifications for standard Salesforce metadata.

You do not invoke an agent skill script or run validation rules directly. Instead, you prompt your autonomous workspace agent using natural language. The agent checks its active skills catalog, triggers the appropriate execution contract, and automatically spins up Code Analyzer to evaluate the modifications.

Here are sample prompts that automatically triggers Code Analyzer skills:

  • Show me critical sfge violation?

    SFGE engine vilation

  • Run code analyzer for high severity security issues

  • Run code analyzer for pmd and eslint only

  • Run code analyzer on my changed files only

  • Analyze my project with flow engine