spring-boot-crud-patterns_skill

This skill helps you implement feature-aligned CRUD services in Spring Boot 3.5+, aligning aggregates, repositories, and controllers with clean DTOs.
  • Python

99

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill giuseppe-trisciuoglio/developer-kit --skill spring-boot-crud-patterns

  • SKILL.md9.9 KB

Overview

This skill provides repeatable CRUD workflows and patterns for Spring Boot 3 services using Spring Data JPA and a feature-focused architecture. It guides you to structure feature packages, model aggregates, declare repository ports, implement JPA adapters, and expose REST APIs with validated DTOs. The patterns prioritize domain boundaries, testability, and standard HTTP semantics for REST endpoints.

How this skill works

The skill inspects and prescribes a step-by-step architecture: domain, application, presentation, and infrastructure layers per feature. It defines domain-first aggregates and repository ports, shows how to implement Spring Data adapters and controllers, and recommends DTOs, validation, transaction boundaries, and testing strategies. It also includes generator tooling to scaffold boilerplate from an entity spec and references for progressive examples.

When to use it

  • Implement REST create/read/update/delete endpoints backed by JPA and Spring Data.
  • Refactor a monolith into feature-aligned packages and DDD-inspired aggregates.
  • Add DTO records, input validation, and consistent controller mappings for external clients.
  • Diagnose repository contracts, transaction boundaries, or pagination regressions.
  • Scaffold CRUD boilerplate from an entity specification for fast feature delivery.

Best practices

  • Colocate domain, application, presentation, and infrastructure per feature to preserve boundaries.
  • Keep domain objects framework-free; use adapters to translate to JPA entities.
  • Use immutable DTOs (Java records) and jakarta.validation annotations at the API boundary.
  • Wrap write use cases in @Transactional services and protect concurrency with optimistic locking when needed.
  • Write unit tests for domain logic and use @DataJpaTest with Testcontainers for persistence verification.

Example use cases

  • Create a Product feature with Product aggregate, ProductRepository port, ProductEntity adapter, ProductService, and ProductController mapped to /api/products.
  • Add pagination and sorting to a list endpoint using Spring Data Pageable and standardized page/size defaults.
  • Refine an existing controller to stop returning JPA entities directly and replace with mapped DTOs to avoid lazy-loading and serialization leaks.
  • Generate CRUD boilerplate from a JSON spec using the included Python generator and customize templates for your package layout.
  • Write integration tests that validate JPA mapping, repository queries, and transactional behavior with Testcontainers.

FAQ

Yes. The guidance assumes Spring Boot 3.5+ and Java 17+ features such as records and modern Jakarta APIs.

Can I expose JPA entities directly in controllers?

No. Avoid exposing JPA entities; map to immutable DTOs to prevent lazy-loading issues and leaking persistence concerns to API clients.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
spring-boot-crud-patterns skill by giuseppe-trisciuoglio/developer-kit | VeilStrat