メインコンテンツへスキップ

概要

/review コマンドは、AI を活用したインサイトでコードの変更を分析するためのインタラクティブなワークフローを提供します。コミットされていない変更のレビューから、完全なブランチや特定のコミットの分析まで、さまざまな開発シナリオに対応する複数のレビューモードを提供しています。 /review を実行すると、Droid がレビュータイプの選択、パラメータの設定を案内し、業界標準のレビューガイドラインに基づいてコード変更の包括的な分析を実行します。

クイックスタート

1

Start the review flow

In an interactive droid session, type:
/review
2

Select a review type

Choose from four review presets:
  • Review against a base branch - PR-style review comparing your branch to a base branch
  • Review uncommitted changes - Analyze working directory changes (staged, unstaged, and untracked)
  • Review a commit - Examine a specific commit from history
  • Custom review instructions - Define your own review criteria
3

Configure parameters

Depending on your selection:
  • For base branch reviews: Select the target branch (e.g., main, develop)
  • For commit reviews: Choose a commit from the interactive list
  • For custom reviews: Enter your review instructions
4

Review the findings

Droid analyzes the code changes and provides:
  • Prioritized findings with severity levels [P0-P3]
  • Specific file locations and line numbers
  • Suggested fixes with code suggestions
  • Overall assessment of the changes

レビュータイプ

ベースブランチとの比較レビュー

現在のブランチをベースブランチと比較します(プルリクエストレビューのように)。PR前のレビューやマージされる変更の確認に最適です。 動作方法:
  1. 「Review against a base branch」を選択
  2. リストからターゲットのベースブランチを選択(ローカルとリモートブランチが表示されます)
  3. Droid がマージベースを見つけて差分をレビューします
使用例:
  • コミット前のPRレビュー
  • プルリクエスト作成前のブランチ変更確認
  • main/develop に対するフィーチャーブランチの検証
ワークフロー例:
> /review
# Select: Review against a base branch
# Choose: origin/main
# Droid reviews all changes that would be merged

コミットされていない変更のレビュー

現在の作業ディレクトリのすべての変更を分析します—ステージされたファイル、ステージされていない変更、追跡されていないファイルを含みます。 使用例:
  • コミット前のクイックサニティチェック
  • 作業中のコードのレビュー
  • 開発初期段階での問題の早期発見
ワークフロー例:
> /review
# Select: Review uncommitted changes
# Droid immediately reviews all working directory changes

コミットのレビュー

リポジトリ履歴内の特定のコミットによって導入された変更を検査します。 動作方法:
  1. 「Review a commit」を選択
  2. ハッシュ、メッセージ、作成者、日付でコミットを参照
  3. レビューするコミットを選択
使用例:
  • 最近のコミットの問題レビュー
  • 特定のコミットの変更理解
  • チームメイトの作業のマージ後レビュー
ワークフロー例:
> /review
# Select: Review a commit
# Browse and select: abc1234 - "Add user authentication"
# Droid reviews that specific commit's changes

カスタムレビュー指示

専門的な分析のために独自のレビュー基準を定義します。 使用例:
  • セキュリティに焦点を当てたレビュー
  • パフォーマンス分析
  • 特定のコーディング標準のチェック
  • ドメイン固有の検証
ワークフロー例:
> /review
# Select: Custom review instructions
# Enter: "Check for SQL injection vulnerabilities and ensure all database queries use parameterized statements"
# Droid performs a targeted security review

レビューガイドライン

すべてのコードレビューは、実行可能で高品質なフィードバックを提供するように設計された構造化されたルーブリックに従います:

重要度レベル

レビューは優先度レベルを使用して発見事項を分類します:
  • [P0] - リリースやオペレーションをブロックする重要な問題
  • [P1] - 次のサイクルで対処すべき緊急の問題
  • [P2] - 最終的に修正すべき通常の優先度の問題
  • [P3] - あると良い改善の低優先度項目

バグ検出基準

AI は以下のすべての基準を満たす場合にのみ、問題をバグとしてフラグ付けします:
  1. 有意義な影響 - 正確性、パフォーマンス、セキュリティ、保守性に影響する
  2. 個別で実行可能 - 明確で具体的な問題と明確な修正
  3. 適切な厳密性 - 他のコードベースより多くの厳密性を求めない修正
  4. 変更で導入された - レビューされた変更で追加されたバグ(既存ではない)
  5. 修正する価値がある - 作成者が認識すれば修正する可能性が高い
  6. 明記されていない仮定なし - 推測ではなく検証可能な事実に基づく
  7. 証明可能な影響 - 理論的ではなく、具体的に影響を受けるコードを特定可能
  8. 意図的でない - 明らかに意図的な設計選択ではない

コメントスタイル

レビューコメントは以下の原則に従います:
  • 明確な理由付け - なぜそれが問題なのかを説明
  • 適切な重要度 - 影響を正確に伝える
  • 簡潔 - 発見事項あたり最大1段落
  • 最小限のコード - コードチャンクはmarkdownで3行に制限
  • シナリオ固有 - 影響を受ける環境/条件を記述
  • 事実に基づく口調 - 非難的な言語を避ける
  • すぐに理解可能 - 作成者が理解しやすい
  • 過度な賛辞なし - 実行可能なフィードバックに焦点を当てる

出力形式

各発見事項には以下が含まれます:
  • 明確なタイトル(≤80文字、命令形)
  • なぜこれが問題なのかの説明
  • 該当する場合のファイルパスと行番号
  • 優先度レベル [P0-P3]
  • 修正提案(具体的な置換コードが利用可能な場合)
さらに全体的な評価
  • 変更が正しいか間違っているか
  • 1〜3文の要約

ヒントとベストプラクティス

  • Uncommitted changes: During active development, before staging commits
  • Base branch review: Before creating PRs, to catch issues early
  • Commit review: After merging, to understand historical changes or review teammate’s commits
  • Custom instructions: When you need focused analysis (security, performance, specific patterns)
  • Run reviews frequently during development, not just before commits
  • Use custom instructions for domain-specific concerns your team cares about
  • Treat P0/P1 findings seriously—they represent real issues worth addressing
  • Review the overall assessment for context on whether changes are sound
The /review command is interactive and meant for CLI sessions. For automated reviews in CI/CD, use:
droid exec "Review the changes in this PR for security issues and performance regressions"
See the Code Review guide for automation examples.

PR前レビュー

# Before creating a pull request
> /review
# Select: Review against a base branch
# Choose: origin/main
# Review findings, fix issues, then create PR

クイック WIP チェック

# Check work in progress
> /review
# Select: Review uncommitted changes
# Get immediate feedback on current changes

セキュリティに焦点を当てたレビュー

# Custom security review
> /review
# Select: Custom review instructions
# Enter: "Check for security vulnerabilities: SQL injection, XSS, CSRF, insecure dependencies, exposed secrets, and authentication bypasses"

マージ後レビュー

# Review a teammate's recent commit
> /review
# Select: Review a commit
# Choose the recent commit to understand changes

関連項目