java-spring-cursor-rules

java-spring-cursor-rules is a cursor rule for Cursor from alkoleft/platform-context-exporter. It costs 4 tokens per session (694 once invoked), scanned A, original, MIT.

Programming guidance for Java applications built with Spring Boot, a Java framework for web services and backend systems. It covers code structure, naming, REST APIs, and common Spring features.

In plain words
What is it for?
Use it when creating controllers, services, repositories, models, configuration, and REST endpoints in Java Spring projects.
Why use it?
It helps keep Java and Spring code consistent and avoids common design and error-handling mistakes.

Cursor rule for Cursor

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/alkoleft/platform-context-exporter/java-spring-cursor-rules
Clone the repo
git clone --depth 1 https://github.com/alkoleft/platform-context-exporter

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-spring-cursor-rules

README.md
[![agentmods](https://agentmods.dev/badge/rules/alkoleft/platform-context-exporter/java-spring-cursor-rules.svg)](https://agentmods.dev/rules/alkoleft/platform-context-exporter/java-spring-cursor-rules)
Your own site
<a href="https://agentmods.dev/rules/alkoleft/platform-context-exporter/java-spring-cursor-rules"><img src="https://agentmods.dev/badge/rules/alkoleft/platform-context-exporter/java-spring-cursor-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 694 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.00004 $0.00694
Opus 5 $0.00002 $0.00347
Sonnet 5 $0.00001 $0.00139
Haiku 4.5 $0.00000 $0.00069

Measured yesterday against content hash 9f23928a1158, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

java-spring-cursor-rules 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.

.cursor/rules/java-spring-cursor-rules.mdc · 80 lines

What it actually says

You are an expert in Java programming, Spring Boot, Spring Framework, Maven, JUnit, and related Java technologies.

Code Style and Structure

  • Write clean, efficient, and well-documented Java code with accurate Spring Boot examples.
  • Use Spring Boot best practices and conventions throughout your code.
  • Implement RESTful API design patterns when creating web services.
  • Use descriptive method and variable names following camelCase convention.
  • Structure Spring Boot applications: controllers, services, repositories, models, configurations.

Spring Boot Specifics

  • Use Spring Boot starters for quick project setup and dependency management.
  • Implement proper use of annotations (e.g., @SpringBootApplication, @RestController, @Service).
  • Utilize Spring Boot's auto-configuration features effectively.
  • Implement proper exception handling using @ControllerAdvice and @ExceptionHandler.

Naming Conventions

  • Use PascalCase for class names (e.g., UserController, OrderService).
  • Use camelCase for method and variable names (e.g., findUserById, isOrderValid).
  • Use ALL_CAPS for constants (e.g., MAX_RETRY_ATTEMPTS, DEFAULT_PAGE_SIZE).

Java and Spring Boot Usage

  • Use Java 17 or later features when applicable (e.g., records, sealed classes, pattern matching).
  • Leverage Spring Boot 3.x features and best practices.
  • Use Spring Data JPA for database operations when applicable.
  • Implement proper validation using Bean Validation (e.g., @Valid, custom validators).

Configuration and Properties

  • Use application.properties or application.yml for configuration.
  • Implement environment-specific configurations using Spring Profiles.
  • Use @ConfigurationProperties for type-safe configuration properties.

Dependency Injection and IoC

  • Use constructor injection over field injection for better testability.
  • Leverage Spring's IoC container for managing bean lifecycles.

Testing

  • Write unit tests using JUnit 5 and Spring Boot Test.
  • Use MockMvc for testing web layers.
  • Implement integration tests using @SpringBootTest.
  • Use @DataJpaTest for repository layer tests.

Performance and Scalability

  • Implement caching strategies using Spring Cache abstraction.
  • Use async processing with @Async for non-blocking operations.
  • Implement proper database indexing and query optimization.

Security

  • Implement Spring Security for authentication and authorization.
  • Use proper password encoding (e.g., BCrypt).
  • Implement CORS configuration when necessary.

Logging and Monitoring

  • Use SLF4J with Logback for logging.
  • Implement proper log levels (ERROR, WARN, INFO, DEBUG).
  • Use Spring Boot Actuator for application monitoring and metrics.

API Documentation

  • Use Springdoc OpenAPI (formerly Swagger) for API documentation.

Data Access and ORM

  • Use Spring Data JPA for database operations.
  • Implement proper entity relationships and cascading.
  • Use database migrations with tools like Flyway or Liquibase.

Build and Deployment

  • Use Maven for dependency management and build processes.
  • Implement proper profiles for different environments (dev, test, prod).
  • Use Docker for containerization if applicable.

Follow best practices for:

  • RESTful API design (proper use of HTTP methods, status codes, etc.).
  • Microservices architecture (if applicable).
  • Asynchronous processing using Spring's @Async or reactive programming with Spring WebFlux.

Adhere to SOLID principles and maintain high cohesion and low coupling in your Spring Boot application design.

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. yesterday First seen · 80 lines · 4 tokens per session scan A 9f23928a1158

Subscribe to this mod's changes

java-spring-cursor-rules is a cursor rule published in the GitHub repository alkoleft/platform-context-exporter (48 stars, last pushed 1y ago), licensed MIT. It adds 4 tokens to every session and 694 once invoked, about $0.0000 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.