mapper-creator

Generates MapStruct or custom converter mappers between JPA entities and DTOs in Spring projects.

Updated May 4, 2026
One-click install
npx skills add https://github.com/studenkov/FinanceTracker --skill mapper-creator-studenkov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mapper-creator
Source: https://github.com/studenkov/FinanceTracker/tree/main/.agents/skills/mapper-creator
Command: npx skills add https://github.com/studenkov/FinanceTracker --skill mapper-creator-studenkov

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing entity-to-DTO mapping code by hand is repetitive and error-prone, especially when handling flattened associations, partial updates, and MapStruct annotation rules. This Skill generates the mapper for you, wired to your actual entity and DTO fields. ## Core Features & Use Cases - MapStruct or Custom Mappers: Generates either a MapStruct interface/abstract class with @Mapping annotations or a plain custom converter with static methods (Java) or extension functions (Kotlin). - Field-Aware Mapping: Compares entity and DTO fields via the Spring MCP server to produce correct @Mapping(source, target) pairs, dot-notation for flat ToOne fields, and helper methods for flat collections. - Optional Update Methods: Adds partialUpdate (with configurable null strategy) and updateWithNull methods on request, plus @AfterMapping handlers for bidirectional associations. - Dependency Management: Automatically adds mapstruct and mapstruct-processor artifacts to your Gradle or Maven build file when missing. - Use Case: After creating an OrderDto, ask for a mapper and receive a ready-to-compile OrderMapper with toEntity, toOrderDto, and correct association mappings. ## Quick Start Ask the assistant to create a MapStruct mapper from the Order entity to OrderDto using default settings.

Frequently Asked Questions about mapper-creator

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

FAQPage Schema
How do I create a MapStruct mapper between an entity and a DTO?

Specify the entity and DTO names, and the skill generates a MapStruct interface with toEntity and toDto methods, deriving @Mapping annotations from an actual field comparison. It also adds the mapstruct and mapstruct-processor dependencies to your build file if missing.

MapStruct vs custom converter: which should I use?

MapStruct generates type-safe mapping code at compile time via annotation processing and is the recommended default. A custom converter (static methods in Java, extension functions in Kotlin) has zero external dependencies and suits small projects or manual-control preferences.

Does this work with Kotlin Spring projects?

Yes, Kotlin is fully supported. MapStruct mappers are generated as abstract classes with @Mappings wrapping, and custom mappers are generated as Kotlin extension functions. The build file edit uses kapt or ksp for the annotation processor.

How are flattened DTO fields like customerId or customerName mapped?

Flat ToOne fields use MapStruct dot-notation such as @Mapping(source = "typeId", target = "type.id"), and MapStruct synthesizes the intermediate object. Flat collection fields get a generated helper method wired through a @Mapping expression in the toDto direction only.

Can I add a partial update method that ignores null values?

Yes, request partialUpdate and choose a nullValuePropertyMappingStrategy of SET_TO_NULL, IGNORE, or SET_TO_DEFAULT. The skill emits one method with a single @BeanMapping annotation configured with your chosen strategy.

What are the prerequisites for running this skill?

The skill requires the Amplicode IntelliJ plugin with its Spring MCP server connected, since it reads project structure, dependencies, and entity details through MCP tools. If the tools are unavailable, it delegates to the amplicode-install skill first.