After Claude Code edits code, use Codex CLI (codex review / codex exec) to run a review, and cycle through fixing any feedback.
Prerequisites
- Codex CLI is installed (
@openai/codex, via volta) - OpenAI API key is configured
- The target directory is a Git repository
Review Modes
Select the optimal mode according to the user's instructions and context.
Mode A: diff review (default)
After Claude edits code, review the uncommitted change diff.
cd <対象リポジトリのパス>
codex review --uncommitted
- Use case: Review immediately after editing
- Note:
--uncommittedand a custom prompt cannot be used at the same time - Timeout: 120 seconds recommended
Mode B: commit review
After committing, review the changes in that commit.
cd <対象リポジトリのパス>
codex review --commit HEAD
- Use case: Review per commit
Mode C: branch review
Review the entire diff against the base branch.
cd <対象リポジトリのパス>
codex review --base main
- Use case: Final review before creating a PR
Mode D: custom review (specific files, specific perspectives)
codex exec to use a free-form prompt and review specific files or specific perspectives.
cd <対象リポジトリのパス>
codex exec --full-auto --ephemeral "<レビュー指示>"
- Use case: Focused reviews such as security, performance, specific files, etc.
--full-auto: Automatically executed in a sandbox (read-only)--ephemeral: Does not leave session files
Custom review prompt examples
# セキュリティレビュー
codex exec --full-auto --ephemeral \
"app/routers/messages.py を読んで、セキュリティの観点からレビューしてください。重要度付きで指摘をリスト形式で出力してください。"
# テストカバレッジレビュー
codex exec --full-auto --ephemeral \
"tests/ と src/ を比較し、テストが不足している箇所を指摘してください。"
Standard Workflow (MUST FOLLOW)
When this skill is triggered, execute the following cycle.
Step 1: Claude edits the code
Edit and implement code based on the user's request.
Step 2: Ask Codex to review
After editing is complete, run codex review or codex exec in the appropriate mode.
Set the Bash tool's timeout は 120000(120 seconds).
# 例: diff レビュー
cd /path/to/repo
codex review --uncommitted
Step 3: Analyze and report the review results
Read Codex's output and report to the user in the following format:
## Codex レビュー結果
### 指摘事項
- **[重要度]** 内容 (ファイル:行番号)
- Claude の対応方針: ...
### 対応予定
- [ ] 指摘1: 修正する / しない(理由)
- [ ] 指摘2: 修正する / しない(理由)
Step 4: Incorporate the feedback
Fix the code in response to valid feedback. However, do not fix in the following cases (explain the reason to the user):
- Feedback that contradicts the project's policy
- Feedback that requests excessive changes (YAGNI violation)
- Content guaranteed by existing tests and linters
Step 5: Re-review (only if necessary)
If major issues (equivalent to P0/P1) have been fixed, return to Step 2 again. If there are only minor issues, end the cycle.
Notes when calling the Bash tool
- timeout: 120000 を必ず指定する(Codex は大きな diff で時間がかかる)
- cd で対象リポジトリに移動してから実行する
- 出力が長い場合は tail で末尾を取得する
Model specification (optional)
If you want to use a specific model:
codex review --uncommitted -c model="o3"
codex exec --full-auto --ephemeral -m o3 "..."