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.
npx agentmods add rules/xc404/kiwi/java-minimize-static-methodsgit clone --depth 1 https://github.com/xc404/kiwiWhat 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 | $0.00588 | $0.00588 |
| Opus 5 | $0.00294 | $0.00294 |
| Sonnet 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 yesterday.
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.
- yesterday 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 7d ago), licensed MIT. It adds 588 tokens to every session, about $0.0029 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-31.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.