К основному содержанию
скилл GitHub Copilot официальный · GitHub

java-springboot скилл для GitHub Copilot: установка

Задаёт практики разработки Spring Boot-приложений: от структуры проекта до тестов и безопасности. Пригодится, когда Copilot пишет или проверяет Java-код.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add github/awesome-copilot --skill java-springboot -a claude-code
Открыть на GitHub

Что делает java-springboot

Скилл направляет GitHub Copilot при работе со Spring Boot. Он предлагает Maven или Gradle, стартеры Spring Boot и структуру пакетов по доменам. Для зависимостей рекомендует конструкторную инъекцию с полями private final.

В веб-слое скилл советует DTO, Bean Validation и общий обработчик ошибок через @ControllerAdvice. Для данных описывает Spring Data JPA, JpaRepository, @Query и DTO-проекции. Конфигурацию предлагает хранить в application.yml, разделять профилями и выносить секреты в переменные окружения либо HashiCorp Vault или AWS Secrets Manager.

Он также покрывает SLF4J, JUnit 5, Mockito, @SpringBootTest, тестовые срезы и Testcontainers. Есть рекомендации по Spring Security, BCrypt и защите от SQL injection и XSS. Скилл стоит ставить командам, которые хотят закрепить единые правила для Spring Boot-кода; для проектов без Spring Boot он не нужен.

Какие задачи решает

  • разложить Spring Boot-код по доменам
  • настроить DTO и валидацию запросов
  • вынести конфигурацию и секреты из кода
  • написать тесты с JUnit 5 и Mockito
  • защитить API через Spring Security

Примеры запросов агенту

  • «Создай REST-контроллер Spring Boot с DTO и `@Valid`.»
  • «Проверь сервис на корректность `@Transactional` и конструкторной инъекции.»
  • «Напиши `@DataJpaTest` для репозитория на `JpaRepository`.»

Как установить java-springboot

1Через Skills CLI (Vercel)

npx skills add github/awesome-copilot --skill java-springboot -a claude-code

2Вручную: положить файлы

~/.claude/skills/java-springboot/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/java-springboot/

Похожие

mcp-builder официальный anthropics Скилл проводит через создание MCP-сервера на TypeScript или Python: от изучения протокола до тестов и оценки качества. Claude Code Claude.ai 130 949установок typescript-advanced-types Seth Hobson Помогает агенту писать сложную типизацию TypeScript: generics, conditional types и преобразования типов. Нужен для библиотек, API-клиентов и строгих конфигураций. Claude Code CX Codex Cursor 92 169установок microsoft-code-reference официальный github Проверяет Microsoft API и SDK по официальной документации, ищет рабочие примеры и помогает разбирать ошибки в Azure и .NET-коде. GitHub Copilot 14 251установок typescript-mcp-server-generator официальный github Генерирует TypeScript-проект MCP-сервера с инструментами, ресурсами и конфигурацией. Пригодится, когда нужно быстро заложить сервер на MCP TypeScript SDK v2. GitHub Copilot 12 050установок dotnet-design-pattern-review официальный github Проверяет выбранный C#/.NET-код на применение паттернов проектирования и предлагает правки без изменения файлов. Подходит для ревью архитектуры проекта. GitHub Copilot 11 609установок python-mcp-server-generator официальный github Создаёт Python MCP-серверы для подключения функций, API или базы данных к ИИ-клиентам. Подходит, когда нужен новый сервер на MCP Python SDK v2. GitHub Copilot 10 418установок

Вопросы о java-springboot

Как установить java-springboot в GitHub Copilot?

Выполните npx skills add github/awesome-copilot --skill java-springboot. Также доступна команда gh skill install github/awesome-copilot java-springboot.

Что делает java-springboot?

Это скилл с правилами разработки приложений на Spring Boot. Он охватывает структуру проекта, API, работу с JPA, тестирование, логирование и безопасность.

Как скилл рекомендует хранить конфигурацию и секреты?

Конфигурацию предлагается размещать в application.yml или application.properties и разделять профилями, например application-dev.yml. Секреты не следует встраивать в код: для них подходят переменные окружения, HashiCorp Vault или AWS Secrets Manager.

Исходный текст

SKILL.md · MIT
---
name: java-springboot
description: 'Get best practices for developing applications with Spring Boot.'
---

# Spring Boot Best Practices

Your goal is to help me write high-quality Spring Boot applications by following established best practices.

## Project Setup & Structure

- **Build Tool:** Use Maven (`pom.xml`) or Gradle (`build.gradle`) for dependency management.
- **Starters:** Use Spring Boot starters (e.g., `spring-boot-starter-web`, `spring-boot-starter-data-jpa`) to simplify dependency management.
- **Package Structure:** Organize code by feature/domain (e.g., `com.example.app.order`, `com.example.app.user`) rather than by layer (e.g., `com.example.app.controller`, `com.example.app.service`).

## Dependency Injection & Components

- **Constructor Injection:** Always use constructor-based injection for required dependencies. This makes components easier to test and dependencies explicit.
- **Immutability:** Declare dependency fields as `private final`.
- **Component Stereotypes:** Use `@Component`, `@Service`, `@Repository`, and `@Controller`/`@RestController` annotations appropriately to define beans.

## Configuration

- **Externalized Configuration:** Use `application.yml` (or `application.properties`) for configuration. YAML is often preferred for its readability and hierarchical structure.
- **Type-Safe Properties:** Use `@ConfigurationProperties` to bind configuration to strongly-typed Java objects.
- **Profiles:** Use Spring Profiles (`application-dev.yml`, `application-prod.yml`) to manage environment-specific configurations.
- **Secrets Management:** Do not hardcode secrets. Use environment variables, or a dedicated secret management tool like HashiCorp Vault or AWS Secrets Manager.

## Web Layer (Controllers)

- **RESTful APIs:** Design clear and consistent RESTful endpoints.
- **DTOs (Data Transfer Objects):** Use DTOs to expose and consume data in the API layer. Do not expose JPA entities directly to the client.
- **Validation:** Use Java Bean Validation (JSR 380) with annotations (`@Valid`, `@NotNull`, `@Size`) on DTOs to validate request payloads.
- **Error Handling:** Implement a global exception handler using `@ControllerAdvice` and `@ExceptionHandler` to provide consistent error responses.

## Service Layer

- **Business Logic:** Encapsulate all business logic within `@Service` classes.
- **Statelessness:** Services should be stateless.
- **Transaction Management:** Use `@Transactional` on service methods to manage database transactions declaratively. Apply it at the most granular level necessary.

## Data Layer (Repositories)

- **Spring Data JPA:** Use Spring Data JPA repositories by extending `JpaRepository` or `CrudRepository` for standard database operations.
- **Custom Queries:** For complex queries, use `@Query` or the JPA Criteria API.
- **Projections:** Use DTO projections to fetch only the necessary data from the database.

## Logging

- **SLF4J:** Use the SLF4J API for logging.
- **Logger Declaration:** `private static final Logger logger = LoggerFactory.getLogger(MyClass.class);`
- **Parameterized Logging:** Use parameterized messages (`logger.info("Processing user {}...", userId);`) instead of string concatenation to improve performance.

## Testing

- **Unit Tests:** Write unit tests for services and components using JUnit 5 and a mocking framework like Mockito.
- **Integration Tests:** Use `@SpringBootTest` for integration tests that load the Spring application context.
- **Test Slices:** Use test slice annotations like `@WebMvcTest` (for controllers) or `@DataJpaTest` (for repositories) to test specific parts of the application in isolation.
- **Testcontainers:** Consider using Testcontainers for reliable integration tests with real databases, message brokers, etc.

## Security

- **Spring Security:** Use Spring Security for authentication and authorization.
- **Password Encoding:** Always encode passwords using a strong hashing algorithm like BCrypt.
- **Input Sanitization:** Prevent SQL injection by using Spring Data JPA or parameterized queries. Prevent Cross-Site Scripting (XSS) by properly encoding output.

© github · MIT · github/awesome-copilot

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой