agentforce-architectur…
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
Run Salesforce Code Analyzer to scan code for security, performance, best practice, and code style violations. Supports all engines (PMD, ESLint, CPD, RetireJS, Flow, SFGE, ApexGuru), targets (files, folders, git diff), categories, and severities. Also handles post-scan
Claude Code
$ npx -y skills add forcedotcom/sf-skills --skill dx-code-analyzer-run --agent claude-code
Codex
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a codex -y
Cursor
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a cursor -y
Gemini CLI
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a gemini-cli -y
GitHub Copilot
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a github-copilot -y
OpenCode
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a opencode -y
Windsurf
$ npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-run -a windsurf -y
name: dx-code-analyzer-run
description: "Run Salesforce Code Analyzer to scan code for security, performance, best practice, and code style violations. Supports all engines (PMD, ESLint, CPD, RetireJS, Flow, SFGE, ApexGuru), targets (files, folders, git diff), categories, and severities. Also handles post-scan exploration: filtering results by engine/severity/category/file, and explaining what rules mean. TRIGGER when: user says 'scan my code', 'check security issues', 'run PMD/ESLint', 'find duplicates', 'analyze Flows', 'check vulnerable libraries', 'AppExchange review', 'lint my LWC', 'static analysis', 'code quality', 'show security violations', 'what is this rule', 'explain ApexCRUDViolation', 'filter results', or mentions engines/file types (.cls, .trigger, .js, .flow-meta.xml). Use this skill for scanning, exploring results, and listing rules. DO NOT TRIGGER when: user asks only about installation/configuration (use dx-code-analyzer-configure), or wants to create a custom rule (use dx-code-analyzer-custom-rule-create)."
metadata:
version: "1.0"
domains: ["Developer Experience"]
relatedSkills:
- "dx-code-analyzer-configure"
- "dx-code-analyzer-custom-rule-create"
cliTools:
- tool: ["git"]
semver: ">=2.0.0"
- tool: ["java"]
semver: ">=11.0.0"
- tool: ["jq"]
semver: ">=1.6.0"
- tool: ["node"]
semver: ">=18.0.0"
- tool: ["npm"]
semver: ">=9.0.0"
- tool: ["python3"]
semver: ">=3.9.0"
- tool: ["sf"]
semver: ">=2.0.0"Every interaction with Code Analyzer results MUST go through the bundled scripts in `<skill_dir>/scripts/`. No exceptions.
# 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-*.jsonAlso forbidden: `run_code_analyzer` and any `mcp__*` tool — Bash only.
# 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 # Look up what a rule means node "<skill_dir>/scripts/describe-rule.js" "ApexCRUDViolation" --engine pmd # Discover fixable violations node "<skill_dir>/scripts/discover-fixes.js" "./code-analyzer-results-TIMESTAMP.json" # Apply fixes (after user confirms) node "<skill_dir>/scripts/apply-fixes.js" "./code-analyzer-results-TIMESTAMP.json" # Summarize applied fixes node "<skill_dir>/scripts/summarize-fixes.js" "./code-analyzer-results-TIMESTAMP.json" # Filter vendor files (jQuery, Bootstrap, *.min.js) before applying fixes node "<skill_dir>/scripts/filter-violations.js" "./code-analyzer-results-TIMESTAMP.json" "./code-analyzer-results-TIMESTAMP-filtered.json" --report
`<skill_dir>` is the absolute path to the directory containing this SKILL.md. **Never** use `./scripts/` — that resolves against the user's CWD, not the skill dir.
Any aggregation, filter, or rank question ("which file has the most violations?", "how many PMD issues?", "top rules by count", "break down by severity") is answered by `query-results.js` — its output already includes `topRules`, `topFiles`, and `severityCounts`.
---
> **Ecosystem:** This skill is part of a 3-skill Code Analyzer suite — `dx-code-analyzer-run` (scans & results) · `dx-code-analyzer-configure` (setup, config, CI/CD) · `dx-code-analyzer-custom-rule-create` (custom rule authoring).
This skill translates natural-language requests ("scan for security issues", "check my changes") into the correct `sf code-analyzer run` command, executes scans across any combination of engines/targets/severities, and presents actionable results. When engine-provided fixes are available, it discovers them, asks for user confirmation, applies them safely, and offers verification. Use it for static analysis, security reviews, AppExchange certification, code-quality checks, and finding duplicates/vulnerabilities in Salesforce projects.
**In scope:** running scans, parsing/filtering/ranking results, applying engine auto-fixes, diff-based scans, all output formats (JSON/HTML/SARIF/CSV/XML), describing/listing rules, scan-failure troubleshooting.
**Out of scope:** installing/configuring `sf` or the plugin (→ `dx-code-analyzer-configure`), writing custom rules/engines (→ `dx-code-analyzer-custom-rule-create`), AI-generated fixes beyond engine-provided ones, deep refactoring, CI/CD setup (→ `dx-code-analyzer-configure`).
**Allowed tools:** Bash (`sf code-analyzer`, `node`, `git diff`, `date`), Read, Write, Edit. **Forbidden:** any MCP tool, Agent tool, web tools, other skills, Python, `jq`, inline scripts/heredocs. This skill owns the complete scan-fix-verify-query-explain workflow end-to-end.
---
1. The command is **`sf code-analyzer run`** — NOT `sf scanner run` (deprecated v3). 2. **No `--format` flag.** Use `--output-file <path>.<ext>`; the extension determines the format. 3. **Always** pass `--output-file` with a timestamped name (e.g., `./code-analyzer-results-20260512-143022.json`) — do not rely on stdout. 4. **Foreground only** (no `run_in_background`); timeout 1200000ms for large scans. 5. **Invalid v3 flags** that cause errors: `--format`, `--engine`, `--category`, `--json`. Use `--rule-selector` + `--output-file` instead. 6. **Tool restrictio
This repository provides Salesforce agent skills, plugins, and sample apps for building applications.
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
Use this skill to Upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec…
Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific…
Build, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates,…
Analyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM)…
Use to design an AI agent persona — identity, voice, tone, behavioral style, guardrails — and encode it into Agent Script (.agent…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.