{"id":"4b584f88-ed82-4733-8ced-b78948f7e929","shortId":"dh5BtQ","kind":"skill","title":"java-springboot","tagline":"Get best practices for developing applications with Spring Boot.","description":"# Spring Boot Best Practices\n\nYour goal is to help me write high-quality Spring Boot applications by following established best practices.\n\n## Project Setup & Structure\n\n- **Build Tool:** Use Maven (`pom.xml`) or Gradle (`build.gradle`) for dependency management.\n- **Starters:** Use Spring Boot starters (e.g., `spring-boot-starter-web`, `spring-boot-starter-data-jpa`) to simplify dependency management.\n- **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`).\n\n## Dependency Injection & Components\n\n- **Constructor Injection:** Always use constructor-based injection for required dependencies. This makes components easier to test and dependencies explicit.\n- **Immutability:** Declare dependency fields as `private final`.\n- **Component Stereotypes:** Use `@Component`, `@Service`, `@Repository`, and `@Controller`/`@RestController` annotations appropriately to define beans.\n\n## Configuration\n\n- **Externalized Configuration:** Use `application.yml` (or `application.properties`) for configuration. YAML is often preferred for its readability and hierarchical structure.\n- **Type-Safe Properties:** Use `@ConfigurationProperties` to bind configuration to strongly-typed Java objects.\n- **Profiles:** Use Spring Profiles (`application-dev.yml`, `application-prod.yml`) to manage environment-specific configurations.\n- **Secrets Management:** Do not hardcode secrets. Use environment variables, or a dedicated secret management tool like HashiCorp Vault or AWS Secrets Manager.\n\n## Web Layer (Controllers)\n\n- **RESTful APIs:** Design clear and consistent RESTful endpoints.\n- **DTOs (Data Transfer Objects):** Use DTOs to expose and consume data in the API layer. Do not expose JPA entities directly to the client.\n- **Validation:** Use Java Bean Validation (JSR 380) with annotations (`@Valid`, `@NotNull`, `@Size`) on DTOs to validate request payloads.\n- **Error Handling:** Implement a global exception handler using `@ControllerAdvice` and `@ExceptionHandler` to provide consistent error responses.\n\n## Service Layer\n\n- **Business Logic:** Encapsulate all business logic within `@Service` classes.\n- **Statelessness:** Services should be stateless.\n- **Transaction Management:** Use `@Transactional` on service methods to manage database transactions declaratively. Apply it at the most granular level necessary.\n\n## Data Layer (Repositories)\n\n- **Spring Data JPA:** Use Spring Data JPA repositories by extending `JpaRepository` or `CrudRepository` for standard database operations.\n- **Custom Queries:** For complex queries, use `@Query` or the JPA Criteria API.\n- **Projections:** Use DTO projections to fetch only the necessary data from the database.\n\n## Logging\n\n- **SLF4J:** Use the SLF4J API for logging.\n- **Logger Declaration:** `private static final Logger logger = LoggerFactory.getLogger(MyClass.class);`\n- **Parameterized Logging:** Use parameterized messages (`logger.info(\"Processing user {}...\", userId);`) instead of string concatenation to improve performance.\n\n## Testing\n\n- **Unit Tests:** Write unit tests for services and components using JUnit 5 and a mocking framework like Mockito.\n- **Integration Tests:** Use `@SpringBootTest` for integration tests that load the Spring application context.\n- **Test Slices:** Use test slice annotations like `@WebMvcTest` (for controllers) or `@DataJpaTest` (for repositories) to test specific parts of the application in isolation.\n- **Testcontainers:** Consider using Testcontainers for reliable integration tests with real databases, message brokers, etc.\n\n## Security\n\n- **Spring Security:** Use Spring Security for authentication and authorization.\n- **Password Encoding:** Always encode passwords using a strong hashing algorithm like BCrypt.\n- **Input Sanitization:** Prevent SQL injection by using Spring Data JPA or parameterized queries. Prevent Cross-Site Scripting (XSS) by properly encoding output.","tags":["java","springboot","awesome","copilot","github","agent-skills","agents","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"capabilities":["skill","source-github","skill-java-springboot","topic-agent-skills","topic-agents","topic-awesome","topic-custom-agents","topic-github-copilot","topic-hacktoberfest","topic-prompt-engineering"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/java-springboot","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add github/awesome-copilot","source_repo":"https://github.com/github/awesome-copilot","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 33270 github stars · SKILL.md body (4,021 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:52:15.391Z","embedding":null,"createdAt":"2026-04-18T20:24:42.194Z","updatedAt":"2026-05-18T18:52:15.391Z","lastSeenAt":"2026-05-18T18:52:15.391Z","tsv":"'380':239 '5':393 'algorithm':469 'alway':91,462 'annot':125,241,418 'api':202,222,334,353 'appli':295 'applic':9,29,411,433 'application-dev.yml':168 'application-prod.yml':169 'application.properties':136 'application.yml':134 'appropri':126 'authent':457 'author':459 'aw':195 'base':95 'bcrypt':471 'bean':129,236 'best':5,15,33 'bind':156 'boot':12,14,28,52,57,62 'broker':448 'build':38 'build.gradle':45 'busi':269,273 'class':277 'clear':204 'client':232 'code':73 'com.example.app.controller':84 'com.example.app.order':77 'com.example.app.service':85 'com.example.app.user':78 'complex':326 'compon':88,102,116,119,390 'concaten':377 'configur':130,132,138,157,175 'configurationproperti':154 'consid':437 'consist':206,264 'constructor':89,94 'constructor-bas':93 'consum':218 'context':412 'control':123,200,422 'controlleradvic':259 'criteria':333 'cross':487 'cross-sit':486 'crudrepositori':318 'custom':323 'data':64,210,219,303,307,311,344,480 'databas':292,321,347,446 'datajpatest':424 'declar':110,294,357 'dedic':187 'defin':128 'depend':47,68,86,99,107,111 'design':203 'develop':8 'direct':229 'dto':337 'dtos':209,214,246 'e.g':54,76,83 'easier':103 'encapsul':271 'encod':461,463,493 'endpoint':208 'entiti':228 'environ':173,183 'environment-specif':172 'error':251,265 'establish':32 'etc':449 'except':256 'exceptionhandl':261 'explicit':108 'expos':216,226 'extend':315 'extern':131 'feature/domain':75 'fetch':340 'field':112 'final':115,360 'follow':31 'framework':397 'get':4 'global':255 'goal':18 'gradl':44 'granular':300 'handl':252 'handler':257 'hardcod':180 'hash':468 'hashicorp':192 'help':21 'hierarch':147 'high':25 'high-qual':24 'immut':109 'implement':253 'improv':379 'inject':87,90,96,476 'input':472 'instead':374 'integr':400,405,442 'isol':435 'java':2,162,235 'java-springboot':1 'jpa':65,227,308,312,332,481 'jparepositori':316 'jsr':238 'junit':392 'layer':82,199,223,268,304 'level':301 'like':191,398,419,470 'load':408 'log':348,355,366 'logger':356,361,362 'logger.info':370 'loggerfactory.getlogger':363 'logic':270,274 'make':101 'manag':48,69,171,177,189,197,284,291 'maven':41 'messag':369,447 'method':289 'mock':396 'mockito':399 'myclass.class':364 'necessari':302,343 'notnul':243 'object':163,212 'often':141 'oper':322 'organ':72 'output':494 'packag':70 'parameter':365,368,483 'part':430 'password':460,464 'payload':250 'perform':380 'pom.xml':42 'practic':6,16,34 'prefer':142 'prevent':474,485 'privat':114,358 'process':371 'profil':164,167 'project':35,335,338 'proper':492 'properti':152 'provid':263 'qualiti':26 'queri':324,327,329,484 'rather':79 'readabl':145 'real':445 'reliabl':441 'repositori':121,305,313,426 'request':249 'requir':98 'respons':266 'rest':201,207 'restcontrol':124 'safe':151 'sanit':473 'script':489 'secret':176,181,188,196 'secur':450,452,455 'servic':120,267,276,279,288,388 'setup':36 'simplifi':67 'site':488 'size':244 'skill' 'skill-java-springboot' 'slf4j':349,352 'slice':414,417 'source-github' 'specif':174,429 'spring':11,13,27,51,56,61,166,306,310,410,451,454,479 'spring-boot-starter-data-jpa':60 'spring-boot-starter-web':55 'springboot':3 'springboottest':403 'sql':475 'standard':320 'starter':49,53,58,63 'stateless':278,282 'static':359 'stereotyp':117 'string':376 'strong':160,467 'strongly-typ':159 'structur':37,71,148 'test':105,381,383,386,401,406,413,416,428,443 'testcontain':436,439 'tool':39,190 'topic-agent-skills' 'topic-agents' 'topic-awesome' 'topic-custom-agents' 'topic-github-copilot' 'topic-hacktoberfest' 'topic-prompt-engineering' 'transact':283,286,293 'transfer':211 'type':150,161 'type-saf':149 'unit':382,385 'use':40,50,92,118,133,153,165,182,213,234,258,285,309,328,336,350,367,391,402,415,438,453,465,478 'user':372 'userid':373 'valid':233,237,242,248 'variabl':184 'vault':193 'web':59,198 'webmvctest':420 'within':275 'write':23,384 'xss':490 'yaml':139","prices":[{"id":"13a18351-afde-40fc-ae6b-6f4bbe28b326","listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"github","category":"awesome-copilot","install_from":"skills.sh"},"createdAt":"2026-04-18T20:24:42.194Z"}],"sources":[{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","source":"github","sourceId":"github/awesome-copilot/java-springboot","sourceUrl":"https://github.com/github/awesome-copilot/tree/main/skills/java-springboot","isPrimary":false,"firstSeenAt":"2026-04-18T21:49:58.585Z","lastSeenAt":"2026-05-18T18:52:15.391Z"},{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","source":"skills_sh","sourceId":"github/awesome-copilot/java-springboot","sourceUrl":"https://skills.sh/github/awesome-copilot/java-springboot","isPrimary":true,"firstSeenAt":"2026-04-18T20:24:42.194Z","lastSeenAt":"2026-05-07T22:40:15.220Z"}],"details":{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"github","slug":"java-springboot","github":{"repo":"github/awesome-copilot","stars":33270,"topics":["agent-skills","agents","ai","awesome","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"license":"mit","html_url":"https://github.com/github/awesome-copilot","pushed_at":"2026-05-18T01:26:59Z","description":"Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.","skill_md_sha":"39ae2e5f13de608cfac6e4fb15bb7842bd413215","skill_md_path":"skills/java-springboot/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/github/awesome-copilot/tree/main/skills/java-springboot"},"layout":"multi","source":"github","category":"awesome-copilot","frontmatter":{"name":"java-springboot","description":"Get best practices for developing applications with Spring Boot."},"skills_sh_url":"https://skills.sh/github/awesome-copilot/java-springboot"},"updatedAt":"2026-05-18T18:52:15.391Z"}}