plugins/spring-boot-dev/skills/spring-data-jpa-repo-creator/SKILL.md
Creates Spring Data JPA repositories following best practices.
npx skillsauth add sivaprasadreddy/sivalabs-marketplace spring-data-jpa-repo-creatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The following are key principles to follow while creating Spring Data JPA Repositories:
@Query with JPQL for custom queriesFile: events/domain/EventRepository.java
interface EventRepository extends JpaRepository<EventEntity, EventId> {
@Query("""
SELECT e FROM EventEntity e
WHERE e.startDatetime > :now
ORDER BY e.startDatetime ASC
""")
List<EventEntity> findUpcomingEvents(@Param("now") Instant now);
@Query("""
SELECT e FROM EventEntity e
WHERE e.code = :code
""")
Optional<EventEntity> findByCode(@Param("code") EventCode code);
// Convenience methods using default interface methods
default EventEntity getByCode(EventCode eventCode) {
return this.findByCode(eventCode)
.orElseThrow(() -> new ResourceNotFoundException("Event not found with code: " + eventCode));
}
}
Enable JPA Auditing support to automatically populate createdAt and updatedAt fields.
@CreatedDate and @LastModifiedDate annotations to your BaseEntity class.@EntityListeners(AuditingEntityListener.class) to your BaseEntity class.@Configuration class and add @EnableJpaAuditing annotation.package dev.sivalabs.meetup4j.shared;
import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.time.Instant;
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity {
@Column(name = "created_at", nullable = false, updatable = false)
@CreatedDate
protected Instant createdAt;
@Column(name = "updated_at", nullable = false)
@LastModifiedDate
protected Instant updatedAt;
// Getters and setters
}
Enable JPA Auditing in your application configuration:
@Configuration
@EnableJpaAuditing
public class JpaConfig {
}
tools
Creates Spring Service classes following best practices.
development
Creates Spring REST APIs following best practices.
tools
Creates recommended package structure for Spring Boot projects.
tools
Creates JPA entities following best practices.