pmd

pmd is a skill for Claude Code from alexmond/alexmskills. It costs 110 tokens per session (2,782 once invoked), scanned A, original, MIT.

A procedure for setting up and investigating PMD, a Java static-analysis tool that finds likely defects and design problems in Maven projects. It covers Maven wiring, reports, rule priorities, duplicate code, and suppressions.

In plain words
What is it for?
Use it to run PMD for a whole project or module, inspect findings, handle copy-paste reports, and suppress justified violations.
Why use it?
It separates probable code problems from formatting issues and helps explain why a Maven build fails PMD checks.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the maven-quality plugin — 4 skills shipped together

Good fit Use it to run PMD for a whole project or module, inspect findings, handle copy-paste reports, and suppress justified violations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexmond/alexmskills/pmd
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.

Any agent
npx skills add alexmond/alexmskills --skill pmd
Clone the repo
git clone --depth 1 https://github.com/alexmond/alexmskills

Made for: Claude Code.

Or install maven-quality, the plugin that ships this one along with the rest of its 4 skills.

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 pmd

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexmond/alexmskills/pmd/github.svg)](https://agentmods.dev/skills/alexmond/alexmskills/pmd)
Your own site
<a href="https://agentmods.dev/skills/alexmond/alexmskills/pmd"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/pmd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pmd

Your own site · 80×15
<a href="https://agentmods.dev/skills/alexmond/alexmskills/pmd"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/pmd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 110 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,782 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high YARA Match · line 3
    YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
    Fix: Remove offensive tool references and exploit code. Legitimate agent skills should not contain penetration testing tools, exploit frameworks, or reconnaissance utilities.
  • high Prompt Injection · line 152
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
How audits are shown
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.00110 $0.02782
Opus 5.5 $0.00044 $0.01113
Sonnet 5.5 $0.00022 $0.00556
Haiku 4.5 $0.00011 $0.00278

Measured 3mo ago against content hash 21e8858d55c1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pmd scanned grade A with 0 findings 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 3mo ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/maven-quality/skills/pmd/SKILL.md · 251 lines

How it starts

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

PMD static analysis for Maven/Java

Try it: /maven-quality:pmd payment-service — or say "what's PMD complaining about?".

PMD finds defects and design smells, which is a different job from formatting. Keep it distinct from the codestyle skill: spring-javaformat and Checkstyle decide how code should look, PMD decides whether it is likely wrong.

Defaults below target a project with maven-pmd-plugin bound to validate, producing target/pmd.xml. Adjust module names, phases, and paths to match.

Adjusting for your project

  • Maven invocation: examples use the wrapper ./mvnw. Without one, substitute your mvn binary.
  • Multi-module: scope with -pl <module>; each module writes its own target/pmd.xml.
  • $ARGUMENTS (when present) is either a module name (Steps 1–3) or a rule name to explain and suppress (Step 6).

Step 1: Run it

./mvnw pmd:check -q                    # whole project, fails on violation
./mvnw pmd:check -pl $ARGUMENTS -q     # one module
./mvnw pmd:pmd -q                      # report only, never fails the build

pmd:check re-runs the analysis, so there is no need to run pmd:pmd first. When the build is already wired to validate, ./mvnw validate does the same.

Step 2: Read the report, not the console

The console output truncates and reorders. target/pmd.xml is the whole truth.

The namespace is the trap. The report is namespaced (http://pmd.sourceforge.net/report/2.0.0), so a plain findall("file") silently returns nothing and the report looks clean. Match on local names instead — that also survives PMD changing the namespace between majors:

Stdlib ElementTree is deliberate — these skills add no dependencies. It refuses external entities outright, so XXE does not apply; it is susceptible to entity- expansion blowup, which is irrelevant for a file your own build just wrote. If you ever point this at a report from an untrusted source, use defusedxml instead.

import xml.etree.ElementTree as ET, sys, collections, pathlib

def local(el):                      # '{ns}violation' -> 'violation'
    return el.tag.rsplit('}', 1)[-1]

rows = []
for report in pathlib.Path('.').glob('**/target/pmd.xml'):
    for f in ET.parse(report).getroot():
        if local(f) != 'file':
            continue
        name = f.get('name', '').split('/src/main/java/')[-1]
        for v in f:
            if local(v) != 'violation':
                continue
            rows.append((int(v.get('priority', 5)), v.get('rule'),
                         v.get('ruleset'), name, v.get('beginline'),
                         ' '.join((v.text or '').split())))

if not rows:
    print('  no violations'); sys.exit()
print(f'  {len(rows)} violations\n')
for rule, n in collections.Counter(r[1] for r in rows).most_common():
    pri = min(r[0] for r in rows if r[1] == rule)
    print(f'  p{pri}  {n:>4}  {rule}')

Read the full file on GitHub · 251 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. 3mo ago First seen · 251 lines · 110 tokens per session scan A 21e8858d55c1

Subscribe to this mod's changes

pmd is a skill published in the GitHub repository alexmond/alexmskills (11 stars, last pushed 1mo ago), licensed MIT. It adds 110 tokens to every session and 2,782 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

pmd compared with skills from other repositories

pmd next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pmdalexmond/alexmskillsSkill111mo agoMITA110Claude Code
async-profilerumit/skillsSkill77mo agoMITA198Claude Code, Codex
java-perf-checkducpm2303/claude-java-pluginsSkill177mo agononeA56Claude Code
java-fixducpm2303/claude-java-pluginsSkill177mo agononeA46Claude Code
java-coding-standardsaffaan-m/ECCSkill313k7d agoMITA50Claude Code, Kiro
jpa-patternsaffaan-m/ECCSkill313k7d agoMITA33Claude Code, Kiro
nullawaychromium/chromiumSkill25ktodayBSD-3-ClauseA43Claude Code, Codex