dx-code-analyzer-run

Run Salesforce Code Analyzer scans and filter, explain, and auto-fix violations across engines.

Updated Jul 2, 2026
One-click install
npx skills add https://github.com/padjei/SF_Build --skill dx-code-analyzer-run-padjei
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dx-code-analyzer-run
Source: https://github.com/padjei/SF_Build/tree/main/.claude/skills/dx-code-analyzer-run
Command: npx skills add https://github.com/padjei/SF_Build --skill dx-code-analyzer-run-padjei

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Running Salesforce Code Analyzer correctly requires knowing the v4+ CLI syntax, rule-selector expressions, engine prerequisites, and how to parse potentially huge JSON result files. This Skill translates natural-language requests into correct sf code-analyzer run commands, executes scans, and turns raw violations into actionable summaries and safe engine-provided fixes. ## Core Features & Use Cases - Scan orchestration: Builds correct rule selectors (engine, category, severity, specific rules) and targets (files, folders, globs, git diffs) for PMD, ESLint, CPD, RetireJS, Flow, SFGE, and ApexGuru engines. - Result exploration: Parses, filters, ranks, and aggregates scan results by engine, severity, file, rule, or category using bundled scripts instead of ad-hoc parsing. - Rule lookup and listing: Explains what a specific rule means and lists available rules by selector with typo-tolerant fuzzy matching. - Safe auto-fixing: Discovers engine-provided fixes, filters out vendor files (jQuery, Bootstrap, minified JS), asks for user confirmation, applies fixes, and summarizes the outcome. - Use Case: A developer says "check my changes for security issues" — the Skill diffs against the base branch, scans only changed files with all:Security:(1,2), and presents a severity-ranked violation table. ## Quick Start Ask the assistant to scan your Salesforce project for security issues and show the most critical violations first.

Frequently Asked Questions about dx-code-analyzer-run

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan Salesforce code for security issues with Code Analyzer?▼

Run `sf code-analyzer run` with the rule selector `all:Security:(1,2)` to check all engines for Critical and High severity security violations. Always write results to a timestamped JSON file via `--output-file` and include `--include-fixes` to enable auto-fix discovery.

How do I scan only my changed files in a git diff?▼

Get changed files with `git diff --name-only main...HEAD`, filter them to scannable types like .cls, .trigger, .js, and .flow-meta.xml, then pass them as a comma-separated `--target` value to `sf code-analyzer run`.

Which engines does Salesforce Code Analyzer support?▼

It supports PMD for Apex, ESLint for JavaScript and LWC, CPD for duplicate detection, RetireJS for vulnerable libraries, Flow for flow analysis, SFGE for data-flow analysis, and ApexGuru for performance. Each engine has its own prerequisites such as Java 11+, Node 18+, Python 3, or an authenticated org.

Why does sf code-analyzer fail with unknown flag errors?▼

The v4+ CLI removed v3 flags like `--format`, `--engine`, `--category`, and `--json`. Use `--rule-selector` for engine and category selection, and set the output format through the `--output-file` extension such as .json, .html, or .sarif.

Can Code Analyzer automatically fix violations?▼

Yes, when engines provide deterministic fixes, the Skill discovers them, optionally filters out vendor files like jQuery or Bootstrap, asks for your confirmation, then applies and summarizes the fixes. Security issues like CRUD violations still require manual remediation.

When should I not use this scanning Skill?▼

Do not use it for installing or configuring the sf CLI or the code-analyzer plugin, writing custom rules, or AI-generated refactoring beyond engine-provided fixes. Installation and configuration belong to the separate dx-code-analyzer-configure skill.