amplicode/spring-skills/crud-rest-controller
Claude Code and agent skill by amplicode/spring-skills
- community
Checking that the SKILL.md file is still in the repository.
Creates a Spring REST controller with CRUD endpoints backed by a Spring Data repository. Use this skill when a CRUD controller needs to be created, either standalone or as part of a larger task.
Install
npx vskill@latest install amplicode/spring-skills/crud-rest-controllerSKILL.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."
CRUD REST Controller
Generates a @RestController class with standard CRUD endpoints for an entity, using a Spring Data repository, optional DTO mapping, pagination, filtering, and patch support.
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–4 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.
Defaults
The options below are grouped by topic. language and bootVersion are auto-detected; all other options are resolved via the Decision-making principle (derive from context → confirm → ask).
Block 1 — Entity & repository
| Option | Default | Notes | |
|---|---|---|---|
| entity | -- | which entity to create controller for | |
| repository | first existing for entity | which repository to use |
Block 2 — DTO mode
| Option | Default | Notes | |
|---|---|---|---|
| DTO mode | DTO (recommended) | if no existing DTO for entity, delegate to dto-creator; user can opt out to use entity directly |
Block 3 — Controller naming & paths
| Option | Default | Notes | |
|---|---|---|---|
| controllerName | {EntityName}Controller | suggest based on project naming convention | |
| controllerPackage | same as existing controllers or mainPackage | auto-detected from project | |
| basePath | /rest | persistent base path | |
| resourcePath | /{pluralizedEntityName} | auto from entity name |
Block 4 — Pagination & filtering
| Option | Default | Notes | |
|---|---|---|---|
| pagination | true | enable pagination for GET_LIST | |
| paginationType | PAGE | PAGE or WINDOW (WINDOW requires filter to be selected; avoids count query overhead) | |
| filter | None | JPA Specification filter for GET_LIST |
Auto-detected (no questions)
| Option | Source | |
|---|---|---|
| patchStrategy | ObjectMapper | |
| language | get_project_summary | |
| bootVersion | get_project_summary |
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 "Product" --> this IS the entity, don't re-ask
- Question "Repository?" --> user answers "ProductRepository" --> this IS the choice
- 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: When multiple questions must be asked (i.e. cannot be resolved by principles 1–2 of the Decision-making principle), group them into a single AskUserQuestion call (up to 4 questions per call) when they:
- Belong to the same logical section
- Don't depend on each other's answers
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) 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 repository).
Hierarchy of decisions:
- Context is unambiguous → decide silently, do NOT ask.
Examples: language and JDK from get_project_summary; repository when there is exactly one for the entity; controller package from existing controllers; basePath from existing endpoints; Jackson version from list_module_dependencies; pagination type when project already uses one consistently.
- Context gives a strong signal → state the decision + alternatives in one line, let the user override or stay silent.
Format: `` Will create ProductController at /rest/products with Page pagination, no DTO. Alternatives: use DTO, Window pagination, custom paths. 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 the recommended option marked (Recommended) and placed first. If no interactive choice tool is available, fall back to a plain text list. Never ask iteratively ("which entity?" → user picks → "repository?" → …) when one batched call would do.
- Context is fully empty for a critical input → ask plainly.
This applies to: which entity (when not mentioned), 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.
headeris a 12-char chip label (e.g. "Entity", "DTO mode", "Paths").- Each option has a
descriptionexplaining what the choice means.
When AskUserQuestion is not the right tool:
- Free-form input where there is no enumerable set of options
(e.g. arbitrary class name, arbitrary path) — 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–4 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.
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 (Product, Order, Vet); "for X"; an open file in the IDE; a file path; a recently discussed entity in this conversation | |
| repository | "use ProductRepository", "with OrderRepo"; or implied — if only one repository exists for the entity | |
| DTO mode | "with DTO", "without DTO", "use entity directly", "map to ProductDto" | |
| controller name | "name it ProductResource", "class FooController" | |
| paths | "at /api/products", "base path /rest", "resource path /items" | |
| pagination | "with pagination", "no pagination", "use Window", "use Page" | |
| filter | "with filter", "no filter", "use JPA Specification" | |
| methods | "all CRUD", "only read", "read-only", "without delete", "GET + CREATE", "full CRUD" | |
| smart defaults | "use defaults", "all defaults", "default settings", "as usual" | |
| 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–4. Do NOT ask "which entity?" if the user wrote "create CRUD controller for Product" — Product is the answer. Do NOT ask "which repository?" if there is exactly one repository for the entity.
For every input that is not answered: defer to the Decision-making principle above — try to derive it from project context first (Step 1), and only then ask.
Step 0 is mental, not a tool call. Do not announce it to the user. Do not write "Step 0 done". Just internalize what the user already said before proceeding to Step 1.
Step 1 -- Gather minimal project context (automatic, no questions)
Call only the MCP tools whose result is actually consumed by a later step. Do not pre-fetch "in case we need it" — every variable here must have a concrete downstream user.
| Tool | Variable | Used for | |
|---|---|---|---|
get_project_summary | language, bootMajor, moduleName, buildFile, mainPackage | language → reference file selection (java vs kotlin); bootMajor → jakarta vs javax, Jackson version; moduleName → multi-module disambiguation; buildFile → Step 6 dependency injection; mainPackage → controller package fallback | |
list_module_dependencies(moduleName) | presentDeps | derived flags below — SpringDoc/Validation/Jackson feature gates, Step 6 dependency check | |
list_project_endpoints | endpoints | Step 4 path conflict detection, existing basePath/naming convention detection |
That is the entire Step 1. Do NOT fetch:
list_all_domain_entities— needed only if the user did not name an
entity in their prompt. Defer to Step 2 as a lazy fallback.
list_entity_repositories— depends on knowing the entity, which
happens in Step 2. Defer to Step 3 as a lazy fallback.
get_entity_details— depends on knowing the entity. Defer to Step 2.list_entity_dtos/list_entity_mappers— depend on knowing the
entity AND the DTO decision. Defer to Step 4.
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/crud-rest-controller/SKILL.md
Popularity
- Repository stars
- 80
- Repository forks
- 7
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 25 May 2026, 5 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/crud-rest-controller)