# 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}%`])
各発見事項に対して、スマートフォンから3つの選択肢があります:
修正を適用する: 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は発見事項を体系的に処理し、修正を適用してテストを実行します。これもスマートフォンを置いて通知を待てるタスクです。
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