java-general-purpose-cursorrules-prompt-file

java-general-purpose-cursorrules-prompt-file is a cursor rule for Cursor from PatrickJS/awesome-cursorrules. It costs 1,462 tokens per session, scanned A, original, CC0-1.0.

A broad set of Java development guidelines covering design principles, project configuration, dependencies, object creation, methods, testing, and performance.

In plain words
What is it for?
Use it for general Java projects built with Maven, including application design, dependency use, testing, benchmarking, and everyday coding decisions.
Why use it?
It gives the assistant a consistent foundation for making Java code clearer, safer, easier to maintain, and less wasteful.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

About the project

PatrickJS/awesome-cursorrules is a collection of Markdown rule files that give Cursor AI editor project-specific instructions about code, frameworks, workflows, and standards. Developers use it to find reusable guidance for shaping Cursor’s behavior in different kinds of software projects.

PatrickJS/awesome-cursorrules · 40,725 stars · on GitHub

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 rules/patrickjs/awesome-cursorrules/java-general-purpose-cursorrules-prompt-file
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules

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 java-general-purpose-cursorrules-prompt-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/java-general-purpose-cursorrules-prompt-file.svg)](https://agentmods.dev/rules/patrickjs/awesome-cursorrules/java-general-purpose-cursorrules-prompt-file)
Your own site
<a href="https://agentmods.dev/rules/patrickjs/awesome-cursorrules/java-general-purpose-cursorrules-prompt-file"><img src="https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/java-general-purpose-cursorrules-prompt-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,462 This file is loaded in full into every session.
When invoked 1,462 The same file — it is already loaded in full.
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.1 $0.01462 $0.01462
Opus 5 $0.00731 $0.00731
Sonnet 5 $0.00292 $0.00292
Haiku 4.5 $0.00146 $0.00146

Measured 2d ago against content hash 4b7d9b52232c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

java-general-purpose-cursorrules-prompt-file 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

rules/java-general-purpose-cursorrules-prompt-file.mdc · 194 lines

How it starts

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

Project Configuration

file_location: root_directory file_name: .cursorrules

AI Developer Profile

ai_persona: role: Senior Java Developer principles: - SOLID - DRY - KISS - YAGNI - OWASP - DOP - FP - DDD

Technical Stack

tech_stack: framework: none build_tool: Maven java_version: 24 dependencies: - Eclipse Collections - Commons Lang3 - Guava - VAVR - Junit5 - JQwik - JMH language: English code_comments: English

Development Guidelines

effective_java_notes: chapter_2: title: "Creating and Destroying Objects" items: - "Consider static factory methods instead of constructors" - "Consider a builder when faced with many constructor parameters" - "Enforce the singleton property with a private constructor or an enum type" - "Enforce noninstantiability with a private constructor" - "Prefer dependency injection to hardwiring resources" - "Avoid creating unnecessary objects" - "Eliminate obsolete object references" - "Avoid finalizers and cleaners" - "Prefer try-with-resources to try-finally"

chapter_3: title: "Methods Common to All Objects" items: - "Obey the general contract when overriding equals" - "Always override hashCode when you override equals" - "Always override toString" - "Override clone judiciously" - "Consider implementing Comparable"

chapter_4: title: "Classes and Interfaces" items: - "Minimize the accessibility of classes and members" - "In public classes, use accessor methods, not public fields" - "Minimize mutability" - "Favor composition over inheritance" - "Design and document for inheritance or else prohibit it" - "Prefer interfaces to abstract classes" - "Design interfaces for posterity" - "Use interfaces only to define types" - "Prefer class hierarchies to tagged classes" - "Favor static member classes over nonstatic" - "Limit source files to a single top-level class"

Read the full file on GitHub · 194 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. 2d ago First seen · 194 lines · 1,462 tokens per session scan A 4b7d9b52232c

Subscribe to this mod's changes

java-general-purpose-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,725 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,462 tokens to every session, about $0.0073 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-09-03.