Skip to content
Agentmart
Submit a tool

sf-code-analyzer

Run static code analysis on Salesforce projects using sf code-analyzer.

Skill by jterratsdev

IndexedBSD-3-Clause
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/jterratsdev-sf-code-analyzer

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Run static code analysis on Salesforce projects using sf code-analyzer. Supports Apex (PMD), LWC (ESLint), RetireJS, and CPD engines with configurable rule selectors, severity thresholds, and output formats. USE FOR: code analysis, static analysis, code quality, PMD, ESLint, code review, code scan, lint, apex analysis, lwc analysis, security scan. Reusable by Developer, QA, Architect, and DevOps profiles.

Use cases: testing, devops, security, sales

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/sf-code-analyzer

What's inside

Skill name
sf-code-analyzer
Description
Run static code analysis on Salesforce projects using sf code-analyzer. Supports Apex (PMD), LWC (ESLint), RetireJS, and CPD engines with configurable rule selectors, severity thresholds, and output formats. USE FOR: code analysis, static analysis, code quality, PMD, ESLint, code review, code scan, lint, apex analysis, lwc analysis, security scan. Reusable by Developer, QA, Architect, and DevOps profiles.
License
BSD-3-Clause
Instructions
195 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Salesforce Code Analyzer

## Prerequisites

| Tool | Check | Install |
|------|-------|---------|
| Salesforce CLI | `sf --version` | [https://developer.salesforce.com/tools/salesforcecli](https://developer.salesforce.com/tools/salesforcecli) |
| Code Analyzer plugin | `sf plugins inspect @salesforce/plugin-code-analyzer` | `sf plugins install @salesforce/plugin-code-analyzer` |

Before proceeding, ensure the plugin is installed:

```bash
sf plugins inspect @salesforce/plugin-code-analyzer 2>/dev/null || sf plugins install @salesforce/plugin-code-analyzer
```

---

## Active Job Monitoring (CRITICAL)

When you execute `sf code-analyzer run`, you MUST wait for it to complete.
**Never** ask the user to check the result or suggest reviewing later.
Report the full results including violation count, severity breakdown, and
affected files. If the analysis is long-running, monitor its progress.

---

## 1. Running Analysis (`sf code-analyzer run`)

### Basic Usage

```bash
# Analyze entire project
sf code-analyzer run --target force-app

# Analyze specific files (comma-separated)
sf code-analyzer run --target "force-app/main/default/classes/MyClass.cls,force-app/main/default/classes/MyService.cls"

# Analyze a directory
sf code-analyzer run --target force-app/main/default/classes
```

### Rule Selectors

Use `--rule-selector` to pick which engines and rule categories to apply:

| Engine | Selector | Covers |
|--------|----------|--------|
| PMD | `pmd:Recommended` | Best practices, code style |
| PMD | `pmd:Security` | SOQL injection, CRUD/FLS, XSS |
| PMD | `pmd:Performance` | SOQL/DML in loops, large queries |
| PMD | `pmd:Design` | Complexity, coupling, class size |
| ESLint | `eslint:Recommended` | JS best practices for LWC |
| ESLint | `eslint:Security` | DOM XSS, eval, unsafe patterns |
| RetireJS | `retire-js:Recommended` | Known vulnerable JS libraries |
| CPD | `cpd:Recommended` | Copy-paste / duplicate code detection |

```bash
# Apex: security + performance rules only
sf code-analyzer run --target force-app/main/default/classes \
  --rule-selector "pmd:Security,pmd:Performance"

# LWC: recommended + security
sf code-analyzer run --target force-app/main/default/lwc \
  --rule-selector "eslint:Recommended,eslint:Security"

# Full scan: all engines
sf code-analyzer run --target force-app \
  --rule-selector "pmd:Recommended,pmd:Security,pmd:Performance,pmd:Design,eslint:Recommended,eslint:Security,retire-js:Recommended,cpd:Recommended"
```

### Severity Threshold

Control which severity level blocks (returns exit code 2):

```bash
# Block only on HIGH/critical violations
sf code-analyzer run --target force-app --severity-threshold 1

# Block on HIGH and MEDIUM
sf code-analyzer run --target force-app --severity-threshold 2

# Block on any violation (HIGH, MEDIUM, LOW)
sf code-analyzer run --target force-app --severity-threshold 3
```

| Exit Code | Meaning |
|-----------|---------|
| 0 | No violations above threshold |
| 2 | Violations found at or above threshold severity |
| Other | Analyzer error (treat as non-blocking) |

### Output Formats

```bash
# Table (default, best for terminal)
sf code-analyzer run --target force-app --output-format table

# JSON (for programmatic processing)
sf code-analyzer run --target force-app --output-format json

# CSV (for spreadsheet analysis)
sf code-analyzer run --target force-app --output-format csv --output-file report.csv

# HTML (for sharing with stakeholders)
sf code-analyzer run --target force-app --output-format html --output-file report.html
```

---

## 2. Listing Rules (`sf code-analyzer rules list`)

Inspect available rules before running analysis:

```bash
# List all available rules
sf code-analyzer rules list

# Filter by engine
sf code-analyzer rules list --rule-selector "pmd:Security"

From jterratsdev/smart-deployment, BSD-3-Clause.

More from jterratsdev/smart-deployment

Signals

Stars
0
Forks
0
Open issues
14
Last commit (this folder)
Aug 5, 2026 (2 months ago)
Last release
Sep 29, 2026 (29 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
BSD-3-Clause
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from jterratsdev

Cite this page

sf-code-analyzer skill. Agent Mart. https://agentmart.dev/skills/jterratsdev-sf-code-analyzer (last updated 2026-10-24)