p3c-guard
Reviewed
at commit 450bb83
Caution: Downloads a PMD jar from Maven Central into ~/.cache/p3c-guard on first Java write and runs it with java on every .java file Claude writes or edits.
Refuses a Write or Edit to a Java file when it would add a violation of the Alibaba Java Coding Guidelines (p3c), and hands the rule, line and fix back to…
0 upvotes
Log in to upvote or save- Made by
- alexlifexyz
- Pinned commit
-
450bb83d6274e233e575c59d780a0825074a2d70 - What we checked
-
Blocks Claude's Write and Edit calls on .java files when the change would add new Alibaba p3c rule violations, and tells Claude what to fix. On first use it downloads a pinned rule-checker jar from Maven Central and runs it locally with java; your code stays on your machine. /p3c shows status or pauses it.
Review details
Static review of the source at the pinned commit; not run. Registers session.start (the /p3c command), command.run, and tool.call for Write and Edit, each with a catch that lets the call through on failure. For .java files it computes the file text after the edit, writes before/after copies to ~/.cache/p3c-guard/work/<tool_use_id>, runs 'java -jar p3c-pmd-jdk21-3.0.1-cli.jar check' with the Alibaba ruleset, then deletes the temporary folder, and denies the call when the new text adds violations at or above the configured level (1 to 3). The jar is fetched once with curl from repo1.maven.org, checked against a hard-coded SHA-256 (the checksum is verified before the file is moved into place; a mismatch deletes it), and reused afterwards. The first Java write on a machine is not checked while the download runs. Runtime calls: $.env.get(HOME), $.fs.read, $.fs.exists, $.fs.write, $.process.run (mkdir, curl, sh with sha256sum or shasum, mv, rm, java), $.ui.status, $.command.register. The only network request is the jar download, which carries no user data. The change since the previous review is a checksum fallback to sha256sum plus README text. npm dependencies: none; the jar and java were not reviewed.
- What it uses
-
- Reads your prompts: no
- Sees tool calls: yes
- Blocks or changes tool calls: yes
- Reads or writes files: yes
- Runs programs on your machine: yes
- Calls the model (uses tokens): no
- Sends data over the network: yes
- Stores data: no
- Shows something on screen: yes
Agent 写 Java 时,新增的阿里 Java 规约(p3c)违规落不了盘。Blocks Java writes that add Alibaba p3c violations.
Made this mod? Add a badge to your README
Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.
[](https://modsforclaude.com/mods/p3c-guard/)