AgentSkillsCN

collaborating-with-codex

将编码任务委托给 Codex CLI,用于原型开发、调试与代码评审。适用于需要算法实现、Bug 分析,或获取代码质量反馈时使用。支持通过 SESSION_ID 实现多轮对话。

SKILL.md
--- frontmatter
name: collaborating-with-codex
description: Delegates coding tasks to Codex CLI for prototyping, debugging, and code review. Use when needing algorithm implementation, bug analysis, or code quality feedback. Supports multi-turn sessions via SESSION_ID.

How to Invoke (CRITICAL)

MUST use Bash tool with run_in_background: true:

bash
python /Users/jiabinfeng/Documents/work/go/q9jy-backend/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py \
  --cd "/Users/jiabinfeng/Documents/work/go/q9jy-backend" \
  --PROMPT "Your task description here"

After launching, use TaskOutput to get results:

code
TaskOutput: task_id=<returned_task_id>, block=true

Output: JSON with success, SESSION_ID, agent_messages, and optional error.

Parameters

ParameterRequiredDefaultDescription
--PROMPTYes-Task instruction to send to Codex
--cdYes-Workspace root directory (use absolute path)
--sandboxNoread-onlyread-only / workspace-write / danger-full-access
--SESSION_IDNo-Resume a previous session
--return-all-messagesNoFalseInclude full reasoning trace
--imageNo-Attach image files (comma-separated)

Multi-turn Sessions

Always capture SESSION_ID from the first response for follow-up:

bash
# Initial task
python /Users/jiabinfeng/Documents/work/go/q9jy-backend/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py \
  --cd "/Users/jiabinfeng/Documents/work/go/q9jy-backend" \
  --PROMPT "Analyze auth in backend/internal/handler/auth.go"

# Continue with SESSION_ID
python /Users/jiabinfeng/Documents/work/go/q9jy-backend/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py \
  --cd "/Users/jiabinfeng/Documents/work/go/q9jy-backend" \
  --SESSION_ID "uuid-from-response" \
  --PROMPT "Write unit tests for that"

Common Patterns

Code Review (request unified diff):

bash
python /Users/jiabinfeng/Documents/work/go/q9jy-backend/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py \
  --cd "/Users/jiabinfeng/Documents/work/go/q9jy-backend" \
  --PROMPT "Review backend/internal/service/order.go and provide unified diff for improvements. OUTPUT: Unified Diff Patch ONLY."

Debug with full trace:

bash
python /Users/jiabinfeng/Documents/work/go/q9jy-backend/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py \
  --cd "/Users/jiabinfeng/Documents/work/go/q9jy-backend" \
  --PROMPT "Debug this error: ..." \
  --return-all-messages