add-entity

Generate entity, repository, Flyway migration, and wiring for Spring Boot 4 persistence.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-entity-dprice-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-entity
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/add-entity
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-entity-dprice-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Adds a persistence layer to an existing Spring Boot 4 project by generating the full, consistent stack needed to store a new domain model in a database, including schema migrations and reliable automated tests.

Core Features & Use Cases

  • JPA or Spring Data JDBC choice: Implements either Hibernate-based JPA or aggregate-root-oriented Spring Data JDBC for the same “entity to database table” goal.
  • Flyway-first schema management: Creates the required Flyway migration and configures the project so production never relies on ddl-auto.
  • Complete test coverage across layers: Produces unit tests for contracts and business rules, component tests with Testcontainers for repository correctness and constraints, optional e2e coverage, and acceptance/Pact state patterns for higher confidence.
  • Safety guardrails: Avoids using the skill for scaffolding endpoints or new project generation, assuming the codebase already passes ./gradlew check.

Quick Start

Use the add-entity skill when you need to “add persistence for a new domain model that maps to a database table in an existing Spring Boot 4 service.”

Frequently Asked Questions about add-entity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a JPA entity and repository to an existing Spring Boot 4 project?▼

To add a JPA entity and repository in Spring Boot 4, you need to generate the entity class, repository interface, and required wiring. This approach also creates a Flyway migration and Testcontainers integration tests to verify repository constraints and behavior.

Should I use JPA or Spring Data JDBC for my Spring Boot persistence layer?▼

Choosing between JPA and Spring Data JDBC depends on your domain model structure. JPA suits Hibernate-based object-relational mapping, while Spring Data JDBC is better for aggregate-root-oriented persistence, and both can be configured with Flyway migrations and Testcontainers tests.

How do I configure Flyway migrations for a new database table in Spring Boot?▼

Configuring Flyway migrations for a new database table involves creating the required SQL migration script and setting up the datasource so production never relies on Hibernate ddl-auto, ensuring safe schema management alongside your Spring Boot entities.

How do I test Spring Data JDBC repositories with Testcontainers?▼

Testing Spring Data JDBC or JPA repositories with Testcontainers involves running component tests against a real database instance to verify repository correctness and database constraints, ensuring your persistence layer behaves as expected across unit and component layers.

Can I use this to scaffold a new Spring Boot 4 service from scratch?▼

No, this approach is not intended for scaffolding new projects or generating endpoints. It assumes you already have an existing Spring Boot 4 codebase that passes ./gradlew check and only needs a new persistence layer added to store domain models.

How do I map JPA entities to DTOs in a Spring Boot service layer?▼

Mapping JPA entities to DTOs in a Spring Boot service layer involves creating mapping logic within the service to translate persisted domain objects, ensuring separation between the persistence model and external data contracts while maintaining aggregate root integrity.