formatting

formatting is a cursor rule for Cursor from GoranErhartic/cursor-development-rules. It costs 12 tokens per session (1,652 once invoked), scanned A, original, MIT.

Rules for formatting Java code, especially methods, constructors, fields, and annotations with multiple parameters. They define when to keep items on one line and when to put each item on its own line.

In plain words
What is it for?
They guide line breaks, parameter alignment, annotation layout, closing brackets, and the placement of annotated fields.
Why use it?
They make long declarations easier to read and keep formatting consistent across a codebase.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit They guide line breaks, parameter alignment, annotation layout, closing brackets, and the placement of annotated fields.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/goranerhartic/cursor-development-rules/formatting
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.

Clone the repo
git clone --depth 1 https://github.com/GoranErhartic/cursor-development-rules

Made for: Cursor.

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 formatting

README.md
[![agentmods](https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/formatting/github.svg)](https://agentmods.dev/rules/goranerhartic/cursor-development-rules/formatting)
Your own site
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/formatting"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/formatting/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.

agentmods 80×15 button for formatting

Your own site · 80×15
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/formatting"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/formatting.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,652 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00012 $0.01652
Opus 5.5 $0.00005 $0.00661
Sonnet 5.5 $0.00002 $0.00330
Haiku 4.5 $0.00001 $0.00165

Measured 1mo ago against content hash 46b8d0eb3f8a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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

.cursor/rules/languages/java/formatting.mdc · 221 lines

How it starts

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

Code Formatting Conventions

Parameter Alignment Rules

General Principle

When a method, constructor, or annotation has more than 2 parameters, place each parameter on its own line. For short parameter lists (1-2 params) that fit within the line width (120 chars), keep them on the same line.

Key Rules

  1. Every closing bracket on its own line - When an annotation/method is wrapped, the closing ) goes on a new line
  2. Each annotation on its own line - Multiple annotations on a parameter/field are each on separate lines
  3. Field/variable on its own line - After annotations, the field declaration goes on a new line

Annotations with Multiple Parameters

When an annotation has more than 2 parameters, wrap with each on its own line:

// GOOD - Each param and closing bracket on own line
@Schema(
		description = "ISO 6346 container number (4 uppercase letters + 7 digits)",
		example = "MSCU1234567",
		pattern = "^[A-Z]{4}[0-9]{7}$",
		minLength = 11,
		maxLength = 11,
		requiredMode = Schema.RequiredMode.REQUIRED
)
@NotBlank(message = "Container number is required")
@Size(min = 11, max = 11, message = "Container number must be exactly 11 characters")
@Pattern(
		regexp = "^[A-Z]{4}[0-9]{7}$",
		message = "Container number must be in ISO 6346 format (4 letters + 7 digits)"
)
String containerNumber;  // Field on its own line

// GOOD - Short annotation (fits on one line)
@Size(min = 11, max = 11)
@NotBlank(message = "Required")
String value;

Multiple Annotations on Parameters

Each annotation must be on its own line:

// GOOD - Each annotation on separate line, field at the end
@Schema(description = "Container number", example = "MSCU1234567")
@NotBlank(message = "Required")
@Size(min = 11, max = 11)
String containerNumber;

// BAD - Annotations chained on same line
@Schema(...) @NotBlank(...) @Size(...) String containerNumber;

Method Invocations

When a method call has more than 2 arguments, wrap each on its own line with closing paren on its own line:

Read the full file on GitHub · 221 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. 1mo ago First seen · 221 lines · 12 tokens per session scan A 46b8d0eb3f8a

Subscribe to this mod's changes

formatting is a cursor rule published in the GitHub repository GoranErhartic/cursor-development-rules (19 stars, last pushed 7mo ago), licensed MIT. It adds 12 tokens to every session and 1,652 once invoked, about $0.0000 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-30.