ai-observability
Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and…
Use when implementing exception mapping or RFC 9457 error responses in Spring Boot 3. Preserve an existing legacy error contract unless migration is requested.
$ npx -y skills add rrezartprebreza/spring-boot-skills --skill problem-details-rfc9457 --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/problem-details-rfc9457Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when implementing exception mapping or RFC 9457 error responses in Spring Boot 3. Preserve an existing legacy error contract unless migration is requested.
name: problem-details-rfc9457 description: > Use when implementing exception mapping or RFC 9457 error responses in Spring Boot 3. Preserve an existing legacy error contract unless migration is requested.
Inspect existing advice, security entry points and API tests first. Keep one error policy per API. Success DTOs or success envelopes can coexist with Problem Details errors: RFC 9457 specifies errors, not success representations.
For an API using Problem Details, enable Spring's built-in MVC exception handling:
spring:
mvc:
problemdetails:
enabled: trueFor WebFlux use `spring.webflux.problemdetails.enabled` and reactive exception handling; the servlet templates below are not WebFlux handlers.
Use the compiled [DomainException](templates/DomainException.java) together with [ProblemDetailExceptionHandler](templates/ProblemDetailExceptionHandler.java). The handler maps all subclasses using their declared status and stable error code:
Each public class has its own file. These are API-facing exceptions with HTTP status metadata; for a framework-free domain, keep domain exceptions independent and map them in the web adapter. Do not expose arbitrary persistence or infrastructure exception messages.
The advice extends `ResponseEntityExceptionHandler` to preserve Spring's handling of framework exceptions. Validation returns 400 with field violations; unexpected failures return a generic 500 while retaining the full exception only in server logs. Keep nullable validation messages safe. Filter-level authentication failures need an `AuthenticationEntryPoint`; authorization failures need an `AccessDeniedHandler`. Controller advice does not cover the security filter chain.
{
"type": "https://api.example.com/errors/order_not_found",
"title": "Not Found",
"status": 404,
"detail": "Order not found",
"instance": "/api/orders/123",
"errorCode": "ORDER_NOT_FOUND"
}Use project-owned, stable URIs for custom problem types. An explicit `type` is optional; when omitted it defaults to `about:blank`. Its title should then match the HTTP status phrase. The HTTP status and the body status must agree. Use `application/problem+json` for JSON problems. Use extensions such as `errorCode` or `violations` for machine-readable details instead of requiring clients to parse human-readable messages.
Test actual HTTP responses for domain 404/422, validation 400, unexpected 500, and framework errors such as malformed JSON and unsupported methods. Assert content type, status, stable error codes and absence of stack traces or internal messages. Separately test filter 401/403. The repository verification fixture imports these exact templates for both Boot versions.
Production-grade Claude Code and Codex skills for Spring Boot developers
Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and…
Use when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6. Covers explicit URL, header, and media-type strategies, compatibility…
Use when introducing or correcting grouped Spring Boot configuration, typed property binding, validation, profiles or secret injection. Do not rewrite…
Use when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable. Covers buildpacks, layered images, JVM containers, AOT hints,…
Use when working with domain models, aggregates, value objects, domain events, or repositories in a DDD-style project. Ensures rich domain model over anemic…
Use when implementing Kafka, RabbitMQ, Pulsar, or JMS producers and consumers in Spring Boot 3. Covers event contracts, idempotency, retries, dead-letter…