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
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-dumpbefore writing any XPath, so expressions match the actual AST nodes rather than memory - Enforces scripted rule creation through
create-regex-rule.jsandcreate-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 -yInstalls 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- Omnistudio Datamapper Generate4.9K
- Omnistudio Omniscript Generate4.9K
- Omnistudio Dependencies Analyze4.9K
- Omnistudio Integration Procedure Generate4.9K
- Omnistudio Callable Apex Generate4.9K
- Omnistudio Flexcard Generate4.9K
- Omnistudio Datapacks Deploy4.9K
- Omnistudio Epc Catalog Generate4.9K
- Mobile Apps Create4.8K
- Mobile Platform Native Capabilities Integrate4.8K
- Mobile Platform Offline Validate4.7K
- Commerce B2b Store Create4.7K
- Commerce B2b Open Code Components Integrate4.7K
- Commerce B2b Open Code Components Replace4.6K
- Platform Apex Generate7.8K
- Platform Apex Test Generate7.7K
- Platform Apex Test Run7.5K
- Platform Apex Logs Debug7.4K
- Platform Soql Query7.4K
- Platform Metadata Deploy7.3K
- Platform Metadata Retrieve7.2K
- Platform Custom Field Generate7.1K
- Platform Docs Get7K
- Platform Permission Set Generate7K
Similar to Dx Code Analyzer Custom Rule Create
More Code Review & Qualitydx-code-analyzer-runSkillforcedotcom/sf-skills6.9K installsRun Salesforce Code Analyzer scans across PMD, ESLint, CPD, RetireJS, Flow, SFGE, and ApexGuru engines.
salesforce-code-qualityPluginforcedotcom/sf-skills1.2K starsAnalyze and govern Salesforce code quality with Salesforce Code Analyzer and the Well-Architected framework: set up and troubleshoot Code Analyzer, run security
yara-rule-authoringSkilltrailofbits/skills6.2K installsGuided authoring and review of YARA-X detection rules, covering naming, string selection, performance, and false positive reduction.
semgrepSkillsemgrep/skills2.5K installsScans code with Semgrep and writes custom YAML rules, favoring taint mode for injection-class bugs.
ASTMCP serverast-grep501 starsStructural code search and rule testing over local codebases using ast-grep patterns and YAML rules.
agents-mdSkillcallicrate/skills1.4K installsScoped AGENTS.md authoring skill that turns verified repo evidence into concise, path-scoped guidance for coding agents.