jpa-patterns
Skill27 starsChanged 9 months agoMITView on GitHub
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
25 other projects use a version of this, 15 of them edited.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codeedited, first seen Nov 8, 2026
- TsinHzl/claude-code-configedited, first seen Nov 1, 2026
- decebals/claude-code-javatheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
- renepf/claude-skillsedited, first seen Oct 25, 2026
- piomin/claude-ai-quarkustheir own version, first seen Oct 25, 2026
Used with
Projects with it also use nuxt4-patterns, agent-payment-x402 and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
loulanyueSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 10 projects that use this
TironFoxSkillagent-payment-x402
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.
Also in 6 projects that use this
TironFoxSkillopenclaw-persona-forge
为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。
Also in 5 projects that use this
royaluniondesign-sysSkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 11 projects that use this
junimnjwSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
RojiosSkilldart-flutter-patterns
Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.
Also in 6 projects that use this
Other versions25 projects use a version of this.
Word for word · 3
- FaisalAlqarni/sp-ecc★ 9100% same
- Lukasbrujula/claude-code-framework★ 4100% same
- mstuder-slalom/everything-claude-code★ 1100% same
Edited · 15
- loulanyue/awesome-claude-notes★ 27290% same
- Fmarzochi/EGC★ 6190% same
- gongyijie85/dsh-ecc★ 887% same
- ronmkr/PromptBook★ 290% same
- TsinHzl/claude-code-config★ 247% same
- iCesofT/awesome-ai★ 177% same
- junimnjw/everything-claude-code★ 142% same
- Rojios/everything-claude-code★ 190% same
- royaluniondesign-sys/claude-os★ 190% same
- SamuelNDCE/claude-super-skill-library★ 190% same
5 more not listed
Wrote their own version · 7
- piomin/claude-ai-spring-boot★ 1.4ksame name
- decebals/claude-code-java★ 763same name
- piomin/claude-ai-quarkus★ 7same name
- gabrielrovesti/ai-agent-skills★ 1same name
- minghaoZhangZ/shipkit★ 1same name
- piomin/spring-boot-app-with-claudecode★ 1same name
- mvonline/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- examples/CLAUDE.mdCLAUDE.md
- backend-patternsSkill
- eval-harnessSkill
- frontend-patternsSkill
- iterative-retrievalSkill
- java-coding-standardsSkill
- kafka-patternsSkill
- postgres-patternsSkill
- python-patternsSkill
- python-testingSkill
- security-reviewSkill
- springboot-patternsSkill
- springboot-securitySkill
- springboot-tddSkill
The file
We split this skill into the rules it gives an agent
12 rules. 5 are common, 0 are distinctive, and 7 are very specific to this project.
5
Common
Most of the 18 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 8
Use for data modeling, repositories, and performance tuning in Spring Boot.
- Very specific: line 50
Default to lazy loading; use JOIN FETCH in queries when needed
- Very specific: line 51
Avoid EAGER on collections.
- Common: line 69
Use projections for lightweight queries:
- Very specific: line 82
Use @Transactional(readOnly = true) for read paths to optimize
- Very specific: line 106
Add indexes for common filters (status, slug, foreign keys)
- Very specific: line 107
Use composite indexes matching query patterns (status, created_at)
- Very specific: line 108
Avoid select *; project only needed columns
- Common: line 133
Use Flyway or Liquibase; never rely on Hibernate auto DDL in production
- Common: line 134
Keep migrations idempotent and additive.
- Very specific: line 138
Prefer @DataJpaTest with Testcontainers to mirror production
- Common: line 141
Remember: Keep entities lean, queries intentional, and transactions short.
“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
JPA/Hibernate Patterns
Use for data modeling, repositories, and performance tuning in Spring Boot.
Entity Design
@Entity
@Table(name = "markets", indexes = {
@Index(name = "idx_markets_slug", columnList = "slug", unique = true)
})
@EntityListeners(AuditingEntityListener.class)
public class MarketEntity {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 200)
private String name;
@Column(nullable = false, unique = true, length = 120)
private String slug;
@Enumerated(EnumType.STRING)
private MarketStatus status = MarketStatus.ACTIVE;
@CreatedDate private Instant createdAt;
@LastModifiedDate private Instant updatedAt;
}Enable auditing:
@Configuration
@EnableJpaAuditing
class JpaConfig {}Relationships and N+1 Prevention
@OneToMany(mappedBy = "market", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PositionEntity> positions = new ArrayList<>();- Default to lazy loading; use
JOIN FETCHin queries when needed - Avoid
EAGERon collections; use DTO projections for read paths
@Query("select m from MarketEntity m left join fetch m.positions where m.id = :id")
Optional<MarketEntity> findWithPositions(@Param("id") Long id);Repository Patterns
public interface MarketRepository extends JpaRepository<MarketEntity, Long> {
Optional<MarketEntity> findBySlug(String slug);
@Query("select m from MarketEntity m where m.status = :status")
Page<MarketEntity> findByStatus(@Param("status") MarketStatus status, Pageable pageable);
}- Use projections for lightweight queries:
public interface MarketSummary {
Long getId();
String getName();
MarketStatus getStatus();
}
Page<MarketSummary> findAllBy(Pageable pageable);Transactions
- Annotate service methods with
@Transactional - Use
@Transactional(readOnly = true)for read paths to optimize - Choose propagation carefully; avoid long-running transactions
@Transactional
public Market updateStatus(Long id, MarketStatus status) {
MarketEntity entity = repo.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Market"));
entity.setStatus(status);
return Market.from(entity);
}Pagination
PageRequest page = PageRequest.of(pageNumber, pageSize, Sort.by("createdAt").descending());
Page<MarketEntity> markets = repo.findByStatus(MarketStatus.ACTIVE, page);For cursor-like pagination, include id > :lastId in JPQL with ordering.
Indexing and Performance
- Add indexes for common filters (
status,slug, foreign keys) - Use composite indexes matching query patterns (
status, created_at) - Avoid
select *; project only needed columns - Batch writes with
saveAllandhibernate.jdbc.batch_size
Connection Pooling (HikariCP)
Recommended properties:
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.validation-timeout=5000For PostgreSQL LOB handling, add:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=trueCaching
- 1st-level cache is per EntityManager; avoid keeping entities across transactions
- For read-heavy entities, consider second-level cache cautiously; validate eviction strategy
Migrations
- Use Flyway or Liquibase; never rely on Hibernate auto DDL in production
- Keep migrations idempotent and additive; avoid dropping columns without plan
Testing Data Access
- Prefer
@DataJpaTestwith Testcontainers to mirror production - Assert SQL efficiency using logs: set
logging.level.org.hibernate.SQL=DEBUGandlogging.level.org.hibernate.orm.jdbc.bind=TRACEfor parameter values
Remember: Keep entities lean, queries intentional, and transactions short. Prevent N+1 with fetch strategies and projections, and index for your read/write paths.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

