java-style

java-style is an agent for coding agents from martin-francois/symphony-trello. It costs 0 tokens per session (7,299 once invoked), scanned A, original, Apache-2.0.

A set of preferences for writing Java in a particular repository, including formatting, language features, code reuse, and error handling. It also describes when to use tools such as Spotless and PMD, which check Java style and code quality.

In plain words
What is it for?
Use it when adding or reshaping Java code, choosing newer Java features, handling text files, deciding whether to reuse or simplify code, and preparing changes for static analysis.
Why use it?
It gives contributors consistent decisions about how Java code should look and behave. This reduces formatting disagreements, avoidable complexity, and inconsistent handling of character encodings or exceptions.

Agent

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/martin-francois/symphony-trello/java-style
Clone the repo
git clone --depth 1 https://github.com/martin-francois/symphony-trello

Wrote 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.

agentmods badge for java-style

README.md
[![agentmods](https://agentmods.dev/badge/agents/martin-francois/symphony-trello/java-style.svg)](https://agentmods.dev/agents/martin-francois/symphony-trello/java-style)
Your own site
<a href="https://agentmods.dev/agents/martin-francois/symphony-trello/java-style"><img src="https://agentmods.dev/badge/agents/martin-francois/symphony-trello/java-style.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 7,299 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.00000 $0.07299
Opus 5 $0.00000 $0.03649
Sonnet 5 $0.00000 $0.01460
Haiku 4.5 $0.00000 $0.00730

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

Security

Grade A, and why

java-style 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 4d 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.

docs/agents/java-style.md · 436 lines

How it starts

The opening of the file, as written. The whole thing — 436 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Java style & design preferences

Scope

How to write and shape Java code in this repository: formatting, language-feature use, complexity and reuse tradeoffs, and exception handling. Static-analysis tooling has its own page; see References.

Formatting and language

  • Let Spotless handle formatting and import cleanup. Use spotless:apply before verifying when formatting changed.
  • Use imports instead of inline fully qualified type names. Write Arrays.stream(...), not java.util.Arrays.stream(...). PMD enforces this with the narrow UnnecessaryFullyQualifiedName rule.
  • Prefer the Java file APIs' specified UTF-8 defaults for Files.readString, Files.readAllLines, and Files.writeString. Keep an explicit charset for APIs that otherwise use the platform default and for protocol conversions whose byte encoding is part of the contract.
  • Use Java 25 LTS language/runtime features where they make the code clearer, but do not be clever for its own sake.
  • Keep code ASCII unless an existing file or domain requirement clearly needs Unicode.
  • Give Java Unicode escapes used as character data a domain name before use, including escapes in literals, regular expressions, fixtures, and similar data. Bind \\uXXXX syntax to a constant whose name identifies the character or intentional character group, and use that constant at call sites and in test scenario tables. Search for the same code point before adding a constant so coupled validation and rendering rules share one definition instead of accumulating parallel escapes. This rule does not apply to escapes shown only in identifiers or explanatory comments.
  • Avoid unrelated metadata churn and broad rewrites.

Reuse and dependency selection

  • Before writing or retaining hand-made utility logic, search the Java 25 API and the APIs of dependencies declared directly in pom.xml. Start with the operation's owning type rather than a generic helper: for example, check Process and Thread for Duration overloads, String for bounded searches, Files.walkFileTree for recursive file lifecycle work, sequenced collections for first/last or reversed views, and the compiler tree API before scanning Java syntax. In tests, also check the exact AssertJ API before maintaining custom assertion loops. Prefer these APIs when they state the same contract directly and remove conversion, restoration, parser, or accumulator machinery.
  • Resolve the version actually used by Maven and consult that version's official API documentation or Javadocs before adopting an overload or dependency method whose behavior is subtle. Verify null rejection, empty-input behavior, encounter order, defensive-copy and mutability guarantees, end-exclusive bounds, timeout precision, interruption, exception cleanup, symlink traversal, and short-circuiting as applicable. Add a focused regression at that boundary. A similarly named API is not a replacement when it changes one of those properties; retain explicit local code and record the concrete mismatch instead.
  • Prefer a well-maintained dependency over hand-written infrastructure when it materially reduces code or complexity and the resulting API remains readable. Do not reject a library merely because it adds a dependency; compare the whole implementation, operational, security, and maintenance cost against keeping the custom code.
  • A new library candidate must have an upstream release within the previous 12 months, an unarchived repository, no deprecation or unmaintained notice, an open-source license compatible with this project, and at least 100 GitHub stars. Verify each condition from current primary sources when making the recommendation rather than relying on remembered metadata.
  • Also evaluate Java compatibility, security history, API stability, transitive dependency size, platform coverage, and native/runtime requirements. A candidate that meets the minimum activity, license, and popularity bar may still be rejected when it increases operational complexity or does not replace enough custom behavior; record that concrete trade-off in the issue or review.
  • Before adding a dependency, inspect existing declared dependencies and the Java standard library for the same capability. Do not couple source code to an undeclared transitive dependency. Treat a new runtime or build dependency as an architecture decision when its lifecycle or platform impact is non-trivial, and update the owning ADR or add one when required by the ADR policy.
  • Guava is a directly declared dependency. Before writing or retaining small character-boundary loops, delimiter-only regex splitting, null-to-empty String adapters, immutable collection collectors, or manually capped FIFO queues, check the matching Guava API (CharMatcher, Splitter, Strings, immutable collectors, or EvictingQueue) against the exact resolved Guava version. Use it when it removes custom mechanism and makes the intended semantics more obvious. Preserve the original contract explicitly: Splitter keeps empty fields unless configured not to; CharMatcher operates on UTF-16 characters and must not replace a code-point or domain-specific Unicode parser; Strings.nullToEmpty is for immediate String normalization, not for erasing a meaningful nullable state; and immutable or bounded collections must preserve order, duplicate, null, and mutation behavior. Prefer the JDK or focused custom code when the Guava form is longer, less domain-specific, or semantically different; do not perform broad mechanical collection churn.

Read the full file on GitHub · 436 lines

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. 4d ago First seen · 436 lines · 0 tokens per session scan A 42c267bffa7d

Subscribe to this mod's changes

java-style is an agent published in the GitHub repository martin-francois/symphony-trello (1 stars, last pushed 4d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 7,299 tokens. 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.