home / skills / chachamaru127 / claude-code-harness / codex-review

codex-review skill

/skills/codex-review

This skill adds a second opinion to Claude Code reviews by integrating Codex insights for multi-model quality checks.

npx playbooks add skill chachamaru127/claude-code-harness --skill codex-review

Review the files below or copy the command above to add this skill to your agents.

Files (22)
SKILL.md
8.2 KB
---
name: codex-review
description: "Codexにセカンドオピニオンを求める。AI同士の忖度なしガチレビュー。Use when user mentions 'Codex レビュー', 'セカンドオピニオン', 'Codex の意見', 'Codex でレビュー', or 'Codex セットアップ'. Do NOT load for: 'Codex に実装させて', 'Codex Worker', 'Codex に作らせて', '実装を依頼'."
description-en: "Ask Codex for second opinion. No-compromise AI peer review. Use when user mentions 'Codex レビュー', 'セカンドオピニオン', 'Codex の意見', 'Codex でレビュー', or 'Codex セットアップ'. Do NOT load for: 'Codex に実装させて', 'Codex Worker', 'Codex に作らせて', '実装を依頼'."
description-ja: "Codexにセカンドオピニオンを求める。AI同士の忖度なしガチレビュー。Use when user mentions 'Codex レビュー', 'セカンドオピニオン', 'Codex の意見', 'Codex でレビュー', or 'Codex セットアップ'. Do NOT load for: 'Codex に実装させて', 'Codex Worker', 'Codex に作らせて', '実装を依頼'."
allowed-tools: ["Bash", "Read", "Write", "Edit"]
argument-hint: "[code|plan|scope]"
hooks:
  - event: PreToolCall
    type: command
    command: "${CLAUDE_PLUGIN_ROOT}/scripts/check-codex.sh"
    once: true
---

# Codex Review Integration Skill

OpenAI Codex CLI を使って Claude Code のコードレビュー時にセカンドオピニオンを提供するスキル。

## Do NOT Load For (誤発動防止)

以下のキーワードは `/work --codex` が担当します:

| トリガーワード | 正しいスキル | 理由 |
|---------------|-------------|------|
| "**Codex に実装させて**" | `/work --codex` | 実装 ≠ レビュー |
| "**Codex Worker**" | `/work --codex` | Worker = 実装役 |
| "**Codex に作らせて**" | `/work --codex` | 作成 = 実装 |
| "**実装を依頼**" | `/work --codex` | 実装目的 |

## 🎯 使用場面

### セットアップ
- **初回設定**: Codex CLI のインストール確認と MCP 登録
- **認証設定**: Codex への OAuth / API キー認証

### レビュー
- **セカンドオピニオン**: Claude のレビュー結果に Codex の視点を追加
- **コード品質チェック**: 複数 AI モデルの得意分野を活用
- **設計レビュー**: アーキテクチャや実装パターンの多角的検証

## 機能詳細

| 機能 | 詳細 |
|------|------|
| **MCP セットアップ** | See [references/codex-mcp-setup.md](references/codex-mcp-setup.md) |
| **レビュー統合** | See [references/codex-review-integration.md](references/codex-review-integration.md) |
| **4並列レビュー** | See [references/codex-parallel-review.md](references/codex-parallel-review.md) |
| **モード切替** | See [references/codex-mode.md](references/codex-mode.md) |

## 実行手順

1. ユーザーのリクエストを分類
2. 上記の「機能詳細」から適切な参照ファイルを読む
3. その内容に従って設定またはレビューを実行

### ⚠️ 並列レビュー時の必須ルール

**Codex モード(`review.mode: codex`)でのレビュー実行時**:

1. **呼び出すエキスパートを判定**(全部ではなく必要なもののみ):
   - 設定で `enabled: false` → 除外
   - CLI/バックエンド → Accessibility, SEO 除外
   - ドキュメントのみ変更 → Quality, Architect, Plan Reviewer, Scope Analyst を優先(Security, Performance は除外可)
2. 有効なエキスパートの `references/experts/*.md` から **プロンプトを個別に読み込む**
3. 有効なエキスパートのみ **Bash バックグラウンドプロセスで並列実行**
4. 絶対に1回の呼び出しで複数観点をまとめない

```
✅ 正しい(並列 CLI 実行):
   # macOS: brew install coreutils
   TIMEOUT=$(command -v timeout || command -v gtimeout || echo "")
   $TIMEOUT 120 codex exec "$(cat /tmp/expert-security-prompt.md)" > /tmp/expert-security.txt 2>/dev/null &
   $TIMEOUT 120 codex exec "$(cat /tmp/expert-perf-prompt.md)" > /tmp/expert-perf.txt 2>/dev/null &
   $TIMEOUT 120 codex exec "$(cat /tmp/expert-quality-prompt.md)" > /tmp/expert-quality.txt 2>/dev/null &
   $TIMEOUT 120 codex exec "$(cat /tmp/expert-a11y-prompt.md)" > /tmp/expert-a11y.txt 2>/dev/null &
   wait

❌ 間違い:
   codex exec "セキュリティとパフォーマンスと品質をレビューして"
```

**詳細**: [references/codex-parallel-review.md](references/codex-parallel-review.md)

---

## 📋 Codex CLI 実行方法

Codex CLI がインストールされていれば、以下のように呼び出します:

| 方法 | コマンド |
|------|---------|
| 単発レビュー | `$TIMEOUT 120 codex exec "$(cat prompt.md)" 2>/dev/null` |
| 並列レビュー | 各エキスパートを `&` で並列実行し `wait` で待機 |

---

## 🔧 クイックスタート

### 前提条件

1. **Codex CLI がインストール済み**
   ```bash
   which codex  # パスが表示されること
   ```

2. **タイムアウトコマンド**(macOS の場合)
   ```bash
   brew install coreutils  # gtimeout を提供
   ```

3. **Codex にログイン済み**
   ```bash
   codex login status  # 認証済みであること
   ```

### 動作確認

```bash
# Codex CLI の応答テスト
codex exec "echo hello"
```

---

## 🔄 レビューワークフロー

### Solo モード

```
/harness-review 実行
    │
    ├── Claude レビュー(従来通り)
    │
    └── Codex CLI 呼び出し(有効時)
            │
            └── 結果統合
```

### 2-Agent モード

```
PM(Cursor / Codex)
    │
    └── タスク依頼
            │
            ├── Claude Code 実装
            │
            └── /harness-review
                    │
                    ├── Claude レビュー
                    └── Codex セカンドオピニオン
```

---

## ⚙️ 設定

`.claude-code-harness.config.yaml` で Codex 統合を設定:

```yaml
review:
  codex:
    enabled: true           # Codex セカンドオピニオン有効化
    auto: false             # true: 自動実行 / false: 毎回確認
    prompt: "Review the code and output issues and improvement suggestions"
    # execution_mode: mcp   # Legacy: MCP (no progress display)
```

| 設定項目 | デフォルト | 説明 |
|---------|-----------|------|
| `enabled` | `false` | Codex 統合の有効/無効 |
| `auto` | `false` | 自動レビュー実行 |
| `prompt` | (上記) | Codex へのレビュープロンプト |
| `execution_mode` | `exec` | 実行モード(`exec`: CLI直接、推奨)|

> **Note**: 全ての Codex 呼び出しは `exec` (CLI) を使用。並列エキスパートは Bash バックグラウンドプロセス (`&` + `wait`) で並列実行

---

## 💡 活用例

### 例1: セットアップ

```
ユーザー: 「Codex でもレビューできるようにして」

Claude Code:
→ codex-mcp-setup.md を読み込み
→ Codex インストール確認
→ MCP 登録実行
→ 設定ファイル更新
```

### 例2: レビュー時

```
ユーザー: 「セカンドオピニオンもらって」

Claude Code:
→ codex.enabled = true を確認
→ CLI 経由で Codex にレビュー依頼
→ 結果を統合して表示
```

---

## ⚠️ 注意事項

### パフォーマンス

- Codex CLI 呼び出しには数秒〜数十秒かかる場合があります
- 大規模ファイルの場合はチャンク分割が推奨

### コスト

- Codex API 利用には OpenAI のクレジットが必要です
- レビュー頻度に応じたコスト見積もりを推奨

### トラブルシューティング

**問題**: Codex CLI が応答しない
**解決策**:
1. `which codex` でインストール確認
2. `codex login status` で認証確認
3. `$TIMEOUT 10 codex exec "echo test"` でタイムアウトテスト

**問題**: レビュー結果が返らない
**解決策**:
1. ネットワーク接続を確認
2. API クレジット残高を確認
3. タイムアウト値を延長して再試行

---

## 📚 参考資料

- [Codex CLI Reference](https://developers.openai.com/codex/cli/reference/)
- [Claude Code MCP 設定](https://docs.anthropic.com/claude-code/mcp)
- [Codex MCP 統合記事 (Qiita)](https://qiita.com/YasuhiroKawano/items/76d255b1fd97548dedc5)

Overview

This skill provides a Codex-based second opinion for code reviews, integrating OpenAI Codex CLI alongside Claude Code to deliver independent, non-aligned feedback. It helps teams run parallel expert reviews via the Codex CLI and merge results with Claude's review for a broader, multi-model assessment.

How this skill works

The skill detects requests that ask for a Codex review or second opinion and triggers Codex CLI calls (exec mode). It can run multiple expert prompts in parallel as separate CLI processes, collect each expert's output, and present an aggregated view without combining perspectives in a single call. Configuration is controlled via the harness config to enable, auto-run, and set the Codex prompt.

When to use it

  • When you want an independent second opinion on a Claude Code review
  • When you need parallel specialist reviews (security, performance, accessibility, quality)
  • When setting up Codex CLI and authentication for review workflows
  • When verifying design or architecture decisions from another model
  • When you want to integrate Codex results into an existing review pipeline

Best practices

  • Only enable Codex integration for requests that explicitly ask for a Codex review or second opinion
  • Run each expert as a separate Codex CLI process and avoid merging multiple perspectives into one prompt
  • Use background processes (& + wait) and timeouts for parallel reviews to avoid blocking
  • Exclude unnecessary experts based on file type or scope to reduce cost and noise
  • Chunk very large files before sending to Codex to improve responsiveness

Example use cases

  • User asks 'Give me a Codex review' — run Codex CLI and return findings alongside Claude's review
  • Enable Codex in config to automatically request a second opinion on every review
  • Run parallel security, performance, and accessibility expert prompts via separate Codex exec calls
  • Assist initial setup by verifying Codex CLI installation and authentication status
  • Troubleshoot missing Codex responses by testing CLI with simple echo commands

FAQ

Which triggers load this skill?

Load when the user mentions Codex review, second opinion, or Codex setup phrases such as 'Codex review', 'second opinion', 'Codex setup', or equivalent.

When should I not load Codex integration?

Do not load for implementation requests or Codex-as-creator tasks (e.g., 'implement with Codex', 'Codex Worker', or 'make with Codex')—those are for the implementation workflow, not review.