diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 0000000..cea7cf3 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,55 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + +jobs: + auto-review: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + prompt: | + 이 Pull Request의 코드 변경 사항을 리뷰해주세요. + 다음 항목을 중점적으로 확인해주세요: + 1. 버그 및 정확성: 잠재적 NullPointerException, 로직 오류 + 2. 보안: JWT 처리, 인증/인가, 입력 검증 + 3. JPA 성능: N+1 쿼리, cascade/fetch 설정 + 4. API 설계: ResponseDTO 패턴 준수 + 리뷰는 한국어로 작성해주세요. + 심각한 문제만 지적하고, 사소한 스타일 이슈는 넘어가주세요. + claude_args: "--max-turns 3" + + interactive: + if: | + (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && + contains(github.event.comment.body, '@claude') + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + claude_args: "--max-turns 5" diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..f45bc43 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,55 @@ +# CLAUDE.md + +## 프로젝트 개요 + +DoDutch Backend - 여행 정산(더치페이) 애플리케이션 서버 +여행 생성, 지출 기록, 멤버 간 비용 분할, 카카오페이 정산 기능 제공 + +## 기술 스택 + +- Java 17, Spring Boot 3.4.5, Gradle 9.1.0 +- Spring Data JPA + MySQL +- Spring Security + JWT (jjwt 0.11.5) +- Spring WebFlux (외부 API 호출용) +- Swagger (springdoc-openapi 2.8.6) +- Lombok, AWS S3 + +## 프로젝트 구조 + +``` +src/main/java/graduation/project/DoDutch_server/ +├── domain/ # 기능 모듈 +│ ├── auth/ # 인증 (카카오 OAuth) +│ ├── trip/ # 여행 관리 +│ ├── expense/ # 지출 기록 +│ ├── dutch/ # 더치페이 정산 +│ ├── member/ # 멤버 관리 +│ ├── photo/ # 사진 관리 +│ ├── ocr/ # OCR (네이버 클로바) +│ └── kakaopay/ # 카카오페이 연동 +└── global/ + ├── common/ # BaseEntity, ResponseDTO, 예외 처리 + ├── config/ # Security, Swagger, AWS, CORS 설정 + └── util/ # 유틸리티 클래스 +``` + +각 도메인 모듈은 `controller/`, `service/`, `repository/`, `entity/`, `dto/` 패키지로 구성 + +## 코드 컨벤션 + +### 커밋 메시지 +`[Type] 설명` 형식 사용 +- Types: Feat, Fix, Docs, Style, Refactor, Chore, Rename, Remove, Environment, !HOTFIX + +### 코드 패턴 +- 모든 엔티티는 `BaseEntity` 상속 (createdAt, updatedAt 자동 관리) +- API 응답은 `ResponseDTO` 래퍼 사용 (success, code, message, data) +- Lombok: `@Getter`, `@Builder`, `@NoArgsConstructor`, `@AllArgsConstructor` +- 엔티티: `@SuperBuilder(toBuilder = true)` 사용 (BaseEntity 상속 시) + +## 리뷰 시 중점 사항 + +- 보안: JWT 처리, 인증/인가, 입력 검증 +- JPA: N+1 쿼리, cascade/fetch 타입, orphanRemoval 설정 +- API: ResponseDTO 패턴 준수, HTTP 상태 코드 적절성 +- Null safety 및 validation 어노테이션 활용