dx-code-analyzer-custom-rule-create
A Salesforce skill for writing custom rules for Salesforce Code Analyzer.
What the skill teaches
A Salesforce skill for writing custom rules for Salesforce Code Analyzer. It covers three kinds: regular expression rules for text patterns, PMD rules written in XPath for Apex and metadata XML, and ESLint rules for Lightning Web Components, JavaScript and TypeScript. The agent picks the engine, can start from code the user has selected, writes the rule and its configuration from bundled templates and scripts, checks that Code Analyzer recognises it, and tests it. Typical uses are banning System.debug, catching hard-coded IDs or enforcing naming and API version policies. Running scans and general configuration are other skills.
Capabilities
- Create regex rules for Code Analyzer
- Write PMD XPath rules for Apex or metadata
- Add ESLint rules for LWC and JavaScript
- Test that a custom rule is picked up
About
- Publisher
- Salesforce
- Tool
- Salesforce
Install
- Run this to add it to Any client:
npx skills add forcedotcom/sf-skills
What's inside
- assets/pmd-ruleset-template.xml
- examples/metadata-xml-example-fields-api.md
- examples/metadata-xml-example-flows.md
- examples/metadata-xml-example-permissions.md
- examples/metadata-xml-examples.md
- examples/regex-examples.md
- examples/xpath-examples.md
- references/advanced-pmd-patterns.md
- references/apex-ast-reference.md
- references/eslint-custom-plugins.md
- references/eslint-rules-discovery.md
- references/eslint-tier2-configurable.md
- references/eslint-tier3-custom-plugins.md
- references/metadata-xml-rules.md
- references/regex-rule-schema.md
- references/troubleshooting.md
- references/xpath-patterns-governor-limits.md
- references/xpath-patterns-method-calls.md
- references/xpath-patterns-security.md
- references/xpath-patterns-structure.md
- references/xpath-patterns.md
- scripts/create-pmd-rule.js
- scripts/create-regex-rule.js
MCP servers and skills can run code on your computer and act on your data. Review the source before installing.
This skill includes scripts that your agent may run.
Details
| Fact | Value | Source |
|---|---|---|
| Type | Skill | |
| Tool | Salesforce | |
| Publisher | Salesforce | source |
| Official status | OfficialSalesforce's developer documentation for its skills and plugins links to the forcedotcom/sf-skills repository | source |
| Needs an API key or sign-in | Not stated in its documentation | |
| Includes scripts | Yes | source |
| Platforms | Not stated in its documentation | |
| AI clients | Not stated in its documentation | |
| Licence | Apache-2.0 | source |
| Pricing | Not stated in its documentation | |
| Activity | Last commit Nov 6, 20261,156 GitHub starsDownload data not available (not on npm or PyPI) | source |
| Links | Repository |
Sources
- Skill file (SKILL.md)github.com/forcedotcom/sf-skillsNov 10, 2026
- README (README.md)github.com/forcedotcom/sf-skillsNov 13, 2026
- Licence file (LICENSE.txt)github.com/forcedotcom/sf-skills · Backs: Licence, PublisherNov 13, 2026
- Web pagedeveloper.salesforce.com · Backs: Official statusNov 13, 2026
- Folder in the repository (dx-code-analyzer-custom-rule-create)github.com/forcedotcom/sf-skills · Backs: Includes scriptsNov 10, 2026
- GitHub repositorygithub.com/forcedotcom/sf-skills · Backs: Activity, LicenceNov 11, 2026