$npx -y skills add Amplicode/spring-skills --skill spring-security-configurationCreates a Spring Security configuration class with authentication, authorization, and HTTP protection setup. Use this skill when a security configuration needs to be created, either standalone or as part of a larger task (e.g. adding authentication to a REST API, configuring OAut
| 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 | # Spring Security Configuration |
| 12 | |
| 13 | Generates a `@Configuration @EnableWebSecurity` class with a `filterChain()` method, DSL chains for authentication and authorization, beans, dependencies, and properties in application.properties. |
| 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 | | Authentication type | — | YES | main branching | |
| 28 | | Disable CSRF | no | NO | | |
| 29 | | Disable headers | no | NO | | |
| 30 | | Disable anonymous access | no | NO | | |
| 31 | | Authorization rules | anyRequest().authenticated() | NO | | |
| 32 | | language | from `get_project_summary` | NO | auto-detected | |
| 33 | | bootVersion | from `get_project_summary` | NO | auto-detected | |
| 34 | | className | SecurityConfiguration | NO | suggest, confirm only | |
| 35 | | packageName | same as existing @Configuration | NO | auto-detected | |
| 36 | | appPrefix | from existing `@Value` properties or `app` | NO | auto-detected from project | |
| 37 | |
| 38 | **Smart defaults:** If user says "use defaults", "all defaults", "default settings", |
| 39 | or similar -- skip ALL questions where "Always ask?" = NO. Only ask mandatory questions. |
| 40 | |
| 41 | **Smart answer recognition:** When user provides a value instead of choosing from a numbered |
| 42 | list, accept it directly. Examples: |
| 43 | - Question "Authentication type?" -> user answers "jwt" -> this IS the choice, don't show options |
| 44 | - Question "Client ID?" -> user answers "my-app" -> this IS the value, don't re-ask |
| 45 | - If user provides multiple answers in one message -> accept all, skip answered questions |
| 46 | - NEVER ask a question that the user already answered (even implicitly) |
| 47 | |
| 48 | **Batch questions:** Group closely related questions into a single |
| 49 | `AskUserQuestion` call (up to 4 questions per call) when they: |
| 50 | - Belong to the same logical section (e.g. both are connection settings) |
| 51 | - Don't depend on each other's answers |
| 52 | - Have obvious defaults that the user can skip |
| 53 | |
| 54 | Rules: |
| 55 | - Maximum **3-4 questions** per `AskUserQuestion` call |
| 56 | - Mark the recommended option with `(Recommended)` and place it first |
| 57 | - Never batch questions from DIFFERENT decision branches |
| 58 | - The primary branching question (authentication type) is always asked ALONE |
| 59 | - Prefer `AskUserQuestion` for choices; fall back to plain text lists only if the tool is unavailable |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ## Decision-making principle — context first, then ask |
| 64 | |
| 65 | Before asking the user **any** question, attempt to derive the answer from |
| 66 | the context already gathered: project summary, module dependencies, existing |
| 67 | security configurations, prior turns of this conversation, and the user's |
| 68 | original prompt. Only ask when the context yields **no clear default** or |
| 69 | when the choice is genuinely user-specific (e.g. authentication type, |
| 70 | authorization rules). |
| 71 | |
| 72 | Hierarchy of decisions: |
| 73 | |
| 74 | 1. **Context is unambiguous → decide silently, do NOT ask.** |
| 75 | Exam |