Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
11a4468
feat: springmockk 의존성 추가
hyxklee Jan 23, 2026
03f29f2
refactor: 컨텍스트 업데이트
hyxklee Jan 23, 2026
5808d2a
feat: 헬스 체크 컨트롤러 마이그레이션
hyxklee Jan 23, 2026
6dee780
feat: 공통 응답 인터페이스 마이그레이션
hyxklee Jan 23, 2026
1f03a72
feat: 공통 페이징 객체 마이그레이션
hyxklee Jan 23, 2026
ba619ba
feat: 공통 응답 객체 마이그레이션
hyxklee Jan 23, 2026
5dcf1bc
feat: 공통 페이징 객체 마이그레이션
hyxklee Jan 23, 2026
72427bb
feat: 공통 예외 마이그레이션
hyxklee Jan 23, 2026
21c328f
feat: 에러코드 마이그레이션
hyxklee Jan 23, 2026
7c31ce9
feat: 전역 예외 핸들러 마이그레이션
hyxklee Jan 23, 2026
5699430
feat: 리소스 락 예외 마이그레이션
hyxklee Jan 23, 2026
023da48
feat: 예외 응답 마이그레이션
hyxklee Jan 23, 2026
1c9186f
feat: claude commands 추가
hyxklee Jan 23, 2026
765b01c
refactor: 코틀린 마이그레이션 에이전트 컨텍스트 보강(테스트관련)
hyxklee Jan 23, 2026
dacd658
refactor: 예외설정 오류 수정
hyxklee Jan 23, 2026
c0aa312
refactor: 에이전트 컨텍스트 업데이트
hyxklee Jan 23, 2026
14eea48
refactor: Kotest 스타일 명세 업데이트
hyxklee Jan 27, 2026
127aaf4
refactor: Springmockk 호환 버전으로 다운그레이드
hyxklee Jan 27, 2026
cdcf2f3
refactor: 간단한 테스트의 경우 StringSpec으로 변경
hyxklee Jan 27, 2026
f5ff38d
refactor: SKILL.md 피드백에 맞게 수정
hyxklee Jan 27, 2026
d7614be
Merge branch 'dev' into refactor/LNK-67-Leenk-global-common-코틀린-마이그레이션
hyxklee Jan 27, 2026
064ce29
.java을(를) .kt(으)로 이름 변경
hyxklee Jan 27, 2026
e376b90
chore: 충돌 해결 및 코틀린 마이그레이션
hyxklee Jan 27, 2026
d1b9f70
chore: 충돌 해결 및 코틀린 마이그레이션
hyxklee Jan 27, 2026
78f273e
refactor: 오타 수정
hyxklee Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion .claude/agents/kotlin-migration-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,81 @@ Migrate Java to idiomatic Kotlin with Test-First methodology.

### 1. Pre-Migration Test
- Analyze Java code behavior and dependencies
- Write tests FIRST in `src/test/kotlin/{domain}/`
- **Write ONLY essential tests** that verify critical business logic
- Use Kotest + mockk
- Run tests against Java code to confirm they pass

**Tests to Write (HIGH value):**
- Business logic with conditions/branching (예: 권한 검증, 상태 체크, 조건부 로직)
- Exception scenarios (예: 존재하지 않는 엔티티 조회 시 예외, 권한 없음 예외)
- Complex calculations or transformations
- Transaction boundaries and side effects
- Custom query methods with specific logic
- Domain validation rules

**Tests to SKIP (LOW value):**
- JPA basic CRUD (findById, save, delete, findAll)
- Simple getter/setter or DTO field mapping
- Obvious pass-through methods (repository calls without logic)
- Framework-provided functionality
- Constructor assignments
- Simple delegation patterns

**Example - Service to Test:**
```java
public Feed getFeed(Long feedId, Long userId) {
Feed feed = feedRepository.findById(feedId)
.orElseThrow(() -> new FeedNotFoundException());

if (feed.isBlocked(userId)) { // ← Test this
throw new FeedAccessDeniedException(); // ← Test this
}

return feed; // ← Don't test simple return
}
```

**Write 2-3 focused tests:**
- "존재하지 않는 피드 조회 시 예외 발생"
- "차단된 사용자가 조회 시 예외 발생"
- (Optional) "정상 피드 조회 시 반환" only if complex setup is needed

**Skip if code is trivial:**
```java
public void deleteFeed(Long feedId) {
feedRepository.deleteById(feedId); // ← Skip, JPA basic method
}
```

### 2. Migration

#### File Move and Conversion Workflow
**Instead of deleting Java files and creating new ones, move files using `git mv` then modify the content.**

**Step 1: Move file path**
```bash
git mv src/main/java/leets/leenk/domain/{domain}/{path}/{File}.java \
src/main/kotlin/leets/leenk/domain/{domain}/{path}/{File}.kt
```

**Step 2: Convert to Kotlin**
- Read current file using Read tool
- Modify file content from Java → Kotlin syntax using Edit tool
- Keep business logic identical

**Step 3: Run tests**
```bash
./gradlew test # Run pre-written tests
```

**Benefits:**
- `git log --stat` clearly shows file move + modifications
- `git show` can verify actual code changes
- `git blame` can track commit history of Java version

---

#### Migration Guide
- Convert to Kotlin preserving architecture: Controller → UseCase → Domain Service → Repository
- Apply Kotlin idioms: data class for DTOs, val over var, nullable only when needed
- Keep Single Responsibility: `{Domain}GetService`, `{Domain}SaveService`, etc.
Expand Down
34 changes: 34 additions & 0 deletions .claude/commands/code-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
description: "코드 리뷰 에이전트를 활용해 현재까지의 작업을 리뷰합니다."
---

# Code Review Command

Invoke the code review agent defined in `.claude/agents/code-review-agent.md` to perform code review.

## Determine Review Target

1. Check staged changes with `git diff --staged`
2. If nothing staged, check current branch commit history with `git log` and review

## Rules

- If agent file (`.claude/agents/code-review-agent.md`) doesn't exist, notify user and stop
- Follow the checklist and output format defined in the agent exactly


## Changes

| Item | Reason |
|------|--------|
| Specify agent path | Claude needs exact file location to find it |
| Specific git commands | Clear instructions on how to check |
| Add "follow agent format" | Prevent ignoring agent file's output format |

## Folder Structure

.claude/
├── commands/
│ └── code-review.md # This command file
└── agents/
└── code-review-agent.md # Agent definition (checklist, output format, etc.)
42 changes: 42 additions & 0 deletions .claude/commands/kotlin-migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: "kotlin-migration-agent를 사용해 Java 파일을 코틀린으로 마이그레이션하는 명령어입니다."
---

# Instructions

You MUST use the Task tool to invoke the kotlin-migration-agent immediately.

## Input Processing

1. If user provides a file path:
- Use Read tool to verify the file exists and is a Java file
- Pass the absolute file path to the agent

2. If user provides a directory path:
- Use Glob to find all `.java` files in that directory
- Pass the directory path to the agent

3. If no path provided:
- Ask user to specify the Java file or directory to migrate

## Agent Invocation

Call the Task tool with:
- subagent_type: "kotlin-migration-agent"
- prompt: "Migrate [FILE_PATH or DIRECTORY_PATH] from Java to Kotlin following the Test-First methodology"
- description: "Migrate Java to Kotlin"

Example:
```text
Task tool:
subagent_type: kotlin-migration-agent
prompt: Migrate src/main/java/leets/leenk/domain/feed/service/FeedGetService.java from Java to Kotlin following the Test-First methodology
description: Migrate Java to Kotlin
```

## Important Notes

- NEVER perform migration yourself - ALWAYS delegate to kotlin-migration-agent
- Agent will handle: test writing, migration, refactoring, and ktlint verification
- Agent follows strict order: Test → Migrate → Refactor → Verify
- All agent output will be in Korean as per agent rules
Comment on lines +1 to +42
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

파일명 오타 수정 필요

파일명이 kotlin-mirgrate.md로 되어 있는데, "migrate"의 철자가 틀렸습니다. kotlin-migrate.md로 변경해야 합니다. PR 설명에서 언급한 /kotlin-migration 명령어와의 일관성을 위해서도 정확한 철자 사용이 필요합니다.

📝 파일명 변경 제안

파일명을 다음과 같이 변경하세요:

  • 현재: .claude/commands/kotlin-mirgrate.md
  • 변경: .claude/commands/kotlin-migrate.md
🤖 Prompt for AI Agents
In @.claude/commands/kotlin-mirgrate.md around lines 1 - 42, Rename the command
file whose current name string is "kotlin-mirgrate.md" to the correct spelling
"kotlin-migrate.md" and update any internal references (e.g., command
registration or README entries that mention
".claude/commands/kotlin-mirgrate.md" or the `/kotlin-migration` command) so
they point to the new filename; ensure the file header/description remains
unchanged and verify the command lookup uses "kotlin-migrate.md" to keep name
consistency with the `/kotlin-migration` command.

9 changes: 7 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ refactor: dto validation 수정
## Testing

- **Kotest** + **MockK** for unit tests
- **springmockk** for Spring bean mocking - use `@MockkBean` instead of `@MockBean`
- **Testcontainers** for integration tests (MySQL, MongoDB)
- Test both success and failure scenarios
- Use `@DisplayName` for clear test descriptions
- **Kotest Test Styles:**
- `StringSpec` - Simple tests with minimal boilerplate
- `BehaviorSpec` - BDD-style tests (Given/When/Then)
- `DescribeSpec` - Technical specs requiring detailed structure and readability
- Controller tests: Use `@WebMvcTest` with `@Import` for Security config testing

## Notes

- Swagger UI: `/swagger-ui.html`
- Profiles: `local` (default), `dev`
- Auth: OAuth2 Resource Server with JWT (Apple via Kakao)
- Auth: OAuth2 Resource Server with JWT (Apple via Kakao)
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dependencies {
testImplementation("org.testcontainers:mysql")
testImplementation("org.testcontainers:mongodb")
testImplementation("io.mockk:mockk:1.14.7")
testImplementation("com.ninja-squad:springmockk:4.0.2")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")

// Kotest
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading