원클릭으로
api-contract-review
REST API design validation, OpenAPI review, and contract-first development patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
REST API design validation, OpenAPI review, and contract-first development patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when implementing Spring Boot 3.x applications. Provides hands-on implementation patterns for web, data, security, testing, and cloud-native development.
Review REST API contracts for HTTP semantics, versioning, backward compatibility, and response consistency. Use when user asks "review API", "check endpoints", "REST review", or before releasing API changes.
Use when designing Spring Boot 3.x application architecture, making technology decisions, or planning project structure. Provides architectural patterns and references for project setup, JPA, security, testing, and reactive programming.
Use when designing, reviewing, or modifying REST API endpoints to enforce proper HTTP verbs, status codes, versioning, and API contract best practices.
Use when reviewing or writing code to enforce DRY, KISS, and YAGNI principles with Java-specific guidance.
Use when implementing or reviewing code that benefits from established design patterns like Builder, Factory, Strategy, Observer, Decorator, or Adapter.
| name | api-contract-review |
| description | REST API design validation, OpenAPI review, and contract-first development patterns |
GET /api/v1/orders # List orders (with pagination)
GET /api/v1/orders/{id} # Get single order
POST /api/v1/orders # Create order
PUT /api/v1/orders/{id} # Full update
PATCH /api/v1/orders/{id} # Partial update
DELETE /api/v1/orders/{id} # Delete order
GET /api/v1/orders/{id}/items # Sub-resource listing
POST /api/v1/orders/{id}/cancel # Action on resource
// 200 OK - successful GET, PUT, PATCH
@GetMapping("/{id}")
public ResponseEntity<OrderDto> getOrder(@PathVariable String id) {
return ResponseEntity.ok(orderService.findById(id));
}
// 201 Created - successful POST with Location header
@PostMapping
public ResponseEntity<OrderDto> createOrder(
@Valid @RequestBody CreateOrderRequest request) {
var order = orderService.create(request);
var location = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(order.id()).toUri();
return ResponseEntity.created(location).body(order);
}
// 204 No Content - successful DELETE
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteOrder(@PathVariable String id) {
orderService.delete(id);
return ResponseEntity.noContent().build();
}
// 400 Bad Request - validation failure
// 401 Unauthorized - missing or invalid authentication
// 403 Forbidden - insufficient permissions
// 404 Not Found - resource does not exist
// 409 Conflict - business rule violation
// 422 Unprocessable Entity - semantic validation failure
// 429 Too Many Requests - rate limit exceeded
// Request DTO with validation
public record CreateOrderRequest(
@NotBlank String customerId,
@NotEmpty @Valid List<OrderItemRequest> items,
@Size(max = 500) String notes
) {}
public record OrderItemRequest(
@NotBlank String productId,
@Min(1) @Max(1000) int quantity
) {}
// Response DTO with consistent structure
public record OrderDto(
String id,
String customerId,
List<OrderItemDto> items,
OrderStatus status,
BigDecimal totalAmount,
String currency,
Instant createdAt,
Instant updatedAt
) {}
// Paginated response
public record PagedResponse<T>(
List<T> content,
int page,
int size,
long totalElements,
int totalPages,
boolean hasNext
) {
public static <T> PagedResponse<T> from(Page<T> page) {
return new PagedResponse<>(
page.getContent(), page.getNumber(), page.getSize(),
page.getTotalElements(), page.getTotalPages(), page.hasNext());
}
}
// RFC 7807 Problem Detail
public record ErrorResponse(
String type,
String title,
int status,
String detail,
String instance,
Map<String, Object> extensions
) {}
// Example error response:
// {
// "type": "https://api.example.com/errors/insufficient-stock",
// "title": "Insufficient Stock",
// "status": 422,
// "detail": "Product 'prod-1' has only 5 units available, but 10 were requested",
// "instance": "/api/v1/orders",
// "extensions": { "productId": "prod-1", "available": 5, "requested": 10 }
// }
@RestController
@RequestMapping("/api/v1/orders")
@Tag(name = "Orders", description = "Order management operations")
public class OrderController {
@Operation(
summary = "Create a new order",
description = "Creates an order for the specified customer and items",
responses = {
@ApiResponse(responseCode = "201", description = "Order created",
content = @Content(schema = @Schema(implementation = OrderDto.class))),
@ApiResponse(responseCode = "400", description = "Invalid request body"),
@ApiResponse(responseCode = "422", description = "Business rule violation")
})
@PostMapping
public ResponseEntity<OrderDto> createOrder(
@Valid @RequestBody CreateOrderRequest request) {
// implementation
}
}
/api/v1/...)Accept and Content-Type handlingSunset header