spring-data-jpa

Detects project conventions and applies rules when creating or modifying Spring Data JPA entities and transactions.

Updated May 4, 2026
One-click install
npx skills add https://github.com/studenkov/FinanceTracker --skill spring-data-jpa-studenkov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-data-jpa
Source: https://github.com/studenkov/FinanceTracker/tree/main/.agents/skills/spring-data-jpa
Command: npx skills add https://github.com/studenkov/FinanceTracker --skill spring-data-jpa-studenkov

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing JPA entities, repositories, and transactional code that stays consistent with an existing Spring project's conventions is error-prone: ID strategies, naming templates, Lombok usage, equals/hashCode patterns, and fetch types vary from project to project. This Skill detects the conventions already used in your codebase and enforces best-practice rules so every new or modified entity matches the project style. ## Core Features & Use Cases - Convention Detection: Scans existing entities via Spring MCP tools to score conventions such as ID strategy, sequence scope, naming templates, Lombok usage, and equals/hashCode style, asking the developer only when confidence is low. - Entity Implementation Rules: Applies detailed rules for @Entity classes, @Id generation (SEQUENCE, IDENTITY, UUID), @Column naming, BigDecimal precision/scale, and OneToMany/ManyToOne/ManyToMany mappings. - Safe equals/hashCode and toString: Generates proxy-safe HibernateProxy-based equals/hashCode and toString implementations that avoid LazyInitializationException by excluding relation fields. - JPA Review Mode: Compares detected project conventions against best practices and reports deviations with recommendations. - Use Case: When asked to add a new Loan entity to a Spring Boot project, the Skill inspects existing entities, confirms conventions like SEQUENCE IDs and explicit naming, then generates the entity with correct annotations, Lombok configuration, and proxy-safe equals/hashCode. ## Quick Start Ask the assistant to create a new JPA entity or modify an existing one in your Spring project, and it will detect your project's conventions before writing the code.

Frequently Asked Questions about spring-data-jpa

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

FAQPage Schema
How do I create a JPA entity that matches my project's conventions?

The Skill first scans existing entities using Spring MCP tools to detect conventions like ID strategy, naming templates, and Lombok usage. It then generates the new entity following those detected conventions, asking you only when a convention is ambiguous.

How should equals and hashCode be implemented in JPA entities?

The recommended pattern is a manual proxy-safe implementation using HibernateProxy checks that compares effective classes and the id field. Relation fields must never be included because accessing them triggers lazy loading and LazyInitializationException.

Does this Skill require the Amplicode IntelliJ plugin?

Yes, it relies on the Spring MCP server provided by the Amplicode IntelliJ plugin for tools like list_all_domain_entities and get_entity_details. If the MCP tools are unavailable, the Skill directs you to install the plugin and restart your MCP client.

Should I use List or Set for JPA ManyToMany and OneToMany collections?

Set is the recommended collection type, initialized as LinkedHashSet to preserve insertion order. Using List causes Hibernate to delete and reinsert all rows on every change, known as the bag problem, and Set requires correct equals/hashCode on the child entity.

Why does BigDecimal need explicit precision and scale in @Column?

Without explicit precision and scale, Hibernate falls back to database defaults that vary across vendors and can cause precision loss. The Skill enforces declaring both attributes, for example @Column(name = "price", precision = 10, scale = 2).

Can this Skill review existing JPA code for best practices?

Yes, it has a review mode that detects current project conventions and compares them against best-practice rules. For each deviation it outputs the current pattern, the recommended approach, and the reasoning behind it.