amplicode/spring-skills/dto-creator
Claude Code and agent skill by amplicode/spring-skills
- community
Checking that the SKILL.md file is still in the repository.
Creates 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).
Install
npx vskill@latest install amplicode/spring-skills/dto-creatorSKILL.md
Preflight: Spring MCP
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.
- If at least one Amplicode tool is available — MCP is connected. Proceed with the skill below.
- 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.
- If
amplicode-installis 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."
DTO Creator
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.
CRITICAL: Code ONLY from examples/ files. If no matching example -- STOP and ask user.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.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.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 tomapper-creator— never write manual mapping code inline. Themapper-creatorskill decides the implementation (MapStruct, Custom, adding dependencies) — this skill just delegates.
Defaults
| Option | Default | Always ask? | Notes | |
|---|---|---|---|---|
| entity | -- | YES | main branching: which entity to create DTO for | |
| attributes | all entity fields | YES | which fields to include | |
| className | {EntityName}Dto | NO | suggest, confirm only | |
| language | from get_project_summary | NO | auto-detected | |
| variant | auto from language + deps | YES | Java class / Java record / Java+Lombok / Kotlin | |
| mutable | false | NO | skip unless user wants customization | |
| allArgsConstructor | true | NO | Java plain only | |
| equalsHashCode | true | NO | Java plain only | |
| toString | true | NO | Java plain only | |
| fluentSetters | false | NO | only when mutable=true, Java only | |
| jsonIgnoreUnknownProperties | false | NO | Java only, when Jackson on classpath | |
| serializableType | NoSerializable | NO | rarely needed | |
| packageName | same package as entity | NO | auto-detected | |
| 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. | |
| 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. | |
| fieldNameOverride (per field) | none | NO | per-field rename | |
| extraValidations (per field) | none | NO | user-added jakarta validators on top of inherited ones | |
| removedValidations (per field) | none | NO | constraints inherited from entity that the user wants dropped | |
| indent | from .editorconfig (fallback 4-space) | NO | see § Indentation below |
Smart defaults: If user says "use defaults", "all defaults", "default settings", or similar -- skip ALL questions where "Always ask?" = NO. Only ask mandatory questions.
Smart answer recognition: When user provides a value instead of choosing from a numbered list, accept it directly. Examples:
- Question "Which entity?" -> user answers "Order" -> this IS the entity, don't re-ask
- Question "Variant?" -> user answers "record" -> this IS Java record, don't show options
- If user provides multiple answers in one message -> accept all, skip answered questions
- NEVER ask a question that the user already answered (even implicitly)
Batch questions: Group closely related questions into a single AskUserQuestion call (up to 4 questions per call) when they:
- Belong to the same logical section (e.g. both are Java method generation settings)
- Don't depend on each other's answers
- Have obvious defaults that the user can skip
Rules:
- Maximum 3-4 questions per
AskUserQuestioncall - Mark the recommended option with
(Recommended)and place it first - Never batch questions from DIFFERENT decision branches
- The primary branching question (entity selection, variant) is always asked ALONE
- Prefer
AskUserQuestionfor choices; fall back to plain text lists only if the tool is unavailable
Decision-making principle — context first, then ask
Before asking the user any question, attempt to derive the answer from the context already gathered: project summary, module dependencies, entity details, existing files in the package, prior turns of this conversation, and the user's original prompt. Only ask when the context yields no clear default or when the choice is genuinely user-specific (e.g. which entity, which fields).
Hierarchy of decisions:
- Context is unambiguous → decide silently, do NOT ask.
Examples: language and JDK from get_project_summary; Lombok / Jackson / Hibernate Validator from list_module_dependencies; package from the entity FQN; className from {Entity}Dto; back-reference @ManyToOne filtering; auto-selection of sub-entity scalars; record vs. plain class when JDK ≥ 16 and no Lombok and the user did not request otherwise. Exception: subDtoType is NEVER decided silently — it always requires at minimum principle 2 (one-line confirmation), unless the USER explicitly stated the shape in their own message (not in ARGUMENTS).
- Context gives a strong signal → state the decision + alternatives in one line, let the user override or stay silent.
Format: `` Will create ScheduleTemplateDto as a Java record with nested SlotDto (record). Alternatives: plain class, Lombok, separate file for SlotDto. OK? `` The user can answer "ok" / "yes" / silence → accept; or name an alternative → switch. This is not the same as the numbered question format — it is a single confirmation line.
- Context yields no clear default → ask with `AskUserQuestion` (preferred) or its analogue, with the recommended option first.
When AskUserQuestion is available, use it with preview fields so the user sees the concrete code shape for each option. Mark the recommended option with (Recommended) in its label and place it first. If no interactive choice tool is available, fall back to a plain text list. Never ask iteratively ("which variant?" → user picks → "which fields?" → …) when one batched call would do.
- Context is fully empty for a critical input → ask plainly.
This applies to: which entity, which fields (when not "all"), the user's intent itself.
How to ask — prefer AskUserQuestion
When a question must be asked, prefer the `AskUserQuestion` tool (or its analogue) over writing a numbered list in the response body. Fall back to plain text only if no interactive choice tool is available.
Rules for AskUserQuestion calls in this skill:
- Each call may contain up to 4 questions that are independent of each
other (the tool will render them together). Use this to batch related decisions in one round-trip.
- Each question has 2–4 options. The tool auto-adds an "Other" choice
for free-form input — never include it manually.
- Mark the recommended option by putting it first with
(Recommended)
appended to the label.
- Use
multiSelect: truefor "which fields to include" or "which
validators to add" — anything where multiple answers are valid.
headeris a 12-char chip label (e.g. "Variant", "Sub-DTO", "Fields").- Each option has a
descriptionexplaining what the choice means or its
consequence (one short sentence).
When AskUserQuestion is not the right tool:
- Free-form input where there is no enumerable set of options
(e.g. arbitrary class name, arbitrary field rename) — ask in plain text.
- The "single confirmation line" form from principle 2 — that is a plain
question with an obvious yes/no, not an enumerated choice.
The screen-driven question lists in Steps 2–5 below are a fallback for case 4. They are NOT a script to execute top-to-bottom. If a question's answer is already determined by principles 1–3, skip the question. Plugin-wizard fidelity is not a goal — generation correctness is. The plugin's UI exists because a screen can show many controls at once; a chat cannot, so the skill must compensate by deciding more on its own.
Step 0 -- Conversation context first (REQUIRED, no tool calls)
Before any MCP call, before any question, re-read the user's prompt and the prior turns of this conversation and extract whatever is already stated. This step costs nothing and prevents the most common failure mode of this skill — asking the user something they already said.
Build a mental checklist of inputs and tick off everything the user has already provided, explicitly or implicitly:
| Input | Look for in the prompt / context | |
|---|---|---|
| entity | a class name (Vet, Owner, ScheduleTemplate); "for X"; an open file in the IDE; a file path; a recently discussed entity in this conversation | |
| purpose | "for REST", "for controller", "for API", "for mapping", "projection", "for service" — drives field selection and the mapper question | |
| fields | "all fields", "only id and name", "without password", "with associations", "flat" | |
| variant | "record", "plain class", "Lombok", "data class" — also implied by language: Kotlin → data class, no question | |
| mapper | "and mapper", "with mapper", "only DTO", "no mapper" | |
| className | "name it OwnerSummaryDto", "class Foo" | |
| package | "in package …", "next to controller" | |
| smart defaults | "use defaults", "all defaults", "default settings", "as usual" | |
| sub-DTO shape | "nested", "separate class", "only id", "flat" | |
| prior project facts | language, JDK, dependencies — already known if discussed earlier in this conversation; do not re-fetch |
For every input that is explicitly or strongly implicitly answered: mark it as decided and skip the corresponding question in Steps 2–7. Do NOT ask "what entity?" if the user wrote "create DTO for Vet" — Vet is the answer. Do NOT ask "Java record or class?" if the user wrote "make record DtoX" — record is the answer.
For every input that is not answered: defer to the Decision-making principle below — try to derive it from project context first (Step 1), and only then ask.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dto-creator/SKILL.md
Popularity
- Repository stars
- 120
- Repository forks
- 14
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 11 Jul 2026, 3 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/amplicode/spring-skills/dto-creator)