$npx -y skills add Amplicode/spring-skills --skill crud-rest-controllerCreates 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.
| 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 | # CRUD REST Controller |
| 12 | |
| 13 | Generates a `@RestController` class with standard CRUD endpoints for an entity, |
| 14 | using a Spring Data repository, optional DTO mapping, pagination, filtering, and patch support. |
| 15 | |
| 16 | --- |
| 17 | |
| 18 | > **CRITICAL: Code ONLY from examples/ files. If no matching example -- STOP and ask user.** |
| 19 | > **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.** |
| 20 | > **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. |
| 21 | |
| 22 | --- |
| 23 | |
| 24 | ## Defaults |
| 25 | |
| 26 | The options below are grouped by topic. `language` and `bootVersion` are |
| 27 | auto-detected; all other options are resolved via the Decision-making |
| 28 | principle (derive from context → confirm → ask). |
| 29 | |
| 30 | ### Block 1 — Entity & repository |
| 31 | |
| 32 | | Option | Default | Notes | |
| 33 | |--------|---------|-------| |
| 34 | | entity | -- | which entity to create controller for | |
| 35 | | repository | first existing for entity | which repository to use | |
| 36 | |
| 37 | ### Block 2 — DTO mode |
| 38 | |
| 39 | | Option | Default | Notes | |
| 40 | |--------|---------|-------| |
| 41 | | DTO mode | DTO (recommended) | if no existing DTO for entity, delegate to `dto-creator`; user can opt out to use entity directly | |
| 42 | |
| 43 | ### Block 3 — Controller naming & paths |
| 44 | |
| 45 | | Option | Default | Notes | |
| 46 | |--------|---------|-------| |
| 47 | | controllerName | `{EntityName}Controller` | suggest based on project naming convention | |
| 48 | | controllerPackage | same as existing controllers or mainPackage | auto-detected from project | |
| 49 | | basePath | `/rest` | persistent base path | |
| 50 | | resourcePath | `/{pluralizedEntityName}` | auto from entity name | |
| 51 | |
| 52 | ### Block 4 — Pagination & filtering |
| 53 | |
| 54 | | Option | Default | Notes | |
| 55 | |--------|---------|-------| |
| 56 | | pagination | true | enable pagination for GET_LIST | |
| 57 | | paginationType | PAGE | PAGE or WINDOW (WINDOW requires filter to be selected; avoids count query overhead) | |
| 58 | | filter | None | JPA Specification filter for GET_LIST | |
| 59 | |
| 60 | ### Auto-detected (no questions) |
| 61 | |
| 62 | | Option | Source | |
| 63 | |--------|--------| |
| 64 | | patchStrategy | ObjectMapper | |
| 65 | | language | `get_project_summary` | |
| 66 | | bootVersion | `get_project_summary` | |
| 67 | |
| 68 | **Smart defaults:** If user says "use defaults", "all defaults", "default settings", |
| 69 | or similar -- skip ALL questions where "Always ask?" = NO. Only ask mandatory questions. |
| 70 | |
| 71 | **Smart answer recognition:** When user provides a value instead of choosing from a numbered |
| 72 | list, accept it directly. Examples: |
| 73 | - Question "Which entity?" --> user answers "Product" --> this IS the entity, don't re-ask |
| 74 | - Question "Repository?" --> user answers "ProductRepository" --> this IS the choice |
| 75 | - If user provides multiple answers in one message --> accept all, skip answered questions |
| 76 | - NEVER ask a question that the user already answered (even implicitly) |
| 77 | |
| 78 | **Batch questions:** When multiple questions must be asked (i.e. cannot be |
| 79 | resolved by principles 1–2 of the Decision-making principle), group them |
| 80 | into a single `AskUserQuestion` call (up to 4 questions per call) when they: |
| 81 | - Belong to the same logical section |
| 82 | - Don't depend on each other's answers |
| 83 | |
| 84 | Rules: |
| 85 | - Maximum **3-4 questions** per `AskUserQuestion` call |
| 86 | - Mark the recommended option with `(Recommended)` and place it first |
| 87 | - Never batch questions from DIFFERENT decision branches |
| 88 | - The primary bran |