code-quality-mentor
A Claude Code plugin that turns PMD warnings and an LLM-based antipattern scan into a personalized learning plan for one developer on a team.
PMD tells you what mechanical issues are in the code. The bundled catalog of antipatterns and code smells drives an LLM scan that catches design-level problems PMD's rule engine cannot reach: God classes, feature envy, primitive obsession, temporal coupling, and so on. git blame tells you who wrote the lines. The plugin closes the loop: it picks one author, derives their characteristic blind spots from the merged findings on their lines, and writes a tailored LEARNING_PLAN.md that leads with the underlying design principle and uses the author's actual code as evidence.
What it does
The plugin provides one slash command:
/code-quality-mentor:scan
The workflow runs end to end on the enclosing git repository:
- Detects which PMD-supported languages are present, using GitHub Linguist (or
enry).
- Runs
pmd check with sensible default rulesets for each detected language.
- Asks whether to run the LLM antipattern scan. When you say yes, Claude reads the bundled catalog (
skills/scan/assets/antipatterns.json) and looks across the PMD-flagged files (plus a sample of the largest source files) for the design smells PMD does not detect. It emits findings in PMD-shape JSON.
- Merges PMD and LLM-scan findings into a single report (or uses PMD alone when you skip the LLM scan).
- Attributes every finding's first line to a
git blame author.
- Asks you to pick one developer from the list, sorted by finding count.
- Asks three tailoring questions: depth, focus area, and seniority framing.
- Writes
LEARNING_PLAN.md at the repo root: a 3-to-5-minute read covering the developer's top 3 to 5 issues. Each section leads with the underlying design principle (named refactoring, "tell don't ask", "fail fast", and so on), explains why it matters, and uses one verbatim snippet from the developer's flagged code as evidence. The concept paragraph is the longest paragraph; code illustrates the idea, never carries it.
Intermediate JSON reports live under .code-quality-mentor/. The plugin never modifies your source code.
The antipattern catalog
The LLM scan is driven by plugins/code-quality-mentor/skills/scan/assets/antipatterns.json, a curated catalog of antipatterns and code smells. Each entry has an id, family (Bloaters, OO Abusers, Change Preventers, Dispensables, Couplers, Architecture), description, concrete detection signals, language-specific notes, named refactoring, and canonical references (book chapters, Fowler bliki pages, papers, talks; every reference carries a resolvable URL).
The catalog ships with the plugin. End users do not edit it; they consume it through /code-quality-mentor:scan. Plugin maintainers update it via the script at plugins/code-quality-mentor/scripts/update_catalog.sh; see docs/CATALOG.md for the maintenance workflow.
Supported languages
Every language for which PMD ships a rule-based ruleset (verified against the PMD 7 rule reference):
Apex, HTML, Java, Java Server Pages, JavaScript, Kotlin, Maven POM, Modelica, PLSQL, Scala, Swift, Velocity Template Language, Visualforce, WSDL, XML, XSLT (the names match the Linguist language IDs used by skills/scan/assets/pmd-languages.json).
The plugin does not analyze languages that PMD parses for CPD (copy-paste detection) only: C/C++, C#, CSS, Dart, Fortran, Gherkin, Go, Groovy, Julia, Lua, Matlab, Objective-C, Perl, PHP, Python, Ruby, Rust, T-SQL, Coco. CPD finds duplication, not the rule-based warnings this plugin teaches from.
The language-to-ruleset map lives at plugins/code-quality-mentor/skills/scan/assets/pmd-languages.json and is straightforward to edit if you want a stricter or laxer default per language.
Prerequisites
| Tool | Why | Install (macOS) |
|---|
java (>=11) | PMD runtime | brew install temurin |
pmd (>=7) | Source-level static analyzer | brew install pmd |
jq | JSON manipulation in the helper scripts | brew install jq |
git | Repository history and git blame | xcode-select --install |
github-linguist or enry | Language detection in the repo | gem install github-linguist or brew install enry |
Contributors who want to run the test suite also need bats-core (brew install bats-core).