code-review-and-quality
コードをメインブランチに統合する前に、自分や他の人が書いたコードの品質を様々な観点から評価し、レビューを行うことで、バグの早期発見や品質向上に貢献するSkill。
📜 元の英語説明(参考)
Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.
🇯🇵 日本人クリエイター向け解説
コードをメインブランチに統合する前に、自分や他の人が書いたコードの品質を様々な観点から評価し、レビューを行うことで、バグの早期発見や品質向上に貢献するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o code-review-and-quality.zip https://jpskill.com/download/9574.zip && unzip -o code-review-and-quality.zip && rm code-review-and-quality.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9574.zip -OutFile "$d\code-review-and-quality.zip"; Expand-Archive "$d\code-review-and-quality.zip" -DestinationPath $d -Force; ri "$d\code-review-and-quality.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
code-review-and-quality.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
code-review-and-qualityフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
コードレビューと品質
概要
品質ゲートを備えた多次元コードレビューです。すべての変更は、例外なくマージ前にレビューされます。レビューは、正確性、可読性、アーキテクチャ、セキュリティ、パフォーマンスの5つの軸を対象とします。基準は「この差分と検証ストーリーを、スタッフエンジニアが承認するか?」です。
使用するタイミング
- PRまたは変更をマージする前
- 機能の実装完了後
- 別のエージェントまたはモデルが生成したコードを評価する必要がある場合
- 既存のコードをリファクタリングする場合
- バグ修正後(修正と回帰テストの両方をレビュー)
5軸レビュー
すべてのレビューは、以下の次元にわたってコードを評価します。
1. 正確性
コードは、主張どおりに動作するか?
- 仕様またはタスク要件に一致するか?
- エッジケース(null、空、境界値)は処理されているか?
- エラーパスは処理されているか?(ハッピーパスだけではないか?)
- すべてのテストに合格するか?テストは実際に正しいことをテストしているか?
- off-by-oneエラー、競合状態、または状態の不整合はないか?
2. 可読性と簡潔さ
別のエンジニア(またはエージェント)は、作成者の説明なしにこのコードを理解できるか?
- 名前は記述的で、プロジェクトの慣例と一致しているか?(コンテキストなしに
temp、data、resultを使用していないか?) - 制御フローは単純明快か?(ネストされた三項演算子、深いコールバックを避ける)
- コードは論理的に構成されているか?(関連するコードはグループ化され、明確なモジュール境界があるか?)
- 簡略化すべき「巧妙な」トリックはないか?
- これをより少ない行数で実現できないか?(100行で十分なところを1000行で書くのは失敗です)
- 抽象化は、その複雑さに値するか?(3回目のユースケースまで一般化しない)
- コメントは、自明でない意図を明確にするのに役立つか?(ただし、自明なコードにはコメントしない)
- デッドコードのアーティファクトはないか?:no-op変数(
_unused)、後方互換性のためのシム、または// removedコメント
3. アーキテクチャ
変更は、システムの設計に適合するか?
- 既存のパターンに従っているか、新しいパターンを導入しているか?新しい場合、それは正当化されるか?
- クリーンなモジュール境界を維持しているか?
- 共有すべきコードの重複はないか?
- 依存関係は正しい方向に流れているか?(循環依存関係はないか?)
- 抽象化レベルは適切か?(過剰な設計になっていないか、結合度が高すぎないか?)
4. セキュリティ
変更は脆弱性を導入しないか?
- ユーザー入力は検証およびサニタイズされているか?
- シークレットは、コード、ログ、およびバージョン管理から除外されているか?
- 認証/認可は、必要な場所でチェックされているか?
- SQLクエリはパラメータ化されているか?(文字列連結はないか?)
- 出力は、XSSを防止するためにエンコードされているか?
- 依存関係は、既知の脆弱性のない信頼できるソースからのものか?
5. パフォーマンス
変更はパフォーマンス上の問題を引き起こさないか?
- N+1クエリパターンはないか?
- 無制限のループまたは制約のないデータフェッチはないか?
- 非同期にすべき同期操作はないか?
- UIコンポーネントで不要な再レンダリングはないか?
- リストエンドポイントでページネーションが欠落していないか?
- ホットパスで大きなオブジェクトが作成されていないか?
レビュープロセス
ステップ 1: コンテキストを理解する
コードを見る前に、意図を理解します。
- この変更は何を達成しようとしているのか?
- どの仕様またはタスクを実装しているのか?
- 予想される動作の変更は何か?
ステップ 2: 最初にテストをレビューする
テストは意図とカバレッジを明らかにします。
- 変更に対するテストは存在するか?
- テストは(実装の詳細ではなく)動作をテストしているか?
- エッジケースはカバーされているか?
- テストには記述的な名前が付いているか?
- コードが変更された場合、テストは回帰を検出できるか?
ステップ 3: 実装をレビューする
5つの軸を念頭に置いて、コードをウォークスルーします。
変更されたファイルごとに:
1. 正確性:このコードは、テストが言うべきことを実行するか?
2. 可読性:助けなしにこれを理解できるか?
3. アーキテクチャ:これはシステムに適合するか?
4. セキュリティ:脆弱性はないか?
5. パフォーマンス:ボトルネックはないか?
ステップ 4: 調査結果を分類する
| カテゴリ | アクション | 例 |
|---|---|---|
| クリティカル | マージ前に修正する必要がある | セキュリティ脆弱性、データ損失のリスク、機能の破損 |
| 重要 | マージ前に修正すべき | テストの欠落、間違った抽象化、不適切なエラー処理 |
| 提案 | 改善のために検討する | 命名の改善、コーディングスタイルの好み、オプションの最適化 |
| 細かい指摘 | 採用するかどうかは自由 | フォーマット、コメントの言い回し(AIレビューではスキップ) |
ステップ 5: 検証を確認する
作成者の検証ストーリーを確認します。
- どのテストが実行されたか?
- ビルドは成功したか?
- 変更は手動でテストされたか?
- UIの変更のスクリーンショットはあるか?
- 変更前/変更後の比較はあるか?
マルチモデルレビューパターン
異なるレビュー視点のために、異なるモデルを使用します。
モデルAがコードを記述
│
▼
モデルBが正確性とアーキテクチャをレビュー
│
▼
モデルAがフィードバックに対処
│
▼
人間が最終判断を下す
これにより、単一のモデルが見逃す可能性のある問題をキャッチできます。異なるモデルには異なる盲点があります。
レビューエージェントのプロンプト例:
このコード変更を、正確性、セキュリティ、およびプロジェクトの慣例への準拠についてレビューしてください。仕様には[X]とあります。変更は[Y]である必要があります。問題をクリティカル、重要、または提案としてフラグを立ててください。
デッドコードの衛生
リファクタリングまたは実装の変更後、孤立したコードがないか確認します。
- 現在到達不能または未使用のコードを特定する
- 明示的にリストする
- 削除する前に確認する: 「これらの現在未使用の要素[リスト]を削除してもよいですか?」
デッドコードを放置しないでください。将来の読者やエージェントを混乱させます。ただし、確信がない場合は、何も言わずに削除しないでください。疑問がある場合は、質問してください。
デッドコードの特定:
- src/utils/date.ts の formatLegacyDate() — formatDate() に置き換えられました
- src/components/ の OldTaskCard コンポーネント — TaskCard に置き換えられました
- src/config.ts の LEGACY_API_URL 定数 — 残りの参照はありません
→ これらを削除しても安全ですか?
レビューにおける誠実さ
あなた自身、別のエージェント、または人間が書いたコードをレビューするとき:
- ハンコを押さないでください。 「LGTM」
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Code Review and Quality
Overview
Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance. The standard is: "Would a staff engineer approve this diff and the verification story?"
When to Use
- Before merging any PR or change
- After completing a feature implementation
- When another agent or model produced code you need to evaluate
- When refactoring existing code
- After any bug fix (review both the fix and the regression test)
The Five-Axis Review
Every review evaluates code across these dimensions:
1. Correctness
Does the code do what it claims to do?
- Does it match the spec or task requirements?
- Are edge cases handled (null, empty, boundary values)?
- Are error paths handled (not just the happy path)?
- Does it pass all tests? Are the tests actually testing the right things?
- Are there off-by-one errors, race conditions, or state inconsistencies?
2. Readability & Simplicity
Can another engineer (or agent) understand this code without the author explaining it?
- Are names descriptive and consistent with project conventions? (No
temp,data,resultwithout context) - Is the control flow straightforward (avoid nested ternaries, deep callbacks)?
- Is the code organized logically (related code grouped, clear module boundaries)?
- Are there any "clever" tricks that should be simplified?
- Could this be done in fewer lines? (1000 lines where 100 suffice is a failure)
- Are abstractions earning their complexity? (Don't generalize until the third use case)
- Would comments help clarify non-obvious intent? (But don't comment obvious code.)
- Are there dead code artifacts: no-op variables (
_unused), backwards-compat shims, or// removedcomments?
3. Architecture
Does the change fit the system's design?
- Does it follow existing patterns or introduce a new one? If new, is it justified?
- Does it maintain clean module boundaries?
- Is there code duplication that should be shared?
- Are dependencies flowing in the right direction (no circular dependencies)?
- Is the abstraction level appropriate (not over-engineered, not too coupled)?
4. Security
Does the change introduce vulnerabilities?
- Is user input validated and sanitized?
- Are secrets kept out of code, logs, and version control?
- Is authentication/authorization checked where needed?
- Are SQL queries parameterized (no string concatenation)?
- Are outputs encoded to prevent XSS?
- Are dependencies from trusted sources with no known vulnerabilities?
5. Performance
Does the change introduce performance problems?
- Any N+1 query patterns?
- Any unbounded loops or unconstrained data fetching?
- Any synchronous operations that should be async?
- Any unnecessary re-renders in UI components?
- Any missing pagination on list endpoints?
- Any large objects created in hot paths?
Review Process
Step 1: Understand the Context
Before looking at code, understand the intent:
- What is this change trying to accomplish?
- What spec or task does it implement?
- What is the expected behavior change?
Step 2: Review the Tests First
Tests reveal intent and coverage:
- Do tests exist for the change?
- Do they test behavior (not implementation details)?
- Are edge cases covered?
- Do tests have descriptive names?
- Would the tests catch a regression if the code changed?
Step 3: Review the Implementation
Walk through the code with the five axes in mind:
For each file changed:
1. Correctness: Does this code do what the test says it should?
2. Readability: Can I understand this without help?
3. Architecture: Does this fit the system?
4. Security: Any vulnerabilities?
5. Performance: Any bottlenecks?
Step 4: Categorize Findings
| Category | Action | Example |
|---|---|---|
| Critical | Must fix before merge | Security vulnerability, data loss risk, broken functionality |
| Important | Should fix before merge | Missing test, wrong abstraction, poor error handling |
| Suggestion | Consider for improvement | Naming improvement, code style preference, optional optimization |
| Nitpick | Take it or leave it | Formatting, comment wording (skip these in AI reviews) |
Step 5: Verify the Verification
Check the author's verification story:
- What tests were run?
- Did the build pass?
- Was the change tested manually?
- Are there screenshots for UI changes?
- Is there a before/after comparison?
Multi-Model Review Pattern
Use different models for different review perspectives:
Model A writes the code
│
▼
Model B reviews for correctness and architecture
│
▼
Model A addresses the feedback
│
▼
Human makes the final call
This catches issues that a single model might miss — different models have different blind spots.
Example prompt for a review agent:
Review this code change for correctness, security, and adherence to
our project conventions. The spec says [X]. The change should [Y].
Flag any issues as Critical, Important, or Suggestion.
Dead Code Hygiene
After any refactoring or implementation change, check for orphaned code:
- Identify code that is now unreachable or unused
- List it explicitly
- Ask before deleting: "Should I remove these now-unused elements: [list]?"
Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about. When in doubt, ask.
DEAD CODE IDENTIFIED:
- formatLegacyDate() in src/utils/date.ts — replaced by formatDate()
- OldTaskCard component in src/components/ — replaced by TaskCard
- LEGACY_API_URL constant in src/config.ts — no remaining references
→ Safe to remove these?
Honesty in Review
When reviewing code — whether written by you, another agent, or a human:
- Don't rubber-stamp. "LGTM" without evidence of review helps no one.
- Don't soften real issues. "This might be a minor concern" when it's a bug that will hit production is dishonest.
- Quantify problems when possible. "This N+1 query will add ~50ms per item in the list" is better than "this could be slow."
- Push back on approaches with clear problems. Sycophancy is a failure mode in reviews. If the implementation has issues, say so directly and propose alternatives.
- Accept override gracefully. If the author has full context and disagrees, defer to their judgment.
Dependency Discipline
Part of code review is dependency review:
Before adding any dependency:
- Does the existing stack solve this? (Often it does.)
- How large is the dependency? (Check bundle impact.)
- Is it actively maintained? (Check last commit, open issues.)
- Does it have known vulnerabilities? (
npm audit) - What's the license? (Must be compatible with the project.)
Rule: Prefer standard library and existing utilities over new dependencies. Every dependency is a liability.
The Review Checklist
## Review: [PR/Change title]
### Context
- [ ] I understand what this change does and why
### Correctness
- [ ] Change matches spec/task requirements
- [ ] Edge cases handled
- [ ] Error paths handled
- [ ] Tests cover the change adequately
### Readability
- [ ] Names are clear and consistent
- [ ] Logic is straightforward
- [ ] No unnecessary complexity
### Architecture
- [ ] Follows existing patterns
- [ ] No unnecessary coupling or dependencies
- [ ] Appropriate abstraction level
### Security
- [ ] No secrets in code
- [ ] Input validated at boundaries
- [ ] No injection vulnerabilities
- [ ] Auth checks in place
### Performance
- [ ] No N+1 patterns
- [ ] No unbounded operations
- [ ] Pagination on list endpoints
### Verification
- [ ] Tests pass
- [ ] Build succeeds
- [ ] Manual verification done (if applicable)
### Verdict
- [ ] **Approve** — Ready to merge
- [ ] **Request changes** — Issues must be addressed
Common Rationalizations
| Rationalization | Reality |
|---|---|
| "It works, that's good enough" | Working code that's unreadable, insecure, or architecturally wrong creates debt that compounds. |
| "I wrote it, so I know it's correct" | Authors are blind to their own assumptions. Every change benefits from another set of eyes. |
| "We'll clean it up later" | Later never comes. The review is the quality gate — use it. |
| "AI-generated code is probably fine" | AI code needs more scrutiny, not less. It's confident and plausible, even when wrong. |
| "The tests pass, so it's good" | Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability concerns. |
Red Flags
- PRs merged without any review
- Review that only checks if tests pass (ignoring other axes)
- "LGTM" without evidence of actual review
- Security-sensitive changes without security-focused review
- Large PRs that are "too big to review properly"
- No regression tests with bug fix PRs
Verification
After review is complete:
- [ ] All Critical issues are resolved
- [ ] All Important issues are resolved or explicitly deferred with justification
- [ ] Tests pass
- [ ] Build succeeds
- [ ] The verification story is documented (what changed, how it was verified)