codex-agent/SKILL.md
Codex (gpt-5.3-codex high) AI 代理 - 代码编写与实现专家。支持代码编写、功能实现、bug 修复、重构、测试、代码审查。使用 /codex-agent <描述> 或 /codex <描述> 委派代码任务给 Codex。
npx skillsauth add thendcn/ai-team-skills codex-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
将代码编写和实现任务委派给 Codex (gpt-5.3-codex, reasoning effort: high),由 Claude Code 编排和审查。
/codex-agent <代码任务描述>
/codex <代码任务描述>
也可由 Claude Code 在分析任务后自动委派(当任务涉及代码编写/实现/修复/重构/测试/审查时)。
codex-run.shcodex-run.ps1(必须通过 powershell.exe -ExecutionPolicy Bypass -File 调用)-f / -File 参数,避免 shell 转义问题)full-auto(默认),实际项目开发用 dangerous-o / -Output 指定的输出文件获取执行结果Linux / macOS (Bash):
# 标准执行(full-auto 沙箱,安全默认)
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -f /tmp/codex-prompt.txt -d <工作目录>
# 需要完整权限时(如安装依赖、修改系统文件)
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -f /tmp/codex-prompt.txt -s dangerous -d <工作目录>
# 只读代码审查
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -r --uncommitted -d <工作目录> -o /tmp/review.txt
# 将结果写入文件(流水线模式)
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -f /tmp/codex-prompt.txt -o /tmp/codex-result.txt -d <工作目录>
Windows(重要:必须使用 powershell.exe 调用 .ps1 脚本):
Claude Code 在 Windows 上使用 bash shell,但 .ps1 脚本不能用 bash 执行。 必须通过
powershell.exe -ExecutionPolicy Bypass -File调用。 不要使用pwsh(除非确认已安装 PowerShell 7)。
# 标准执行(从 bash 调用 PowerShell 脚本)
powershell.exe -ExecutionPolicy Bypass -File ~/.claude/skills/codex-agent/scripts/codex-run.ps1 -File /tmp/codex-prompt.txt -Dir <工作目录>
# 需要完整权限时
powershell.exe -ExecutionPolicy Bypass -File ~/.claude/skills/codex-agent/scripts/codex-run.ps1 -File /tmp/codex-prompt.txt -Sandbox dangerous -Dir <工作目录>
# 只读代码审查
powershell.exe -ExecutionPolicy Bypass -File ~/.claude/skills/codex-agent/scripts/codex-run.ps1 -Review -Uncommitted -Dir <工作目录> -Output /tmp/review.txt
Windows 注意事项:
当包装脚本出问题时,可直接调用:
# 确保 PATH 包含 pnpm 全局 bin
export PATH="$HOME/.local/share/pnpm:$PATH"
# 代码编写/修复(通过 stdin 传递 prompt)
codex exec -s danger-full-access -C <工作目录> -o /tmp/result.txt - < /tmp/prompt.txt
# 代码审查(review 子命令)
codex exec review --uncommitted > /tmp/review.txt 2>&1
codex-run.sh / codex-run.ps1 [OPTIONS] [prompt...]
Bash: PowerShell:
-m, --model <model> -Model <model>
-d, --dir <directory> -Dir <directory>
-t, --timeout <seconds> -Timeout <seconds> (默认 900s)
-s, --sandbox <mode> -Sandbox <mode> (默认 full-auto)
-o, --output <file> -Output <file>
-f, --file <file> -File <file>
-r, --review -Review
--uncommitted -Uncommitted
--base <branch> -Base <branch>
默认行为:脚本默认跳过 git 仓库检查(--skip-git-repo-check),可在任何目录中使用。
以下是 codex CLI 的正确参数,脚本已处理映射:
| 功能 | 正确参数 | 错误参数(不要用) |
|------|----------|---------------------|
| 只读沙箱 | -s read-only | --read-only |
| 完整权限 | --dangerously-bypass-approvals-and-sandbox | --dangerously-auto-approve |
| 自动沙箱 | --full-auto | - |
| 工作目录 | -C <dir> | --workdir |
| 输出文件 | -o <file>(仅 exec 模式) | review 模式不支持 -o |
| stdin prompt | - < file.txt(末尾加 -) | -f file.txt(不存在此参数) |
| 模式 | codex 参数 | 适用场景 |
|------|-----------|----------|
| full-auto | --full-auto | 大多数代码编写任务 |
| dangerous | --dangerously-bypass-approvals-and-sandbox | 需要安装依赖、运行测试、修改配置 |
| read-only | -s read-only | 代码审查、分析 |
用于代码编写、功能实现、bug 修复、重构等需要修改文件的任务。
# 通过脚本
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -f /tmp/prompt.txt -s dangerous -d <dir> -o /tmp/result.txt
# 直接调用(prompt 通过 stdin)
codex exec -s danger-full-access -C <dir> -o /tmp/result.txt - < /tmp/prompt.txt
用于代码审查、安全检查、质量分析等只读任务。
# 审查未提交变更
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -r --uncommitted -d <dir> -o /tmp/review.txt
# 审查相对于某分支的变更
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh -r --base main -d <dir> -o /tmp/review.txt
# 直接调用(注意:review 输出在 stderr,需要 2>&1)
cd <dir> && codex exec review --uncommitted > /tmp/review.txt 2>&1
review 模式注意事项:
codex exec review 不支持 -C(工作目录)参数,需要先 cdcodex exec review 不支持 -o(输出文件)参数,需要用重定向2>&1--uncommitted 和自定义 prompt 不能同时使用将用户需求转化为 Codex 友好的 prompt 时:
参考 references/prompt-templates.md 获取完整模板。
exec 模式使用 -o 参数,review 模式使用重定向:
# exec 模式
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh \
-f /tmp/codex-prompt.txt \
-o /tmp/codex-result.txt \
-d ./project
# review 模式
bash ~/.claude/skills/codex-agent/scripts/codex-run.sh \
-r --uncommitted \
-o /tmp/codex-review.txt \
-d ./project
Claude 随后读取输出文件获取执行结果。
| 问题 | 原因 | 解决方案 |
|------|------|----------|
| command not found: codex | PATH 未包含 pnpm 全局 bin | 脚本已自动处理;直接调用时需 export PATH="$HOME/.local/share/pnpm:$PATH" |
| unexpected argument '--read-only' | 使用了错误的沙箱参数 | 正确参数是 -s read-only |
| unexpected argument '-f' | codex exec 不支持 -f | 使用 stdin:codex exec ... - < file.txt |
| review 输出为空 | review 输出在 stderr | 使用 2>&1 重定向 |
| cannot be used with '[PROMPT]' | review --uncommitted 和 prompt 冲突 | 二选一:用 --uncommitted 或自定义 prompt |
| Windows PS1 脚本启动 codex 失败 | npm/pnpm 安装的 codex 是 .ps1 包装脚本,Process.Start() 无法直接执行 | 脚本已自动处理:优先使用 .cmd 版本,否则通过 powershell.exe 间接执行 |
Codex 模型运行时间较长(通常 5-15 分钟),可通过任务拆分 + 并行执行提升效率。
run_in_background: true 模式启动多个后台任务以下场景直接单任务执行,不做拆分:
当用户请求包含以下关键词时,应路由到 codex-agent:
data-ai
Gemini (gemini-3-pro-preview) AI 代理 - UI 设计与前端开发专家。gemini-ui 的增强版,支持包装脚本、错误处理、流水线模式。触发条件:UI 设计、前端组件、页面布局、视觉设计、样式美化。使用 /gemini-agent <描述> 或 /design-ui <描述> 委派 UI 设计任务给 Gemini。
development
AI 团队协作流水线。自动编排 Claude(Lead) + Codex(代码) + Gemini(UI) 多 Agent 协作。使用 /ai-team <任务描述> 启动团队协作。
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.