repository-expert

Community

Master data access with CQRS-driven JPA and QueryDSL.

Authorryu-qqq
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill standardizes the data access layer by strictly separating Command (write) and Query (read) operations using JPA and QueryDSL. It prevents common ORM pitfalls like N+1 issues, inconsistent data access patterns, and ensures optimized, secure, and maintainable data interactions.

Core Features & Use Cases

  • CQRS Repository Separation: Defines distinct JpaRepository (for save/delete), QueryDslRepository (for 4 fixed query methods), AdminQueryDslRepository (for complex admin queries with joins), and LockRepository (for concurrency control).
  • Long FK Strategy: Enforces the use of Long foreign keys, prohibiting JPA relationship annotations (@ManyToOne, @OneToMany) to simplify entity graphs and prevent N+1 issues.
  • DTO Projection for Admin Queries: Recommends DTO projection for AdminQueryDslRepository to optimize data retrieval for specific use cases, reducing unnecessary data transfer.
  • Zero-Tolerance Rules: Forbids Query Methods in JpaRepository, @Query (JPQL), and direct Entity returns (enforces Adapter transformation), ensuring strict adherence to best practices.
  • Use Case: When implementing persistence for a new domain, use this skill to generate all necessary repository types. This ensures data access is optimized, secure, and adheres to CQRS principles, saving development and review time.

Quick Start

Generate repository interfaces for an 'Order' domain, including JPA, QueryDSL, and Lock repositories, following CQRS principles.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: repository-expert
Download link: https://github.com/ryu-qqq/AuthHub/archive/main.zip#repository-expert

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository