Skip to content
forcedotcom avatar

Dx Code Analyzer Custom Rule Create

Create custom Code Analyzer rules with Regex, PMD/XPath, or ESLint to enforce patterns beyond the built-in set.

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

Own this skill? Claim it

What it does

  • Covers rule authoring for three engines: Regex for text patterns, PMD XPath for Apex and metadata XML, and ESLint for LWC and JavaScript
  • Requires running ast-dump before writing any XPath, so expressions match the actual AST nodes rather than memory
  • Enforces scripted rule creation through create-regex-rule.js and create-pmd-rule.js, with validation and positive and negative sample tests per rule
  • Designed for teams enforcing coding standards, banning patterns, or governing metadata, and used alongside the run and configure skills

Install

$ npx -y skills add forcedotcom/sf-skills --skill dx-code-analyzer-custom-rule-create -y

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

Files

dx-code-analyzer-custom-rule-create: Custom Code Analyzer Rule Authoring

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).

Use this skill when the user needs to create a custom rule that enforces a pattern not covered by Code Analyzer's built-in rules. Supports Regex engine (text pattern matching) and PMD engine (structural XPath queries against the AST).

When This Skill Owns the Task

Details

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

Questions

What does the dx-code-analyzer-custom-rule-create skill do?

It creates custom Code Analyzer rules for Regex pattern matching, PMD XPath rules for Apex and metadata XML, and ESLint rules for LWC and JavaScript. It is meant for enforcing coding standards, banning patterns such as System.debug, and detecting hardcoded IDs.

How do I install the dx-code-analyzer-custom-rule-create skill?

Run npx -y skills add forcedotcom/sf-skills --skill dx-code-analyzer-custom-rule-create -y inside your project. Once installed, the agent can write rules that catch the code patterns you describe.

Which tools does the custom rule create skill need?

The skill expects git 2.0.0 or later, Node.js 18.0.0 or later, npm 9.0.0 or later, and the Salesforce sf CLI 2.0.0 or later. Its rule scripts and sample files are used to validate rules before they are tested.

Where does this skill sit in the Code Review and Quality category?

It is listed in the Code Review and Quality category on Claude Marketplaces, alongside improve-codebase-architecture, codebase-design, code-review, setup-ts-deep-modules and caveman-review. Its focus is authoring new static analysis rules rather than general review.

When should I use this skill instead of the run or configure skills?

Use it when you want to create a new rule for a pattern not covered by built-in rules. For running scans, use dx-code-analyzer-run, and for engine setup or CI configuration, use dx-code-analyzer-configure.

More from forcedotcom/sf-skills

All 78

Similar to Dx Code Analyzer Custom Rule Create

More Code Review & Quality