코드 리뷰는 소프트웨어 품질에 필수적이지만 시간이 많이 소요됩니다. 개발자들은 주당 약 6-8시간을 동료의 코드를 리뷰하는 데 사용합니다 — 기능을 구현하는 데 쓸 수 있는 시간입니다. AI 기반 코드 리뷰는 인간 리뷰어를 대체하지 않지만, 기계적인 부분(버그 포착, 스타일 위반, 누락된 에러 처리)을 처리하여 인간 리뷰어가 아키텍처, 설계, 비즈니스 로직에 집중할 수 있게 합니다.
이 튜토리얼은 Tactic Remote를 사용하여 AI 기반 코드 리뷰 워크플로우를 설정하는 방법을 보여줍니다.
프로젝트 루트에 .claude-review-prompt.md라는 파일을 생성합니다. 이것이 AI 리뷰의 지시 세트 역할을 합니다:
# Code Review InstructionsReview all changes on the current branch compared to the `main` branch.## What to Check### Critical Issues (must fix before merge)- **Logic errors**: Code that doesn't do what it claims- **Security vulnerabilities**: SQL injection, XSS, auth bypasses, credential exposure- **Data loss risks**: Missing transactions, incorrect cascade deletes, race conditions- **Breaking changes**: API contract violations, backwards-incompatible modifications### Warnings (should fix, but not blocking)- **Missing error handling**: Uncaught exceptions, unhandled promise rejections- **Performance concerns**: N+1 queries, unnecessary re-renders, missing memoization- **Missing validation**: User input not validated before processing- **Test coverage gaps**: New code paths without corresponding tests### Suggestions (nice to have)- **Readability improvements**: Unclear variable names, complex logic that could be simplified- **Documentation gaps**: Public APIs without JSDoc/TSDoc comments- **Potential refactoring**: Duplicated logic, overly long functions## Output FormatFor each finding, provide:1. **Severity**: CRITICAL / WARNING / SUGGESTION2. **File**: Exact file path and line numbers3. **Description**: What the issue is, in one sentence4. **Explanation**: Why it matters, with context5. **Fix**: Concrete code suggestion to resolve the issueAt the end, provide:- Summary: X critical, Y warnings, Z suggestions- Overall assessment: Is this branch ready for human review?## What NOT to Flag- Style preferences covered by our linter (ESLint/Prettier handle this)- Import ordering (automated)- Whitespace or formatting (automated)- Type annotations that TypeScript can infer
이 프롬프트는 의도적으로 구체적입니다. 모호한 리뷰 지시는 모호한 리뷰를 만듭니다. 구체적인 지시가 실행 가능한 발견 사항을 만듭니다.
🔴 CRITICAL — src/api/routes/users.ts:47-52Description: SQL query constructed with string concatenation, vulnerable to injection.Explanation: The search query parameter is interpolated directly into the SQLstring without parameterization. An attacker could craft a search input thatmodifies the query logic, potentially extracting or modifying data.Fix: Use parameterized query: // Before (vulnerable) const results = db.query(`SELECT * FROM users WHERE name LIKE '%${search}%'`) // After (safe) const results = db.query('SELECT * FROM users WHERE name LIKE ?', [`%${search}%`])
각 발견 사항에 대해 휴대폰에서 세 가지 옵션이 있습니다:
수정 적용: Claude Code에 제안된 수정을 구현하도록 프롬프트합니다:
Apply the fix for the SQL injection issue in users.ts:47.
건너뛰기: 발견 사항에 동의하지 않거나 오탐인 경우 나중을 위해 메모하고 넘어갑니다.
토론: 확실하지 않은 경우 Claude Code에 더 많은 컨텍스트를 요청합니다:
Explain the SQL injection risk in more detail. Is this exploitable givenour authentication middleware that runs before this route?
Apply fixes for all CRITICAL and WARNING findings from the review.For each fix, run the relevant tests to verify the fix doesn't break anything.Report which fixes were applied and which tests passed.
Claude Code가 체계적으로 발견 사항을 처리하며 수정을 적용하고 테스트를 실행합니다. 이것도 휴대폰을 내려놓고 알림을 기다리면 되는 작업입니다.
중요: 커밋하기 전에 적용된 수정을 검토하세요. AI 생성 수정은 대개 정확하지만, "대개"는 프로덕션 코드에 충분하지 않습니다. 터미널 뷰에서 diff를 확인하세요:
Show me the complete git diff of all changes made during this review.
Create a pull request description that includes:1. What this branch does (based on the commit history)2. Summary of the AI review findings and how they were addressed3. Any remaining suggestions that were intentionally deferred4. Test results
이것을 PR 설명에 포함하세요. 인간 리뷰어에게 코드가 사전 리뷰되었다는 신뢰를 주고 무엇에 집중해야 하는지 알려줍니다.