agentleFS
kumaran-iskumaran-is/claude-code-onboarding/.claude/skills/java-spring-api/SKILL.md

java-spring-api

Skill35 starsChanged 6 months agoMITView on GitHub

This skill provides patterns and templates for Java 21 Spring Boot 3.5.x WebFlux REST API development. It should be activated when creating controllers, services, repositories, DTOs, or reactive tests.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before generating code, consult these sources for current syntax and APIs:

    line 84
  2. Very specific:

    Validation errors: Use jakarta.validation annotations on DTO records.

    line 104
  3. Very specific:

    Not-found errors: Use switchIfEmpty(Mono.error(new ResourceNotFoundException(...))) in services.

    line 106
  4. Distinctive:

    No JPA in reactive stacks — use R2DBC exclusively

    line 113
  5. Distinctive:

    After writing Java code, dispatch these reviewer agents:

    line 118

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Iron Law

NO REACTIVE CODE WITHOUT READING reference/spring-boot-conventions.md FIRST — blocking calls inside reactive chains cause thread starvation

Java 21 + Spring Boot 3.5.x WebFlux REST API Skill

Conventions & Rules

For code conventions, package layout, and reactive rules, read reference/spring-boot-conventions.md

Quick Scaffold — New Spring Boot Project

# Using Spring Initializr via curl
curl https://start.spring.io/starter.zip \
  -d type=maven-project \
  -d language=java \
  -d javaVersion=21 \
  -d bootVersion=3.5.0 \
  -d dependencies=webflux,r2dbc,postgresql,flyway,validation,actuator,lombok \
  -d groupId=com.company \
  -d artifactId=my-service \
  -d name=my-service \
  -o my-service.zip && unzip my-service.zip -d my-service

Process

  1. Scaffold using Spring Initializr or the command above
  2. Configure pom.xml and application.yml — read reference/spring-boot-config.md
  3. Create files using templates — read reference/spring-boot-templates.md for DTO, Entity, Repository, Service, Controller, and Test templates
  4. Follow conventions below for package layout and reactive rules
  5. Write tests with @SpringBootTest + WebTestClient
  6. Format and check: mvn spotless:apply or IDE formatter

Key Patterns

PatternImplementation
DTOsJava records with jakarta.validation annotations
EntitiesClasses with @Table, @Id R2DBC annotations
RepositoriesExtend ReactiveCrudRepository<T, UUID>
Services@Service + @RequiredArgsConstructor, return Mono/Flux
Controllers@RestController + @RequestMapping("/api/v1/...")
Error handling@ControllerAdvice returning ProblemDetail (RFC 9457)
Configapplication.yml with ${ENV_VAR:default} placeholders
MigrationsFlyway in src/main/resources/db/migration/ (disabled by default; enable with FLYWAY_ENABLED=true)

Reference Files

FileContentLoad When
reference/spring-boot-config.mdpom.xml template, application.yml configurationProject setup, configuring dependencies
reference/spring-boot-templates.mdDTO, Entity, Repository, Service, Controller, Test, Error Handler templatesCreating DTOs, services, controllers, entities
reference/spring-boot-enterprise-errors-security.mdException hierarchy, Security (OAuth2/JWT), CORSImplementing error handling, adding security, configuring CORS
reference/spring-boot-enterprise-resilience-health.mdResilience4j, WebClient pool, Health indicators, SwaggerAdding resilience, health checks, API documentation
reference/spring-boot-rest-service-guide.mdOpenAPI+DDL driven workflow, MapStruct mapping, External service clients, WireMock testingDesigning REST APIs, mapping DTOs, calling external services
reference/spring-boot-testing-unit.mdBlockHound, Resilience4j testing, test data buildersWriting unit tests, testing reactive streams
reference/spring-boot-testing-integration.mdTestcontainers, contract testing, WireMock, coverageWriting integration tests, controller tests
reference/spring-boot-reactive-debugging.mdReactor Hooks (onOperatorError, onNextDropped, onErrorDropped), checkpoint patterns, debug mode controlDebugging reactive pipelines, tracing Flux/Mono errors
reference/spring-boot-security-hardening.mdOWASP dependency scanning, static analysis patterns, HSTS, JWT role extraction, secure loggingSecurity hardening, JWT auth, dependency scanning
reference/spring-boot-reactive-patterns.mdResilience4j operators, Redis reactive, SSE, Spring Cloud Stream, custom operators, threading anti-patternsWriting reactive endpoints, Flux/Mono, Redis caching, SSE
reference/spring-boot-design-patterns.mdBuilder, Factory (Spring DI), Strategy, Observer (Spring Events), Decorator, Adapter — all with Spring Boot 3.5.x examplesImplementing any of these 6 patterns in Spring Boot code
reference/spring-reactive-review-checklist.mdSpring reactive review checklist (used by spring-reactive-reviewer agent)Code review, pre-PR checklist
reference/java21-advanced-features.mdGraalVM Native Image, structured concurrency (StructuredTaskScope), virtual threads migration guide, JVM tuning (ZGC/G1 for Cloud Run), JMH benchmarking, Spring Modulith, sequenced collections, string templates, record patternsGraalVM native builds, parallel calls with structured concurrency, JVM performance tuning, modular monolith design
reference/spring-boot-verification-gates.mdSpotBugs, PMD, Checkstyle Maven commands, 6-phase verification loop, CI gate output templatePre-PR verification, static analysis, CI/CD gate

Documentation Sources

Before generating code, consult these sources for current syntax and APIs:

SourceURL / ToolPurpose
Spring BootContext7 MCPLatest Spring Boot APIs, annotations, configuration
Spring Initializrhttps://start.spring.ioProject scaffolding with correct dependencies

Common Commands

mvn spring-boot:run                  # Run backend
mvn test                             # Run tests
mvn package                          # Build JAR
mvn spotless:apply                   # Format code
mvn clean test -Dspring.profiles.active=test  # Run tests with test profile
mvn dependency:tree                  # Show dependency tree

Error Handling

Validation errors: Use jakarta.validation annotations on DTO records. Handle via @ControllerAdvice returning ProblemDetail with HttpStatus.BAD_REQUEST (400).

Not-found errors: Use switchIfEmpty(Mono.error(new ResourceNotFoundException(...))) in services.

Duplicate errors: Catch DataIntegrityViolationException in services and convert to 409 Conflict.

Hard Prohibitions

  • No block() calls in reactive chains — all operations must stay non-blocking
  • No JPA in reactive stacks — use R2DBC exclusively
  • Password reset rate limit: 3 attempts per email per hour maximum

Post-Code Review

After writing Java code, dispatch these reviewer agents:

  • spring-reactive-reviewer — reactive correctness, blocking call detection, R2DBC patterns
  • security-reviewer — auth, input validation, secrets management

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.