request-response

Standardize API request and response DTO structures with Kotlin data classes and Jackson annotations.

Updated Jan 11, 2026
One-click install
npx skills add https://github.com/gykk16/spring-skeleton --skill request-response
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: request-response
Source: https://github.com/gykk16/spring-skeleton/tree/main/.omc/skills/request-response
Command: npx skills add https://github.com/gykk16/spring-skeleton --skill request-response

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces consistent conventions for API request and response Data Transfer Objects (DTOs) and ensures correct JSON formatting, preventing common errors and improving API maintainability.

Core Features & Use Cases

  • DTO Separation: Enforces distinct request and response packages for API DTOs.
  • Entity Protection: Prevents direct exposure of JPA entities in API responses.
  • @JsonFormat Usage: Guides correct application of @JsonFormat for serialization and deserialization.
  • Use Case: When designing a new API endpoint, use this Skill's guidance to create clean, separate request and response DTOs, ensuring dates and times are formatted correctly for both incoming and outgoing JSON.

Quick Start

Follow the guidelines in this skill to structure your API request and response DTOs.

Frequently Asked Questions about request-response

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize API request and response DTOs in Kotlin?

Standardize API DTOs by defining Kotlin data classes in distinct request and response packages, isolating them from internal entities to enforce consistent JSON serialization and maintainability.

Why should I avoid returning JPA entities directly in API responses?

Returning JPA entities directly in API responses exposes internal database structures and risks serialization errors. Separating entities into dedicated response DTOs protects your data layer and ensures stable JSON contracts.

How do I use @JsonFormat for correct date and time serialization in Jackson?

Use the `@JsonFormat` annotation on your Kotlin data class fields to precisely control date and time serialization and deserialization, ensuring incoming and outgoing JSON timestamps are formatted correctly.

What is the best way to organize API DTO packages for clean architecture?

Organize API DTO packages by splitting them into separate request and response directories. This separation clarifies API contracts, prevents direct entity exposure, and improves overall project maintainability.

Does this DTO standardization approach work with Kotlin data classes and Jackson?

Yes, this approach utilizes Kotlin data classes combined with Jackson annotations like `@JsonFormat` to enforce correct JSON mapping, providing precise control over API serialization and deserialization.