본문으로 건너뛰기
cccskills
무료GitHub에 공개

problem-details-rfc9457

Use when implementing exception mapping or RFC 9457 error responses in Spring Boot 3. Preserve an existing legacy error contract unless migration is requested.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(9)

  • SKILL.md4.0 KB
  • agents/openai.yaml211 B
  • examples/bad-exception-handler.java1.6 KB
  • examples/good-exception-handler.java3.0 KB
  • templates/BusinessRuleViolationException.java358 B
  • templates/DomainException.java622 B
  • templates/InsufficientInventoryException.java513 B
  • templates/OrderNotFoundException.java366 B
  • templates/ProblemDetailExceptionHandler.java3.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Problem Details - RFC 9457

Choose the error contract

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: true

For WebFlux use spring.webflux.problemdetails.enabled and reactive exception handling; the servlet templates below are not WebFlux handlers.

Domain errors

Use the compiled DomainException together with ProblemDetailExceptionHandler. 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. Method-security (@PreAuthorize) denials are the opposite case: AccessDeniedException is thrown inside the dispatcher, so the advice must map it to 403 or the Exception catch-all returns 500.

Response fields

{
  "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.

Verification

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.

Official sources

Gotchas

  • Agent handles a different exception class than the domain throws - test the concrete exceptions.
  • Agent forces Problem Details into an existing legacy API - preserve its contract unless asked to migrate.
  • Agent requires an explicit type for every error - about:blank is the default.
  • Agent treats success envelopes and Problem Details as incompatible - only error policy must be consistent.
  • Agent relies on advice for filter exceptions - configure the security handlers separately.
  • Agent returns internal exception messages in 500 responses - log privately and return generic detail.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging. Use production-observability for general service metrics, health, logs, and OTLP setup.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

Use when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6. Covers explicit URL, header, and media-type strategies, compatibility rules, and deprecation handling.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

Use when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7. Covers built-in mapping versions, request version resolution, defaults, supported versions, and deprecation headers.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

Use when introducing or correcting grouped Spring Boot configuration, typed property binding, validation, profiles or secret injection. Do not rewrite unrelated single-value configuration.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

Use when packaging Spring Boot 4 as an OCI image, JVM container, AOT application, or GraalVM native executable. Covers buildpacks, layers, runtime hints, probes, security, and verification.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

Use when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable. Covers buildpacks, layered images, JVM containers, AOT hints, probes, security, and verification.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rrezartprebreza/spring-boot-skills3212026년 10월 22일 업데이트

rrezartprebreza의 스킬 모두 보기

이 스킬의 문제 신고