Use Salesforce Agent Skills to Analyze Code in Natural Language

Skills are bundles of domain logic, specialized instructions, automated scripts, and structural schemas. Skills load contextually into the runtime environment on demand. Use Salesforce Code Analyzer Skills to configure engines, analyze source code, manage rulesets, and implement automated continuous integration (CI/CD) pipelines through natural language text inputs.

Your workspace configuration determines how you access and activate Code Analyzer actions.

  • Agentforce Vibes 2.0: Skills are preinstalled. Agentforce Vibes discovers configuration in your workspace and links natural language commands to Code Analyzer’s core checking engines.

  • Standalone autonomous AI tools: If you use tools such as Claude Code, Cursor, or Windsurf, install and manage portable skills via the core Salesforce Skills Library (@forcedotcom/sf-skills).

  • Use the dx-code-analyzer-run skill to transform natural language into valid CLI commands. For example, the prompt “find duplicate code in my project” triggers the command:

    See dx-code-analyzer-run for more information.

  • Use the dx-code-analyzer-configure skill to set up your environment for core software installations. It also inspects your target repository structure to generate customized configuration files and validates YAML syntax against the engine’s structural schema.

    See dx-code-analyzer-configure for more information.

  • Use the dx-code-analyzer-custom-rules-create to automate the setup of custom PMD rules mapping properties into a code-analyzer.yml file, and managing engine configurations. The agent evaluates the requirement from your instruction, details a plan, and generates the engine configurations and matching XPath patterns. The skill handles structural tasks, such as defining correct engine tags, configuring custom parameter properties, and setting up file exclusions to ignore test classes.

    Sample Commands

    _ Create a custom PMD rule to track specific controller properties.

    _ Create 4 rules for AppExchange review: no System.debug, no hardcoded IDs, require with sharing, require user mode on SOQL.

    _ Generate a custom rule that flags unhandled exceptions in Apex classes.

    See dx-code-analyzer-custom-rule-create