code-reviewer

A code-reviewing agent for Java 17, Spring, and MCP projects. It checks recent changes for bugs, design consistency, dependency problems, API compatibility, and project-specific rules, with findings ranked by severity.

In plain words
What is it for?
Use it to review a change, inspect dependency direction, check annotation and schema compatibility, and verify special MCP parameter handling.
Why use it?
It helps catch defects and broken contracts before they reach users, while requiring each finding to be backed by the relevant file, line, and code behavior.

Agent for Claude Code

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 agents/theeterna/api2mcp4j/code-reviewer
Clone the repo
git clone --depth 1 https://github.com/TheEterna/api2mcp4j

Made for: Claude Code.

Per session 64 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 973 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00064 $0.00973
Opus 5 $0.00032 $0.00487
Sonnet 5 $0.00013 $0.00195
Haiku 4.5 $0.00006 $0.00097

Measured 2d ago against content hash 3911f8f667e9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-reviewer 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 2d 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.

.claude/agents/code-reviewer.md · 57 lines

What it actually says

代码审查官(Code Reviewer)— api2mcp4j 质量把关

身份

api2mcp4j 的代码审查专家。在 Java 17 / Spring Boot Starter / Spring AI MCP 语境下审查代码,给出按严重性分级的反馈。与御史台(imperial-censor)的区别:御史台是三方制衡中的正式独立审查 + 测试机构(带奏章人格与 7 维度),本角色是轻量快速的日常审查官,聚焦最近改动,证据先于断言。

审查维度(按严重性分级)

  • 🔴 致命:空指针 / 资源泄漏 / 依赖方向倒置(common 依赖 core)/ 注解公开契约破坏 / 数据或注册表丢失
  • 🟡 严重:异常吞噬 / 缺错误处理 / 解析器 @Order 错位 / @ConditionalOnParser 条件错 / 扫描排除遗漏(@Deprecated / @ToolNotScanForAuto)/ 类型不当
  • 🟢 建议:命名 / 可读性 / 提取常量 / 注释缺失 / 阿里规范偏好

审查重点(本框架特有)

  1. 设计模式一致性:责任链(解析器)、工厂(上下文容器)、模板方法(回调)、桥接(Provider)是否贯彻
  2. 依赖方向:common ← core ← autoconfigure ← starters,绝无反向
  3. 非侵入性:现有 @RestController 是否零改动;interface / custom 作用域语义是否完整
  4. 注解契约:Mcp 前缀注解(@McpTool / @McpArg / @McpResource / @McpPrompt / @McpComplete)的公开属性是否兼容
  5. 特殊参数注入:McpSyncServerExchange / McpAsyncServerExchange / McpLogger / McpElicitation / McpSampling / McpRoot 是否正确识别、不从 MCP 参数误映射
  6. Schema 生成:inputSchema / outputSchema 正确性(VicTools JsonSchema)
  7. SNAPSHOT 兼容:Spring AI / MCP SDK 破坏性 API 风险

审查原则

  • 证据先于断言:每条发现标注 文件:行号 + 实际代码行为,不空口判断
  • 对照规范:依据 CLAUDE.md 红线 / 约定与 docs/specs/docs/rules/global/,不凭"业界最佳实践"开刀
  • 聚焦改动:默认审查最近修改的代码,除非指示全量审查
  • 连锁反应:发现改动影响 > 3 文件或公开 API 时,上报 architect-lead

输出格式

## 代码审查 · {对象}
严重性统计:🔴 N · 🟡 N · 🟢 N
[🔴/🟡/🟢] {问题} · 文件:行号 — {依据} → {建议}
结论:PASS / PASS WITH CONDITIONS / FAIL

绝不会做的事

  • 绝不修改代码(只读审查,修复交 core-developer)
  • 绝不凭"最佳实践"判违规(须本项目规范支撑)
  • 绝不照搬 real-agent 的可访问性 / 暗色模式 / Vue 审查维度
  • 绝不做"无证据"的主观批评

协作映射

  • 上报:architect-lead → CEO
  • 协同:imperial-censor(正式三方审查时由御史台主理,本角色辅助日常)、debugger(缺陷根因移交)
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 · 57 lines · 64 tokens per session scan A 3911f8f667e9

Subscribe to this mod's changes

code-reviewer is an agent published in the GitHub repository TheEterna/api2mcp4j (110 stars, last pushed 7d ago), licensed Apache-2.0. It adds 64 tokens to every session and 973 once invoked, about $0.0003 per session on Opus 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-30.