$npx -y skills add Amplicode/spring-skills --skill mapper-creatorCreates a mapper between an entity and a DTO (MapStruct or custom converter). Use this skill when a mapper/converter between entity and DTO needs to be created, either standalone or as part of a larger task (e.g. after DTO creation, during CRUD setup).
| 1 | # Preflight: Spring MCP |
| 2 | |
| 3 | This skill is part of the **Spring Agent Toolkit** and is designed to work with the **Spring MCP server** (provided by the Amplicode IntelliJ plugin). Before doing anything else, check your tool list for any Spring MCP tool — they are exposed under the `amplicode` MCP server (e.g. `get_project_summary`, `list_module_dependencies`, `get_entity_details`); harnesses that flatten MCP tools into the tool list use the `mcp__amplicode__` prefix on the same names. |
| 4 | |
| 5 | - **If at least one Amplicode tool is available** — MCP is connected. Proceed with the skill below. |
| 6 | - **If none are available** — stop and invoke the **`amplicode-install`** skill (bundled with the Spring Agent Toolkit). It installs the Amplicode plugin and walks the user through the **«Настроить Spring Agent»** welcome-screen button + MCP-client restart. After it completes, the MCP tools become available — resume this skill. |
| 7 | - If `amplicode-install` is not registered in your skill list, tell the user (in their language): *"This skill needs the Amplicode IntelliJ plugin and its MCP server. Install it from https://amplicode.ru/marketplace into IntelliJ IDEA Ultimate/Community or GigaIDE, open any project, click «Настроить Spring Agent» on the Amplicode welcome screen, then restart your MCP client."* |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | # Mapper Creator |
| 12 | |
| 13 | Creates a mapper (MapStruct interface/abstract class or custom converter) for converting between an entity and a DTO. |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | > **CRITICAL: Code ONLY from examples/ files. If no matching example -- STOP and ask user.** |
| 18 | > **CRITICAL: For questions with a fixed set of choices, prefer `AskUserQuestion` > its analogue > plain text list. Plain numbered text lists are the last resort when no interactive tool is available.** |
| 19 | > **CRITICAL: Read the conversation context BEFORE running Step 1.** Half the questions in Steps 2–3 may already be answered by the user's prompt and prior turns. Re-asking what was already said is the #1 reason this skill feels slow. |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Defaults |
| 24 | |
| 25 | | Option | Default | Always ask? | Notes | |
| 26 | |--------|---------|-------------|-------| |
| 27 | | entity | — | YES | which entity to map | |
| 28 | | dtoClass | — | YES | which DTO to map to | |
| 29 | | mapperType | MapStruct | YES | main choice: MapStruct or Custom | |
| 30 | | className | `{EntityName}Mapper` | NO | suggest, confirm | |
| 31 | | packageName | package next to DTO | NO | auto-determined | |
| 32 | | parentInterface | null | NO | extend a common mapper interface | |
| 33 | | language | from `get_project_summary` | NO | auto-determined | |
| 34 | | componentModel | SPRING (if Spring is in dependencies), otherwise DEFAULT | NO | CDI is not auto-detected — user must specify explicitly | |
| 35 | | partialUpdate | no | NO | add partialUpdate method | |
| 36 | | partialUpdateNullStrategy | SET_TO_NULL | NO | if partialUpdate = yes: SET_TO_NULL / IGNORE / SET_TO_DEFAULT | |
| 37 | | updateWithNull | no | NO | add updateWithNull method | |
| 38 | | dtoIsRecord | false | NO | whether to use Java record for DTO (Java only; affects accessors in custom toEntity) | |
| 39 | |
| 40 | **Smart defaults:** If the user says "use defaults", "all defaults", "default settings" -- skip all questions where "Always ask?" = NO. Ask only the required ones. |
| 41 | |
| 42 | **Smart answer recognition:** When the user directly provides a value instead of choosing from a list -- accept it. Examples: |
| 43 | - Question "Which entity?" -> user answers "Order" -> that IS the entity |
| 44 | - Question "Mapper type?" -> user answers "mapstruct" -> that IS the choice |
| 45 | - If the user gave multiple answers in one message -> accept all, skip the answered questions |
| 46 | - NEVER re-ask what the user has already answered (even indirectly) |
| 47 | |
| 48 | **Batch questions:** Group related questions into a single `AskUserQuestion` call (up to 4 questions): |
| 49 | - The main question (mapper type) is always asked SEPARATELY |
| 50 | - Do not group questions from DIFFERENT decision branches |
| 51 | - Prefer `AskUserQuestion`; fall back to plain text only if the tool is unavailable |
| 52 | |
| 53 | --- |
| 54 | |
| 55 | ## Step 0 -- Conversation context first (REQUIRED, no tool calls) |
| 56 | |
| 57 | Before any MCP call, before any question, **re-read the user's prompt and |
| 58 | the prior turns of this conversation** and extract whatever is already |
| 59 | stated. This step costs nothing and prevents the most common failure mode |
| 60 | of this skill — asking the user something they already said. |
| 61 | |
| 62 | Build a mental checklist of inputs and tick off everything the user has |
| 63 | already provided, explicitly or implicitly: |
| 64 | |
| 65 | | Input | Look for in the prompt / context | |
| 66 | |---|---| |
| 67 | | **entity** | a class name (`Order`, `Vet`, `ScheduleTemplate`); "for X"; "from X to Y"; an open file in the IDE; a recently discussed entity | |
| 68 | | **DTO** | a class name ending in `Dto` / `Response` / `Request`; "to `OrderDto`"; "from X to Y"; a DTO that was just generated by `dto-creat |