Skip to content
forcedotcom avatar

Dx Code Analyzer Run

Run Salesforce Code Analyzer scans across PMD, ESLint, CPD, RetireJS, Flow, SFGE, and ApexGuru engines.

CCM score
67 of 100
skills.sh installs
6.9K
GitHub stars
1.2K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers scanning files, folders, and git diffs, filtered by engine, category, and severity, plus post-scan result exploration
  • Includes bundled scripts for parsing, filtering, ranking, describing rules, and applying engine-provided auto-fixes
  • Enforces Bash-only script use for reading results, and rejects inline parsing or direct reads of large result files
  • Designed for security reviews, AppExchange checks, and static analysis of Apex, LWC, Flow, and library code

Install

$ npx -y skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Running Code Analyzer Skill

CRITICAL: Mandatory Script Usage

Every interaction with Code Analyzer results MUST go through the bundled scripts in <skill_dir>/scripts/. No exceptions.

WRONG — never do this:

# WRONG: inline Python to parse results
python3 -c "import json; data = json.load(open('results.json'))..."

# WRONG: inline Node.js to parse results
node -e "const data = require('./results.json')..."

# WRONG: jq to filter results
cat results.json | jq '.violations[] | select(.engine=="pmd")'

# WRONG: reading the results file directly (it can be 10MB+)
Read tool → code-analyzer-results-*.json

Also forbidden: run_code_analyzer and any mcp__* tool — Bash only.

RIGHT — always do this:

# Summarize scan results
node "<skill_dir>/scripts/parse-results.js" "./code-analyzer-results-TIMESTAMP.json"

# Filter/rank/query results (by engine, severity, file, rule, category)
node "<skill_dir>/scripts/query-results.js" "./code-analyzer-results-TIMESTAMP.json" --engine pmd --summary

# List/browse available rules (by engine, category, language, severity)
node "<skill_dir>/scripts/list-rules.js" "Security" --top 10

Details

Repository
github.com/forcedotcom/sf-skills
Categories
Code Review & Quality, Security
First seen
Jul 14, 2026

Questions

What does the dx-code-analyzer-run skill do?

It runs Salesforce Code Analyzer to scan code for security, performance, best practice, and code style violations across engines such as PMD, ESLint, CPD, RetireJS, Flow, SFGE and ApexGuru. It also filters scan results by engine, severity, category or file and explains what a rule means.

How do I install the dx-code-analyzer-run skill?

Run npx -y skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -y in a project. Once installed, the agent can scan your code, explore results and look up rules for you.

What do I need before running a scan with this skill?

You need the Salesforce CLI (sf) with the code analyzer plugin version 5.x or later, Java 11 or later for PMD, CPD and SFGE, and Node.js 18 or later for ESLint and RetireJS. ApexGuru also requires an authenticated org, and Flow analysis needs Python 3.

Which skills lead the Code Review & Quality category, and where does this one stand?

This skill ranks in the top 100 of the Code Review & Quality category, alongside improve-codebase-architecture, codebase-design, code-review, setup-ts-deep-modules and caveman-review. It stands apart by focusing on Salesforce-specific static analysis across Apex, Flows, LWC and Salesforce security rules.

More from forcedotcom/sf-skills

All 78

Similar to Dx Code Analyzer Run

More Code Review & Quality