grzmol/vibe-force/sf-code-analyzer-quality
Claude Code and agent skill by grzmol/vibe-force
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Salesforce Code Analyzer v5 and the rest of the local quality gate - sf code-analyzer run/rules/config with --workspace, --target, --rule-selector, --severity-threshold, --view, --output-file and --config-file, the pmd, eslint, regex, retire-js, flow, cpd and sfge (Salesforce Graph Engine) engines, code-analyzer.yml schema with rule overrides, ignores and suppressions, custom PMD rulesets and XPath rules, ESLint flat config with @salesforce/eslint-config-lwc, Prettier with prettier-plugin-apex, the 1-5 severity taxonomy and the analyzerFailSeverity gate, baseline and ratchet strategies for legacy code, SARIF output and CI annotation. Use when configuring or running static analysis, triaging violations, authoring or suppressing rules, or when running vf-check static, vf-check lint, vf-check format, vf-check analyzer, or vf-check local.
Install
npx vskill@latest install grzmol/vibe-force/sf-code-analyzer-qualitySemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as grzmol/vibe-force/sf-code-analyzer-quality.
Code Analyzer and Quality Gates
When to use
- Setting up or changing static analysis for a Salesforce project.
- Triaging a
vf-check analyzerfailure, deciding fix versus suppress, or writing a suppression with
a reason and a cap.
- Authoring a custom PMD rule or a regex rule for a project convention.
- Wiring Prettier/ESLint so
vf-check formatandvf-check lintare deterministic. - Introducing the gate to a legacy codebase without stopping delivery (baseline and ratchet).
- Wave 2 of the vibe-force workflow:
sf-quality-gaterunsvf-check localand reports. - Org-wide debt rather than a diff: skill
sf-technical-debt-audit(it turns recurring findings into regex rules authored here).
Toolchain and prerequisites
| Tool | Install | Requirement | |
|---|---|---|---|
| Code Analyzer plugin | sf plugins install code-analyzer (it is also a JIT plugin: running a code-analyzer command installs it automatically) | Salesforce CLI; Node.js 20 or later if the CLI was installed via npm | |
pmd, cpd, sfge engines | bundled with the plugin | JDK 11 or later | |
flow engine (Flow Scanner) | bundled | Python 3.10.0 or later | |
eslint, retire-js, regex engines | bundled | Node, no extra runtime | |
| Prettier + Apex plugin | npm i -D prettier prettier-plugin-apex | Node 22 or later; JRE 17 or later only on platforms without a prebuilt native parser | |
| LWC ESLint | npm i -D eslint @babel/core @babel/eslint-parser @salesforce/eslint-config-lwc @lwc/eslint-plugin-lwc @salesforce/eslint-plugin-lightning eslint-plugin-import eslint-plugin-jest | ESLint 9 for @salesforce/eslint-config-lwc 4.x and @lwc/eslint-plugin-lwc 3.x |
If Java or Python are unavailable in an environment (a lean CI image, for example), disable those engines in code-analyzer.yml rather than tolerating engine errors:
Config files live in the plugin and are referenced by the check runner; do not duplicate them per project: config/code-analyzer.yml, config/pmd/apex-ruleset.xml, config/eslint/eslint.config.mjs, config/prettier/.prettierrc.
Engines
| Engine | Analyzes | Detects | Notes | |
|---|---|---|---|---|
pmd | Apex, Visualforce, HTML, JavaScript, XML | security, error-prone, performance, style, documentation | JDK required; default languages apex and visualforce; AppExchange ruleset available via --rule-selector AppExchange | |
eslint | JavaScript, TypeScript, LWC, Aura, CSS/SCSS (SLDS), JSX | LWC rule violations, JS correctness, SLDS 2 misuse, React/JSX when enabled | bundles @salesforce/eslint-config-lwc/recommended and @lwc/lwc-platform/recommended; supports ESLint 8 and 9 | |
regex | any text file | project conventions, banned strings, trailing whitespace | custom rules need a global-modifier regex (/TODO/gi) | |
retire-js | bundled JavaScript, static resources | known-vulnerable third-party libraries | ||
flow | Flows, subflows | unsafe Flow patterns, data passed into without sharing Apex | Python required | |
cpd | multiple languages | copy/paste duplication | JDK required; off by default in the vibe-force config | |
sfge | Apex | path-based CRUD/FLS, sharing, null-pointer, loop-database, mass-schema-lookup issues | Developer Preview; JDK required; slowest engine |
Severity taxonomy and the gate
| Severity | Name | vibe-force policy | |
|---|---|---|---|
| 1 | Critical | blocks; fix before the PR leaves wave 2 | |
| 2 | High | blocks | |
| 3 | Moderate | blocks (gates.analyzerFailSeverity default 3) | |
| 4 | Low | reported, does not block | |
| 5 | Info | reported, does not block |
--severity-threshold makes the command exit non-zero when a violation meets or exceeds the given level; it accepts a number or its name (2 or "High"). vf-check analyzer passes gates.analyzerFailSeverity from .vibeforce/config.json.
Core patterns
1. List the rules before running them
--rule-selector eslint is equivalent to eslint:all; append :Recommended to stay inside the recommended set. Criteria combine with : as AND and , as OR, and parentheses group; a selector containing parentheses must be double-quoted.
2. Run the same selectors
--workspace is the analysis context (default .); --target narrows which files produce violations while keeping the workspace available to engines that need the whole project - Graph Engine compiles the workspace to build its call graph.
3. Generate and evolve the configuration
Every code-analyzer command auto-discovers code-analyzer.yml or code-analyzer.yaml in the current folder; --config-file overrides the location. Schema details: references/code-analyzer-cli.md and references/config-templates.md.
4. Override severity and tags instead of deleting rules
rules.<engine>.<rule>.severity accepts 1-5 or Critical|High|Moderate|Low|Info; tags replaces the rule's tags; disabled: true switches the rule off for every file.
5. Add a project convention as a regex rule
The regex must carry a global modifier (/.../g or /.../gi); without it the engine errors. [unverified] The exact property names under custom_rules beyond regex and file_extensions were not enumerated on the fetched configuration pages; generate a skeleton with sf code-analyzer config --rule-selector regex --include-unmodified-rules and copy the shape it prints.
6. Add a custom PMD rule
- Write an XPath rule (or a Java rule packaged in a JAR) in a PMD ruleset XML file; use
sf code-analyzer ast-dump to see the AST you are matching against.
- Register the ruleset:
- Confirm registration, then run it:
Code Analyzer tags every custom rule Custom and also adds a tag matching the <ruleset> name attribute with spaces removed. Custom PMD severities derive from PMD priority: 1 -> 2 (High), 2 -> 3 (Moderate), 3 -> 3 (Moderate), 4 -> 4 (Low), 5 -> 4 (Low).
7. Suppress narrowly, with a reason
In-source markers (processed by Code Analyzer v5 for any text file):
Configuration-level bulk suppression:
Marker forms: code-analyzer-suppress, code-analyzer-suppress-line, code-analyzer-suppress-next-line, and code-analyzer-unsuppress to restore checking. A bare code-analyzer-suppress applies from that line to end of file or until an unsuppress marker, so prefer the line-scoped forms. Folder paths in suppressions must end with /. --no-suppressions ignores both marker and config suppressions, except that a suppressions.disable_suppressions setting in the config file takes precedence over the flag. PMD's own @SuppressWarnings('PMD.RuleName') annotation and // NOPMD comment still work for the PMD engine; vibe-force prefers the Code Analyzer markers because they work across every engine and are greppable.
8. Formatting and linting around the analyzer
Prettier owns whitespace, ESLint owns JavaScript semantics, Code Analyzer owns Apex, metadata, and cross-language rules. Never encode formatting preferences as analyzer rules.
9. Composition of the vibe-force checks
vf-check | Composed of | |
|---|---|---|
format | prettier --check over changed Apex, LWC, Aura, XML, JS (--fix runs prettier --write) | |
lint | eslint over changed LWC/Aura JS | |
analyzer | sf code-analyzer run --config-file config/code-analyzer.yml --severity-threshold <gates.analyzerFailSeverity> over the changed files as --target with the package directories as --workspace | |
static | format + lint + analyzer | |
local | static + jest - the full no-org gate |
Reports land in <project>/.vibeforce/reports/<check>-<ISO>.json with {check, startedAt, durationMs, status, gates, findings[], raw}. Exit codes: 0 pass, 1 gate failed, 2 misconfiguration or missing tool, 3 org/network error.
Anti-patterns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sf-code-analyzer-quality/SKILL.md
Popularity
- Repository stars
- 3
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grzmol/vibe-force/sf-code-analyzer-quality)