AgentSkillsCN

spring-repository

实现 Kotlin Spring Boot 服务层的用例。在需要处理业务规则、组合仓库、界定事务边界,以及应对应用异常时使用。

SKILL.md
--- frontmatter
name: spring-repository
description: Spring Data/JPA 리포지토리와 어댑터를 설계/수정한다. 조회 패턴, 커스텀 쿼리, 포트-어댑터 구조 정리가 필요할 때 사용한다.

작업 절차

  1. 유스케이스 기준 조회/저장 인터페이스를 정의한다.
  2. port/out 인터페이스와 infrastructure/repository 구현을 분리한다.
  3. 필요 시 커스텀 쿼리와 페이징 전략을 반영한다.
  4. 통합 테스트로 매핑/쿼리 동작을 검증한다.

모듈 내부 배치 규칙

  • 인터페이스는 modules/applicationport/out에 둔다.
  • 구현은 modules/infrastructurerepository, persistence/*에 둔다.
  • 컨트롤러/DTO 로직은 포함하지 않는다.

번들 리소스

  • 레퍼런스 인덱스: references/INDEX.md
  • 리포지토리 설계 체크리스트: references/repository-design-checklist.md
  • 리포지토리 샘플 코드: references/repository-sample.md
  • 리포지토리 통합 테스트 샘플: references/repository-it-sample.md
  • 프로젝트 리포지토리 테스트 가이드: ../../../agents/guidelines/repository-testing.md
  • 리포지토리 스캐폴드 스크립트: scripts/scaffold_repository.py
  • 리포지토리 어댑터 템플릿: assets/repository_adapter_template.kt