java-springboot

bởi github

Hướng dẫn thực hành tốt nhất toàn diện để xây dựng ứng dụng Spring Boot sẵn sàng cho sản xuất. Bao gồm cấu trúc dự án, các mẫu dependency injection, và quản lý cấu hình bao gồm cấu hình ngoại vi, thuộc tính an toàn kiểu, và hồ sơ môi trường. Chi tiết thiết kế tầng web với RESTful API, DTO, xác thực, và xử lý ngoại lệ toàn cục. Đề cập đến tính không trạng thái của tầng dịch vụ, quản lý giao dịch, và các mẫu truy cập dữ liệu sử dụng Spring Data JPA với truy vấn tùy chỉnh và phép chiếu...

npx skills add https://github.com/github/awesome-copilot --skill java-springboot

Spring Boot application development

Opinionated rules plus a router to deeper references. Code samples in the references were compiled and run on Spring Boot 4.1.1 (Spring Framework 7) and, where they differ, on Boot 3.5.16 (Framework 6.2). Boot 3 vs 4 differences are marked "Boot 3" / "Boot 4" in each reference.

Before writing code

  1. Detect, do not assume: read pom.xml/build.gradle(.kts) for the Spring Boot version, Java version, starters in use (spring-boot-starter-web is Boot 3, spring-boot-starter-webmvc is Boot 4), persistence (JPA, JDBC), the migration tool, the test setup, and the package layout and naming conventions of the existing code. Match them.
  2. Never upgrade Spring Boot, Java or dependencies implicitly. A Boot 3 -> 4 move is a deliberate task (spring-boot-4-migration).
  3. Ask before adding infrastructure: a broker (Kafka, RabbitMQ), a cache provider, a new database, or a scheduler/async setup. Add only what the user requested, with the Boot-managed version (no explicit version for BOM-managed artifacts, never latest).
  4. Verify every change with the project's own build: ./mvnw verify or ./gradlew build (plain mvn/gradle if no wrapper). Integration tests need Docker when they use Testcontainers.

Router

TaskRead
Repositories, projections, pagination, N+1, @Transactional, auditing, Flyway/Liquibase, Spring Data JDBCreferences/data.md
Controllers, validation, ProblemDetail, RestClient, @HttpExchange, API versioning, OpenAPI, JSpecifyreferences/rest-api.md
Kafka/AMQP, @Cacheable/Caffeine, @Scheduled, @Async, virtual threads, outboxreferences/messaging-caching.md
@ConfigurationProperties, profiles, secrets, config import, Docker Compose / Testcontainers at dev timereferences/configuration.md
AOT, CDS/AppCDS, lazy initialization, native imagereferences/aot-and-startup.md

If these standalone skills are installed, also use them for their topic; otherwise rely on the official docs: java-hibernate-jpa (JPA mapping), spring-boot-testing (tests), spring-security (authentication, authorization, CSRF/CORS), spring-observability (metrics, tracing, Actuator, logs), create-spring-boot-java-project (project defaults, Boot 3 vs 4 build changes), java-add-graalvm-native-image-support (native executable).

Core rules

  • Structure and layers: package by feature; constructor injection; controllers return DTOs/records, never entities; services own the transaction.
  • Validation and errors: Bean Validation on request records with @Valid; one @RestControllerAdvice returning ProblemDetail. JSpecify annotations document nullability only and do not validate.
  • Jackson: Boot 4 uses Jackson 3 (tools.jackson.databind.*, JsonMapper; annotations stay in com.fasterxml.jackson.annotation); Boot 3 uses Jackson 2 (com.fasterxml.jackson.databind.*, ObjectMapper).
  • Slice-test gotcha: put @EnableJpaAuditing, @EnableCaching, @EnableAsync, @EnableScheduling on dedicated @Configuration classes, not on the @SpringBootApplication class, or slices such as @DataJpaTest fail to start (for example, no CacheManager). Slices do not scan @Configuration classes: @Import the one a test needs.
  • Proxied beans: @Cacheable, @Async and @Transactional work through proxies: they do nothing on self-invocation or on private/final methods; test them through the injected bean.

Checklist

  • Versions, build tool and conventions detected; starters match the Boot major
  • No new infrastructure or dependency without the user's agreement
  • ./mvnw verify / ./gradlew build passes; secrets absent from code, properties and logs

See also: Spring Boot reference https://docs.spring.io/spring-boot/reference/, Spring Framework reference https://docs.spring.io/spring-framework/reference/, Spring Data https://docs.spring.io/spring-data/commons/reference/.

Thêm skills từ github

debugging-workflows
github
Hướng dẫn gỡ lỗi các quy trình tác nhân GitHub - phân tích nhật ký, kiểm tra lần chạy và khắc phục sự cố
go-codemod
github
Triển khai và kiểm thử các codemod Go cho lệnh gh aw fix.
acreadiness-policy
github
Giúp người dùng chọn, viết hoặc áp dụng chính sách AgentRC. Chính sách tùy chỉnh điểm sẵn sàng bằng cách tắt các kiểm tra không liên quan, ghi đè mức độ tác động/cấp độ, thiết lập…
ai-ready
github
Biến bất kỳ kho lưu trữ nào thành sẵn sàng cho AI — phân tích mã nguồn của bạn và tạo ra AGENTS.md, copilot-instructions.md, quy trình CI, mẫu issue, và nhiều hơn nữa. Khai thác đánh giá PR của bạn…
create-oo-component-documentation
github
Tạo tài liệu toàn diện, chuẩn hóa cho các thành phần hướng đối tượng, tuân theo các phương pháp thực hành tốt nhất trong ngành và tiêu chuẩn tài liệu kiến trúc.
dependabot
github
Dependabot là công cụ quản lý phụ thuộc tích hợp sẵn của GitHub với ba khả năng cốt lõi:
doublecheck
github
Quy trình xác minh ba lớp cho đầu ra AI. Trích xuất các tuyên bố có thể kiểm chứng, tìm nguồn hỗ trợ hoặc mâu thuẫn qua tìm kiếm web, thực hiện đánh giá đối kháng…
foundry-agent-sync
github
Tạo và đồng bộ hóa các tác nhân AI dựa trên prompt trực tiếp trong Azure AI Foundry thông qua REST API, từ một tệp kê khai JSON cục bộ. Không giống như các kỹ năng scaffolding chỉ…