$npx -y skills add Amplicode/spring-skills --skill dto-creatorCreates a DTO (Data Transfer Object) class for an entity. Use this skill when a DTO class needs to be created, either standalone or as part of a larger task (e.g. REST controller, service layer, replacing entity usage with a DTO).
| 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 | # DTO Creator |
| 12 | |
| 13 | Creates a DTO class (Java class, Java record, Java+Lombok, or Kotlin data class) for an entity with selected attributes, constructors, getters/setters, equals/hashCode, toString, and optional features. |
| 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–7 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 | > **Step 7 (mapper) is automatic when conversion is needed.** If from context it is clear that the DTO will be used in code that converts entities to/from DTOs (controller, service, endpoint replacement, etc.), the skill MUST delegate to `mapper-creator` — never write manual mapping code inline. The `mapper-creator` skill decides the implementation (MapStruct, Custom, adding dependencies) — this skill just delegates. |
| 21 | |
| 22 | --- |
| 23 | |
| 24 | ## Defaults |
| 25 | |
| 26 | | Option | Default | Always ask? | Notes | |
| 27 | |--------|---------|-------------|-------| |
| 28 | | entity | -- | YES | main branching: which entity to create DTO for | |
| 29 | | attributes | all entity fields | YES | which fields to include | |
| 30 | | className | `{EntityName}Dto` | NO | suggest, confirm only | |
| 31 | | language | from `get_project_summary` | NO | auto-detected | |
| 32 | | variant | auto from language + deps | YES | Java class / Java record / Java+Lombok / Kotlin | |
| 33 | | mutable | false | NO | skip unless user wants customization | |
| 34 | | allArgsConstructor | true | NO | Java plain only | |
| 35 | | equalsHashCode | true | NO | Java plain only | |
| 36 | | toString | true | NO | Java plain only | |
| 37 | | fluentSetters | false | NO | only when mutable=true, Java only | |
| 38 | | jsonIgnoreUnknownProperties | false | NO | Java only, when Jackson on classpath | |
| 39 | | serializableType | NoSerializable | NO | rarely needed | |
| 40 | | packageName | same package as entity | NO | auto-detected | |
| 41 | | subDtoType (per ToOne association) | FLAT with id-only sub | YES | Four options available: New Class / New Nested Class / Existing Class / Flat. "Only ID" does NOT exist as a separate option — it is Flat with only the sub-entity `id` checked. See `references/sub-dto.md`. | |
| 42 | | subDtoType (per ToMany / collection) | NEW_NESTED_CLASS | YES | same 4 options as ToOne. Flat IS supported for collections and produces composite plural fields like `Set<Integer> specialtyIds` — see `references/sub-dto.md`. | |
| 43 | | fieldNameOverride (per field) | none | NO | per-field rename | |
| 44 | | extraValidations (per field) | none | NO | user-added jakarta validators on top of inherited ones | |
| 45 | | removedValidations (per field) | none | NO | constraints inherited from entity that the user wants dropped | |
| 46 | | indent | from `.editorconfig` (fallback 4-space) | NO | see § Indentation below | |
| 47 | |
| 48 | **Smart defaults:** If user says "use defaults", "all defaults", "default settings", |
| 49 | or similar -- skip ALL questions where "Always ask?" = NO. Only ask mandatory questions. |
| 50 | |
| 51 | **Smart answer recognition:** When user provides a value instead of choosing from a numbered |
| 52 | list, accept it directly. Examples: |
| 53 | - Question "Which entity?" -> user answers "Order" -> this IS the entity, don't re-ask |
| 54 | - Question "Variant?" -> user answers " |