dx-code-analyzer-custom-rule-create

dx-code-analyzer-custom-rule-create is a skill for Claude Code from forcedotcom/sf-skills. It costs 228 tokens per session (9,630 once invoked), scanned C, original, Apache-2.0.

A rule-authoring tool for Salesforce Code Analyzer, which checks Apex, metadata XML, JavaScript, and TypeScript for patterns your team defines.

In plain words
What is it for?
Use it to write regular-expression, PMD, or ESLint rules that enforce coding standards and metadata governance.
Why use it?
It catches project-specific problems that built-in checks do not cover, such as banned patterns, hardcoded values, or missing metadata details.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the salesforce-development plugin — 37 skills, 13 commands, 2 agents, 3 MCP servers shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/forcedotcom/sf-skills/dx-code-analyzer-custom-rule-create
Any agent
npx skills add forcedotcom/sf-skills --skill dx-code-analyzer-custom-rule-create
Clone the repo
git clone --depth 1 https://github.com/forcedotcom/sf-skills

Made for: Claude Code.

Or install salesforce-development, the plugin that ships this one along with the rest of its 37 skills, 13 commands, 2 agents, 3 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dx-code-analyzer-custom-rule-create

README.md
[![agentmods](https://agentmods.dev/badge/skills/forcedotcom/sf-skills/dx-code-analyzer-custom-rule-create.svg)](https://agentmods.dev/skills/forcedotcom/sf-skills/dx-code-analyzer-custom-rule-create)
Your own site
<a href="https://agentmods.dev/skills/forcedotcom/sf-skills/dx-code-analyzer-custom-rule-create"><img src="https://agentmods.dev/badge/skills/forcedotcom/sf-skills/dx-code-analyzer-custom-rule-create.svg" alt="Measured on agentmods" height="20"></a>
Per session 228 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 9,630 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00228 $0.09630
Opus 5 $0.00114 $0.04815
Sonnet 5 $0.00046 $0.01926
Haiku 4.5 $0.00023 $0.00963

Measured 2d ago against content hash 5c52e68e9bd3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade C, and why

dx-code-analyzer-custom-rule-create scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/create-pmd-rule.js, scripts/create-regex-rule.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

8. **Cleanup** — delete ALL sample files AND their parent directories (LWC requires a folder per component). Use `rm -rf <directory>`, not just `rm <file>`. Do not leave empty directories or temporary test fixtures in th
plugins/builder/salesforce-development/skills/dx-code-analyzer-custom-rule-create/SKILL.md · 488 lines

How it starts

The opening of the file, as written. The whole thing — 488 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Use dx-code-analyzer-custom-rule-create when the work involves:

  • Creating a new custom rule for Code Analyzer (any engine)
  • Enforcing team-specific coding standards via static analysis
  • Banning specific patterns (System.debug, hardcoded IDs, TODOs)
  • Writing XPath expressions for PMD rules (Apex or metadata XML)
  • Writing regex patterns for the Regex engine
  • Setting up custom ESLint rules/plugins for LWC/JavaScript
  • Enforcing metadata governance (API versions, field descriptions, dangerous permissions)
  • Overriding built-in rule thresholds (CyclomaticComplexity, ExcessiveParameterList, etc.)
  • Organizing multiple rules into shared rulesets
  • Iterating on a custom rule that isn't matching correctly

Delegate elsewhere when the user is:

  • Running a scan against existing rules → dx-code-analyzer-run skill
  • Configuring engines, prerequisites, CI/CD → dx-code-analyzer-configure skill
  • Explaining what an existing built-in rule means → dx-code-analyzer-run skill
  • Writing Apex code or tests → generating-apex / running-apex-tests skills

Required Context to Gather First

Ask for or infer:

  • What pattern to catch — what code should be flagged? (If user selected code in their IDE, the selection IS the answer — do not re-ask.)
  • What to allow — any exceptions? (test classes, specific contexts)
  • File scope — which file types? (.cls, .trigger, .js, all?)
  • Severity — how critical? (default: 3/Moderate)

Read the full file on GitHub · 488 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 488 lines · 228 tokens per session scan C 5c52e68e9bd3

Subscribe to this mod's changes

dx-code-analyzer-custom-rule-create is a skill published in the GitHub repository forcedotcom/sf-skills (964 stars, last pushed yesterday), licensed Apache-2.0. It adds 228 tokens to every session and 9,630 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens

chronicle

Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…

microsoft/vscode · 72 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens