Read-heavy endpoints are checked for query efficiency.
Anti-Patterns
Do NOT place persistence logic in controllers/templates.
Do NOT rely on spring.jpa.hibernate.ddl-auto=update in production-like profiles.
Do NOT use database entities as direct response/view contracts.
Do NOT leave transaction boundaries implicit for multi-step writes.
1---2name: spring-data-jpa3description: Skill: spring-data-jpa4---5# Skill: spring-data-jpa67## Type8core910## Purpose1112Provide a consistent persistence layer using Spring Data JPA for Spring Boot applications.1314---1516## When to Use1718Use when application data must be stored in a relational database and accessed through repositories.1920---2122## Rules2324- Keep persistence model separate from web model (DTO/form/view objects).25- Use `@Entity` classes for database mapping; do not use Java `record` for mutable JPA entities.26- Use Spring Data repository interfaces (`JpaRepository`) for aggregate access.27- Keep transactional write orchestration in services (`@Transactional` on service methods), not controllers.28- Avoid exposing entities directly in HTML/API contracts.29- Prefer explicit fetch and query design; avoid accidental N+1 query patterns in list/detail flows.3031---3233## Defaults3435- Package entities and repositories by feature area.36- Persist enums explicitly with stable mapping (`EnumType.STRING` when applicable).37- Use optimistic locking (`@Version`) for entities with concurrent write risk.38- Keep schema lifecycle managed by migrations (Flyway), not ad-hoc runtime schema generation.3940---4142## Validation Checklist4344Before finishing:4546- Entity boundaries are separate from form/request objects.47- Repository interfaces are focused on aggregate use cases.48- Write operations execute inside service-layer transactions.49- Read-heavy endpoints are checked for query efficiency.5051---5253## Anti-Patterns5455- Do NOT place persistence logic in controllers/templates.56- Do NOT rely on `spring.jpa.hibernate.ddl-auto=update` in production-like profiles.57- Do NOT use database entities as direct response/view contracts.58- Do NOT leave transaction boundaries implicit for multi-step writes.
Run npx skillmds@latest add carlnaddy/spring-data-jpa in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Skill: spring-data-jpa It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
CarlNaddy (@carlnaddy) published this skill. Their other Agent Skills are listed on their SkillMD profile.