302-frameworks-spring-boot-rest

302-frameworks-spring-boot-rest is a cursor rule for Cursor from jabrena/cursor-rules-spring-boot. It costs 0 tokens per session (6,495 once invoked), scanned A, original, Apache-2.0.

A set of guidelines for designing REST APIs with Spring Boot. REST APIs let software exchange data over HTTP using predictable URLs, methods, responses, and status codes.

In plain words
What is it for?
Use it to design resource URLs, choose HTTP methods and status codes, define request and response data, handle errors, secure endpoints, version APIs, and document them.
Why use it?
It helps prevent inconsistent interfaces, unclear errors, security gaps, and changes that break existing users. The rules promote clear contracts and planned API evolution.

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/jabrena/cursor-rules-spring-boot/302-frameworks-spring-boot-rest
Clone the repo
git clone --depth 1 https://github.com/jabrena/cursor-rules-spring-boot

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 302-frameworks-spring-boot-rest

README.md
[![agentmods](https://agentmods.dev/badge/rules/jabrena/cursor-rules-spring-boot/302-frameworks-spring-boot-rest.svg)](https://agentmods.dev/rules/jabrena/cursor-rules-spring-boot/302-frameworks-spring-boot-rest)
Your own site
<a href="https://agentmods.dev/rules/jabrena/cursor-rules-spring-boot/302-frameworks-spring-boot-rest"><img src="https://agentmods.dev/badge/rules/jabrena/cursor-rules-spring-boot/302-frameworks-spring-boot-rest.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 6,495 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.06495
Opus 5 $0.00000 $0.03247
Sonnet 5 $0.00000 $0.01299
Haiku 4.5 $0.00000 $0.00649

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

Security

Grade A, and why

302-frameworks-spring-boot-rest 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.

.cursor/rules/302-frameworks-spring-boot-rest.mdc · 766 lines

How it starts

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

Java REST API Design Principles

This comprehensive guide provides essential principles for designing robust, maintainable, and secure REST APIs using Spring Boot. These rules ensure your APIs follow industry best practices, maintain consistency, and provide excellent developer experience for API consumers.

Implementing These Principles

These guidelines are built upon the following core principles:

  • Semantic Consistency: Use HTTP methods, status codes, and URI patterns according to their intended semantics
  • Clear Communication: Provide unambiguous API contracts through proper DTOs, error handling, and documentation
  • Security by Design: Implement authentication, authorization, and input validation from the start
  • Evolutionary Design: Version APIs and structure them to support future changes without breaking existing clients

Table of contents

  • Rule 1: Use HTTP Methods Correctly
  • Rule 2: Design Clear and Consistent Resource URIs
  • Rule 3: Use HTTP Status Codes Appropriately
  • Rule 4: Implement Effective Request and Response Payloads (DTOs)
  • Rule 5: Version Your APIs
  • Rule 6: Handle Errors Gracefully
  • Rule 7: Secure Your APIs
  • Rule 8: Document Your APIs
  • Rule 9: Use Controller Advice for Global Exception Handling
  • Rule 10: Implement Problem Details for Error Responses

Rule 1: Use HTTP Methods Correctly

Title: Employ HTTP Methods Semantically Description: Use HTTP methods according to their defined semantics to ensure predictability and compliance with web standards. GET for retrieval, POST for creation, PUT for update/replace, PATCH for partial update, and DELETE for removal.

Good example:

// Using Spring MVC annotations for illustration
@RestController
@RequestMapping("/users")
public class UserController {

    @GetMapping("/{id}") // GET for retrieving a user
    public ResponseEntity<UserDTO> getUser(@PathVariable String id) {
        // ... logic to fetch user ...
        return ResponseEntity.ok(new UserDTO());
    }

    @PostMapping // POST for creating a new user
    public ResponseEntity<UserDTO> createUser(@RequestBody UserCreateDTO userCreateDTO) {
        // ... logic to create user ...
        UserDTO newUser = new UserDTO(); // Assume it gets an ID after creation
        return ResponseEntity.created(URI.create("/users/" + newUser.getId())).body(newUser);
    }

    @PutMapping("/{id}") // PUT for replacing/updating a user
    public ResponseEntity<UserDTO> updateUser(@PathVariable String id, @RequestBody UserUpdateDTO userUpdateDTO) {
        // ... logic to update user ...
        return ResponseEntity.ok(new UserDTO());
    }

    @DeleteMapping("/{id}") // DELETE for removing a user
    public ResponseEntity<Void> deleteUser(@PathVariable String id) {
        // ... logic to delete user ...
        return ResponseEntity.noContent().build();
    }
    
    @PatchMapping("/{id}") // PATCH for partial updates
    public ResponseEntity<UserDTO> partiallyUpdateUser(@PathVariable String id, @RequestBody Map<String, Object> updates) {
        // ... logic to partially update user ...
        return ResponseEntity.ok(new UserDTO());
    }
}
// Dummy DTO classes
class UserDTO { private String id; public String getId() { return id; } /* ... other fields, getters, setters ... */ }
class UserCreateDTO { /* ... fields ... */ }
class UserUpdateDTO { /* ... fields ... */ }

Read the full file on GitHub · 766 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 · 766 lines · 0 tokens per session scan A 15cb121d081e

Subscribe to this mod's changes

302-frameworks-spring-boot-rest is a cursor rule published in the GitHub repository jabrena/cursor-rules-spring-boot (47 stars, last pushed 5mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 6,495 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-30.