AI Skill StudioAI Skill Studio
Skill Library
Presets:

Target Standard & File Format

AI Agent Rules & Skills
Context Shields & Privacy (Ignore Files)
Integrations & Machine Documentation
AI Governance & Multi-Agent Planning Suite

.cursorignore Shield

Prevent Cursor AI from indexing secrets, build caches, and bulky lockfiles to save context window tokens:

Full Protection
Tokens Saved / Turn
~190k tokens
Secret Leak Guards
2 Active Guards
Shield Categories
8 of 8 Enabled

Indexing Boundary Categories

Toggle specific categories to mask secrets and exclude heavy artifacts:

Custom Rules & Negate Exceptions

Append repo-specific file globs or re-include allowed files with negation patterns (!path):

Backend · Cursor

Spring Boot 4 & Java 25 .cursorignore

A .cursorignore for Spring Boot 4 & Java 25 that keeps build output, large files and secrets out of Cursor's index (best effort).

Path
.cursorignore
Loads
Indexing and AI features
Format
gitignore syntax
Used by
Cursor
All .cursorignore presets and how .cursorignore works

What this file tells the agent

This .cursorignore keeps Spring Boot 4 & Java 25 build output, large data files and environment secrets out of Cursor's index and AI features, so context goes to your source code. It is best effort: commands the agent runs in the terminal can still read ignored files, so keep real secrets out of the repo too.

  • Use jakarta.* packages for persistence, validation, and servlets; ban legacy javax.* imports.
  • Represent immutable request/response DTOs using native Java Records with Jakarta validation annotations.
  • Enable virtual threads (spring.threads.virtual.enabled=true) for high-throughput blocking I/O.
  • Configure Spring Security using the modern SecurityFilterChain bean approach; never extend deprecated WebSecurityConfigurerAdapter.
  • Avoid N+1 queries in Spring Data JPA: use @EntityGraph or JOIN FETCH JPQL queries for relational fetches.

Code to avoid, and what to write instead

The rule steers the agent away from the left and toward the right.

avoid
// Discouraged: Legacy javax namespace, verbose POJO with setters, mutable entity exposure
import javax.persistence.*; // Obsolete since Spring Boot 3; use jakarta.persistence

public class BadOrderDTO {
    private String customerId;
    public void setCustomerId(String id) { this.customerId = id; }
}
write instead
package com.example.demo.order;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;

public record CreateOrderRequest(
    @NotBlank String customerId,
    @Positive BigDecimal amount
) {}

public record OrderResponse(Long id, String customerId, BigDecimal amount) {}

@RestController
@RequestMapping("/api/v1/orders")
public class OrderController {
    private final OrderService orderService;

    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @PostMapping
    public ResponseEntity<OrderResponse> create(@RequestBody CreateOrderRequest request) {
        OrderResponse response = orderService.processOrder(request);
        return ResponseEntity.ok(response);
    }
}

Install it in one command

  1. 01

    Go to your project root

    The file goes at .cursorignore, relative to the root.

  2. 02

    Download the file

    Run the command on the right. It downloads this preset and writes the file.

  3. 03

    Make sure it gets used

    Cursor applies .cursorignore automatically. Matching files leave the index and AI features, but commands the agent runs in the terminal can still read them.

$ curl -fsSL "https://www.devscratchpad.tech/api/raw/cursorignore/spring-boot-4" -o ".cursorignore"

writes .cursorignore

path

.cursorignore

To write the file from your own code instead, use Read your code or Convert Legacy Rules in the editor above.

Questions

How is .cursorignore different from .gitignore?
.gitignore decides what git tracks. .cursorignore keeps files out of Cursor's codebase index and AI features; Cursor already skips files in .gitignore when it indexes.
Does .cursorignore reduce wasted context?
Yes. Ignored files are not indexed or pulled into requests, so build output and large data files do not crowd out your source code.