Claude CodeのカスタムコマンドをCodex CLIと共有する
はじめに
AIエージェントコーディングツールは、Claude Codeしか使っていなかったのですが、
最近、Codex CLIの方が性能的に良くなってきたので、両方使うようになってきました。
それに伴い、Claude Codeで設定していたカスタムコマンドをCodex CLIでもそのまま使いたいと思い、カスタムコマンドをいちいちコピーせずに両方で共有できる方法があったのでそれについて解説します。
設定方法
前提条件
前提条件としては、以下のようにClaude Codeのcommandsディレクトリにカスタムコマンドがあり、~/.codex/prompts はまだない状態とします。
❯ ls ~/.claude/commands
code-review.md create-branch-from-diff.md create-sub-issue.md design.md hello.md marp.md search.md spec.md test-design.md
commit-push.md create-pr.md d-search.md generate-issue-spec.md implement-issue.md requirements.md serena.md tasks.md textlint.md
❯ ll ~/.codex
.rw-r--r-- xxxxx staff 33 B Wed Sep 3 23:15:00 2025 AGENTS.md
.rw------- xxxxx staff 4.0 KB Tue Sep 2 22:53:02 2025 auth.json
.rw------- xxxxx staff 1.5 KB Thu Sep 4 12:41:34 2025 config.toml
.rw------- xxxxx staff 8.1 KB Sun Sep 7 20:23:17 2025 history.jsonl
drwxr-xr-x xxxxx staff 96 B Sat Aug 23 22:52:30 2025 log
drwxr-xr-x xxxxx staff 96 B Sat Aug 23 22:52:58 2025 sessions
.rw-r--r-- xxxxx staff 76 B Fri Sep 5 19:39:27 2025 version.json
手順
方法は以下のコマンドでシンボリックリンクを貼るだけでOKです。
ln -s ~/.claude/commands ~/.codex/prompts
上のコマンドを実行したら、~/.codex を確認して、
シンボリックリンクが ~/.claude/commands に対して貼れていることを確認します。
❯ ll
.rw-r--r-- xxxx staff 33 B Wed Sep 3 23:15:00 2025 AGENTS.md
.rw------- xxxx staff 4.0 KB Tue Sep 2 22:53:02 2025 auth.json
.rw------- xxxx staff 1.5 KB Thu Sep 4 12:41:34 2025 config.toml
.rw------- xxxx staff 8.1 KB Sun Sep 7 20:23:17 2025 history.jsonl
drwxr-xr-x xxxx staff 96 B Sat Aug 23 22:52:30 2025 log
lrwxr-xr-x xxxx staff 31 B Wed Sep 10 20:18:42 2025 prompts ⇒ /Users/xxxx/.claude/commands
drwxr-xr-x xxxx staff 96 B Sat Aug 23 22:52:58 2025 sessions
.rw-r--r-- xxxx staff 76 B Fri Sep 5 19:39:27 2025 version.json
確認
あとは実際にcodexを起動してコマンドが実行できることを確認します。
codex
例として、以下のカスタムコマンドが ~/.claude/commands にあるとします。
# Hello
以下のコマンドを実行してください。
```
echo hello
```
起動したら、helloコマンドを実行します。
その結果、以下のように Claude Code側で定義しているカスタムコマンド(/hello)の内容が出力されました。
他のカスタムコマンドも同様に呼び出すことができます。
ただし、~/.claude/commands 側のカスタムコマンドがすでに別なシンボリックを貼られているものに関してはなぜかCodex CLIで認識されないようなので注意です。
まとめ
シンボリックリンクを貼るだけで、Claude CodeのカスタムコマンドをCodex CLIと共有して使えました。
Codex CLI側に完全に移行せずに、Claude Codeも併用したい方にはオススメです。
Discussion