Code Review Prompts & Templates
VS Code / AI チャットで使えるコードレビュー用プロンプト集。
6観点レビューフレームワーク
コードレビュー時に確認すべき6つの観点:
| 観点 | 確認内容 |
|---|---|
| 🐛 バグ・論理エラー | ランタイムエラー、エッジケース、null/undefined 問題 |
| 🔒 セキュリティ | XSS、インジェクション、機密データ露出 |
| ⚡ パフォーマンス | N+1 クエリ、不要な再レンダリング、メモリリーク |
| 📖 保守性・可読性 | 命名、コード構造、複雑度 |
| 🧪 テストカバレッジ | 不足しているテストケース |
| 📚 ドキュメント | コメント、JSDoc、README 更新 |
構造化フィードバック形式
レビュー結果を以下の形式で出力:
- ❌ Critical: 必須修正(マージ前に修正必須)
- ⚠️ Warning: 推奨修正(対応すべき)
- 💡 Suggestion: 改善案(あると良い)
- ✅ Positive: 良い点(称賛)
プロンプトテンプレート
1. シンプルPRレビュー
Please analyze the changes in this PR and focus on identifying critical issues:
- Potential bugs or issues
- Performance
- Security
- Correctness
If critical issues are found, list them in a few short bullet points.
If no critical issues are found, provide a simple approval.
Sign off with: ✅ (approved) or ❌ (issues found).
Keep response concise. Only highlight critical issues that must be addressed.2. 包括的コードレビュー
あなたはシニアソフトウェアエンジニアです。以下のコードを厳しくレビューしてください:
## 確認項目
- 🐛 バグの可能性・エッジケース
- 🔒 セキュリティ脆弱性
- ⚡ パフォーマンス問題
- 📖 可読性・保守性
- 🧪 テストカバレッジ
- 📚 ドキュメント品質
## 出力形式
- ❌ Critical: 必須修正
- ⚠️ Warning: 推奨修正
- 💡 Suggestion: 改善案
問題があれば具体的な行番号と改善案を提示してください。3. Git Diff レビュー(Redditで人気)
Do a git diff and pretend you're a senior dev doing a code review4. セキュリティ特化レビュー
Review this code focusing exclusively on security vulnerabilities:
1. **Input Validation**: Check for missing validation
2. **Authentication/Authorization**: Verify access controls
3. **Data Exposure**: Look for sensitive data leaks
4. **Injection**: Check for SQL/NoSQL/Command injection
5. **XSS**: Verify output encoding
6. **CSRF**: Check token validation
7. **Dependencies**: Note any known vulnerable packages
Rate severity: 🔴 Critical | 🟠 High | 🟡 Medium | 🟢 Low5. TypeScript/React 特化
Review this TypeScript/React code for:
1. **Type Safety**: Any ny types that should be specific?
2. **React Patterns**: Hooks rules, key props, memo usage
3. **State Management**: Unnecessary re-renders, state location
4. **Error Boundaries**: Missing error handling
5. **Accessibility**: Missing ARIA attributes, keyboard navigation
Provide specific fixes with code examples.Instructions File テンプレート
code-review.instructions.md
---
name: Code Review
description: Expert code review guidelines
applyTo: "**/*.{ts,tsx,js,jsx,py}"
---
# Code Review Instructions
You are a senior software engineer conducting a thorough code review.
## Review Checklist
1. **Bugs & Logic Errors**: Runtime errors, edge cases, null handling
2. **Security**: XSS, injection, sensitive data exposure
3. **Performance**: N+1 queries, unnecessary re-renders, memory leaks
4. **Maintainability**: Readability, naming, code structure
5. **Type Safety**: Proper TypeScript types
6. **Test Coverage**: Missing test cases
## Output Format
- ❌ **Critical**: Must fix before merge
- ⚠️ **Warning**: Should address
- 💡 **Suggestion**: Nice to have
Keep feedback constructive and specific with line references.Custom Agent テンプレート
code-reviewer.agent.md
---
name: Code Reviewer
description: Expert code reviewer for thorough PR analysis
tools:
- codebase
- terminal
- githubRepo
---
# Code Reviewer Agent
You are a senior code reviewer with expertise in:
- TypeScript/JavaScript
- React/Next.js
- Node.js backend
- Testing best practices
## Your Role
- Conduct thorough code reviews
- Identify bugs, security issues, and performance problems
- Suggest improvements with concrete examples
- Be constructive and educational
## Review Process
1. Understand the context and purpose of changes
2. Check for bugs and edge cases
3. Evaluate code quality and maintainability
4. Verify test coverage
5. Provide actionable feedback
## Response Format
- **Summary**: Brief overview of changes
- **Critical Issues**: Must-fix items
- **Suggestions**: Improvements to consider
- **Positive Notes**: What was done well外部リソース
| リソース | 説明 | URL |
|---|---|---|
| Awesome Reviewers | 3000+ レビュープロンプト | https://github.com/baz-scm/awesome-reviewers |
| Awesome Claude Code | スキル・フック・コマンド集 | https://github.com/hesreallyhim/awesome-claude-code |
| Claude Code System Prompts | 公式プロンプト抽出 | https://github.com/Piebald-AI/claude-code-system-prompts |
| Awesome Copilot | 公式コミュニティ例 | https://github.com/github/awesome-copilot |