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.
git clone --depth 1 https://github.com/xc404/kiwiWrote 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.
[](https://agentmods.dev/rules/xc404/kiwi/java-minimize-static-methods)<a href="https://agentmods.dev/rules/xc404/kiwi/java-minimize-static-methods"><img src="https://agentmods.dev/badge/rules/xc404/kiwi/java-minimize-static-methods/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.
<a href="https://agentmods.dev/rules/xc404/kiwi/java-minimize-static-methods"><img src="https://agentmods.dev/badge/rules/xc404/kiwi/java-minimize-static-methods.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00588 | $0.00588 |
| Opus 5.5 | $0.00235 | $0.00235 |
| Sonnet 5.5 | $0.00118 | $0.00118 |
| Haiku 4.5 | $0.00059 | $0.00059 |
Grade A, and why
java-minimize-static-methods 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 1mo 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.
What it actually says
尽量少实现静态方法(Java)
在本仓库的 Java 代码中,优先使用实例方法;通过构造注入或 Spring 注入协作对象,便于测试与扩展。避免在普通业务类、服务类、组件类中堆砌 static 方法。
例外:工具类
以下情形可使用 仅含静态 API 的风格(常见命名如 *Utils、*Helper,或 final 类 + private 构造器):
- 纯函数式、无状态的通用转换、格式化、校验、集合/字符串小工具;
- 明确设计为 library-style 的可复用静态入口,且不携带 Spring 生命周期或可变全局状态。
不推荐
public class OrderService {
public static void validate(Order o) { ... }
public static BigDecimal calcTax(Order o) { ... }
}
推荐
@Component
public class OrderService {
public void validate(Order o) { ... }
public BigDecimal calcTax(Order o) { ... }
}
或把纯算法抽到 OrderTaxUtils 等 命名清晰的工具类,而不是在领域服务上挂 static。
private static 与普通类里的静态方法
在 业务类、服务类、组件类 等「常规类」中:
- 不要为了整理结构而写
private static辅助方法:与公开静态 API 一样,优先改成private实例方法(不依赖注入时同样是实例方法,便于与类内其它逻辑一致、子类可覆盖(若需要)、测试时也可替换)。 - 没有必要时,生成代码阶段就不要引入静态方法;若逻辑是纯函数且会在多处复用,再 抽到专用的
*Utils/*Helper,而不是留在当前类里用static。
简言之:要么实例方法,要么独立工具类;常规类内 static 方法(含 private static)默认不写。
与 static final 常量
本规则针对 方法;static final 常量命名仍遵循仓库内 Java 常量约定(见 java-enum-static-constants-naming)。
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.
- 1mo ago First seen · 51 lines · 588 tokens per session scan A 048f852cb564
java-minimize-static-methods is a cursor rule published in the GitHub repository xc404/kiwi (7 stars, last pushed 1mo ago), licensed MIT. It adds 588 tokens to every session, about $0.0024 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.
Other cursor rules, from other repositories
java-brutal-audit
Phase-based brutal audit workflow for Java 17/21 projects - on-demand architectural review.
java-backend
Java Backend Execution Agent (Spring Boot / Quarkus).
java-brutal-audit
Phase-based brutal audit workflow for Java 17/21 projects - on-demand architectural review.
move-copy-semantics
Avoid std::move(const&) silent copies; use sink-by-value + std::move.
mockito
This guide provides definitive best practices for writing robust, maintainable, and readable unit tests using Mockito with JUnit 5, focusing on modern patterns and common pitfalls.
springboot-jpa-best-practices
A set of Chinese-language rules for structuring Java Spring Boot applications that use JPA, a library for database access.