Skip to content

refactor: Claude 설정 구조 재편 및 API 응답 형식 통일#32

Merged
Sean-mn merged 14 commits intodevelopfrom
refactor/claude
Apr 1, 2026
Merged

refactor: Claude 설정 구조 재편 및 API 응답 형식 통일#32
Sean-mn merged 14 commits intodevelopfrom
refactor/claude

Conversation

@Sean-mn
Copy link
Copy Markdown
Contributor

@Sean-mn Sean-mn commented Apr 1, 2026

📚작업 내용

  • .claude/commands/ 하위 command 파일들을 .claude/skills/ 구조로 마이그레이션 (commit, migrate, test, pr, build)
  • .claude/rules/ 디렉터리 신설 및 아키텍처, 코드 스타일, 컨벤션, 도메인 패턴, 플로우, 테스트, 검증 규칙 문서 추가
  • CLAUDE.md 인라인 규칙 제거 후 rules/ 파일 참조 방식으로 간소화
  • postToolUse.sh 훅 추가: C# 파일 수정 시 자동 빌드 및 테스트 실행
  • preCommit.sh, preToolUse.sh 훅 재구성; commit-msg.sh 제거
  • AuthController, RoomController 응답 형식을 CommonApiResponse로 통일
  • UserRepository 신규 사용자 생성 로직을 EF Core AddAsync로 교체
  • RoomSummary 제거 및 GetRoomResponse로 대체, MaxPlayers 상수화
  • JoinRoomService 비밀번호 검증 조건 수정 및 IsNullOrWhiteSpace 강화
  • JoinRoomServiceTests 테스트 케이스 추가

◀️참고 사항

Claude Code 설정 구조를 commands → skills 방식으로 전환하고, 프로젝트 규칙을 별도 파일로 분리했습니다. 프로덕션 코드 변경은 이전 PR에서 미처 반영되지 않았던 응답 형식 통일 및 버그 수정 사항을 포함합니다.

✅체크리스트

[ ]안에 x를 작성하면 체크박스를 체크할 수 있습니다.

  • 현재 의도하고자 하는 기능이 정상적으로 작동하나요?
  • 변경한 기능이 다른 기능을 깨뜨리지 않나요?

추후 필요한 체크리스트는 업데이트 될 예정입니다.

@Sean-mn Sean-mn merged commit 52c758a into develop Apr 1, 2026
4 checks passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly updates the project's development workflow and standardizes API communication. It introduces a suite of Claude-specific hooks and rules to automate code formatting, builds, and tests, while also enforcing commit message conventions. Key implementation changes include refactoring Auth and Room controllers to return CommonApiResponse, updating the UserRepository to utilize EF Core's tracking instead of raw SQL, and fixing password validation logic in the JoinRoomService. Feedback identifies a mismatch in allowed commit types within the pre-commit hook, suggests relaxing the dangerous command filter to allow standard directory cleanup, and recommends using the synchronous Add method in EF Core for improved performance.

Comment on lines +7 to +25
PATTERN="^(feat|fix|update|docs): .+"

if [[ ! "$COMMAND" =~ dotnet[[:space:]]+(build|run|publish) ]]; then
exit 0
if [[ ! "$COMMIT_MSG" =~ $PATTERN ]]; then
echo "[Hook] ✗ Invalid commit message format"
echo ""
echo "Expected:"
echo " {type}: {Korean description}"
echo ""
echo "Types:"
echo " feat — new feature"
echo " fix — bug fix or missing DI/config"
echo " update — modification to existing code"
echo " docs — documentation changes"
echo ""
echo "Examples:"
echo " feat: 방 생성 API 추가"
echo " fix: 세션 DI 누락 수정"
echo " update: Room 엔터티 수정"
exit 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

preCommit.sh의 커밋 메시지 검증 패턴(PATTERN)과 도움말 메시지가 프로젝트의 다른 문서(commit/SKILL.md, pr/SKILL.md) 및 실제 사용 사례(PR 제목의 refactor 등)와 일치하지 않습니다. 특히 refactorchore 타입이 누락되어 있어, 해당 타입으로 커밋을 시도할 경우 훅에 의해 차단될 수 있습니다.

PATTERN="^(feat|fix|update|docs|refactor|chore): .+"

if [[ ! "$COMMIT_MSG" =~ $PATTERN ]]; then
    echo "[Hook] ✗ Invalid commit message format"
    echo ""
    echo "Expected:"
    echo "  {type}: {Korean description}"
    echo ""
    echo "Types:"
    echo "  feat     — new feature"
    echo "  fix      — bug fix or missing DI/config"
    echo "  update   — modification to existing code"
    echo "  docs     — documentation changes"
    echo "  refactor — code refactoring"
    echo "  chore    — tooling, config, etc."
    echo ""
    echo "Examples:"
    echo "  feat: 방 생성 API 추가"
    echo "  fix: 세션 DI 누락 수정"
    echo "  update: Room 엔터티 수정"
    exit 1

Comment on lines +13 to 24
DANGEROUS_KEYWORDS=(
"rm -rf"
"mkfs"
"curl .*\| .*sh"
"curl .*\| .*bash"
"wget .*\| .*sh"
"wget .*\| .*bash"
"dd if="
"shutdown"
"reboot"
"kill -9 -1"
":(){"
"> /dev/sda"
"chmod -R 777 /"
"chown -R root"
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

DANGEROUS_KEYWORDS"rm -rf"가 포함되어 있어, 개발 중 빈번하게 발생하는 일반적인 디렉토리 삭제 명령(예: rm -rf bin/, rm -rf obj/)까지 모두 차단됩니다. 하단(35-38행)에서 루트(/)나 와일드카드(*)를 사용한 위험한 삭제 명령을 이미 별도로 검사하고 있으므로, 키워드 목록에서 "rm -rf"를 제거하여 개발 편의성을 높이는 것이 좋습니다.

Suggested change
DANGEROUS_KEYWORDS=(
"rm -rf"
"mkfs"
"curl .*\| .*sh"
"curl .*\| .*bash"
"wget .*\| .*sh"
"wget .*\| .*bash"
"dd if="
"shutdown"
"reboot"
"kill -9 -1"
":(){"
"> /dev/sda"
"chmod -R 777 /"
"chown -R root"
)
DANGEROUS_KEYWORDS=(
"mkfs"
"dd if="
"shutdown"
"reboot"
"kill -9 -1"
":(){"
"> /dev/sda"
"chmod -R 777 /"
"chown -R root"
)

Comment on lines +26 to +27
await _context.Users.AddAsync(user, ct);
await _context.SaveChangesAsync(ct);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

EF Core에서 AddAsync는 특별한 상황(예: 특정 데이터베이스 제공자의 값 생성기가 비동기 작업을 필요로 하는 경우)이 아니면 권장되지 않습니다. 일반적인 관계형 데이터베이스(PostgreSQL 등)에서는 동기 메서드인 Add를 사용하는 것이 성능상 유리합니다. Add 메서드는 단순히 엔터티를 추적 상태로 변경할 뿐 실제 I/O를 발생시키지 않으며, SaveChangesAsync 호출 시점에 비동기로 저장됩니다.

        _context.Users.Add(user);
        await _context.SaveChangesAsync(ct);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant