codex
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodeX — Your Codex Coding Partner
CodeX — 你的Codex编码伙伴
Delegate coding execution to Codex CLI. CodeX turns clear plans into working code.
将编码执行任务委托给Codex CLI。CodeX能把清晰的方案转化为可运行的代码。
Critical rules
重要规则
- ONLY interact with CodeX through the bundled shell script. NEVER call CLI directly.
codex - Run the script ONCE per task. If it succeeds (exit code 0), read the output file and proceed. Do NOT re-run or retry.
- Do NOT read or inspect the script source code. Treat it as a black box.
- ALWAYS quote file paths containing brackets, spaces, or special characters when passing to the script (e.g. ). Unquoted
--file "src/app/[locale]/page.tsx"triggers zsh glob expansion.[...] - Keep the task prompt focused. Aim for under ~500 words. Describe WHAT to do and key constraints, not step-by-step HOW. CodeX is an autonomous agent with full workspace access — it reads files, explores code, and figures out implementation details on its own.
- Never paste file contents into the prompt. Use to point CodeX to key files — it reads them directly. Duplicating file contents in the prompt wastes tokens and adds no value.
--file - Don't reference or describe the SKILL.md itself in the prompt. CodeX doesn't need to know about this skill's configuration.
- 仅通过捆绑的shell script与CodeX交互。切勿直接调用CLI。
codex - 每个任务仅运行一次脚本。如果执行成功(退出码0),请读取输出文件并继续操作。不要重新运行或重试。
- 不要读取或查看脚本源代码。将其视为黑盒。
- 当向脚本传递包含括号、空格或特殊字符的文件路径时,务必添加引号(例如)。未加引号的
--file "src/app/[locale]/page.tsx"会触发zsh通配符扩展。[...] - 保持任务提示聚焦。目标是控制在约500字以内。说明要做什么以及关键约束,而非一步步的实现步骤。CodeX是拥有完整工作区访问权限的自主Agent——它会自行读取文件、探索代码并确定实现细节。
- 切勿在提示中粘贴文件内容。使用参数为CodeX指定关键文件——它会直接读取这些文件。在提示中重复文件内容会浪费token且毫无价值。
--file - 不要在提示中提及或描述SKILL.md本身。CodeX无需了解该技能的配置信息。
How to call the script
如何调用脚本
The script path is:
~/.claude/skills/codex/scripts/ask_codex.shMinimal invocation:
bash
~/.claude/skills/codex/scripts/ask_codex.sh "Your request in natural language"With file context:
bash
~/.claude/skills/codex/scripts/ask_codex.sh "Refactor these components to use the new API" \
--file src/components/UserList.tsx \
--file src/components/UserDetail.tsxMulti-turn conversation (continue a previous session):
bash
~/.claude/skills/codex/scripts/ask_codex.sh "Also add retry logic with exponential backoff" \
--session <session_id from previous run>The script prints on success:
session_id=<thread_id>
output_path=<path to markdown file>Read the file at to get CodeX's response. Save if you plan follow-up calls.
output_pathsession_id脚本路径为:
~/.claude/skills/codex/scripts/ask_codex.sh最简调用方式:
bash
~/.claude/skills/codex/scripts/ask_codex.sh "你的自然语言请求"带文件上下文的调用:
bash
~/.claude/skills/codex/scripts/ask_codex.sh "重构这些组件以使用新API" \
--file src/components/UserList.tsx \
--file src/components/UserDetail.tsx多轮对话(继续之前的会话):
bash
~/.claude/skills/codex/scripts/ask_codex.sh "同时添加带指数退避的重试逻辑" \
--session <上一次运行得到的session_id>脚本执行成功后会输出:
session_id=<thread_id>
output_path=<markdown文件路径>读取指向的文件以获取CodeX的响应。如果计划进行后续调用,请保存。
output_pathsession_idDecision policy
决策策略
Call CodeX when at least one of these is true:
- The implementation plan is clear and needs coding execution.
- The task involves batch refactoring, code generation, or repetitive changes.
- Multiple files need coordinated modifications following a defined pattern.
- You want a practitioner's perspective on whether a plan is feasible.
- The task is cost-sensitive and doesn't require deep architectural reasoning.
- Writing or updating tests based on existing code.
- Simple-to-moderate bug fixes where the root cause is identified.
当满足以下至少一个条件时,调用CodeX:
- 实现方案明确,需要执行编码。
- 任务涉及批量重构、代码生成或重复性修改。
- 需要按照既定模式协调修改多个文件。
- 你希望从从业者的角度判断某方案是否可行。
- 任务对成本敏感,且不需要深度架构推理。
- 基于现有代码编写或更新测试。
- 已确定根本原因的简单到中等难度的bug修复。
Workflow
工作流程
- Design the solution and identify the key files involved.
- Run the script with a clear, concise task description. Tell CodeX the goal and constraints, not step-by-step implementation details — it figures those out itself. For discussion, use a question-oriented task with .
--read-only - Pass relevant files with (2-6 high-signal entry points; CodeX has full workspace access and will discover related files on its own).
--file - Read the output — CodeX executes changes and reports what it did.
- Review the changes in your workspace.
For multi-step projects, use to continue with full conversation history. For independent parallel tasks, use the Task tool with .
--session <id>run_in_background: true- 设计解决方案并确定涉及的关键文件。
- 使用清晰、简洁的任务描述运行脚本。告知CodeX目标和约束,而非一步步的实现细节——它会自行处理这些。如果是讨论需求,请使用面向问题的任务描述并添加参数。
--read-only - 使用参数传递相关文件(2-6个高信号入口点;CodeX拥有完整工作区访问权限,会自行发现相关文件)。
--file - 读取输出内容——CodeX会执行修改并报告操作内容。
- 在你的工作区中审查修改内容。
对于多步骤项目,使用参数恢复会话,以保留完整对话历史。对于独立的并行任务,请使用Task工具并设置。
--session <id>run_in_background: trueOptions
可选参数
- — Target workspace directory (defaults to current directory).
--workspace <path> - — Point CodeX to key entry-point files (repeatable, workspace-relative or absolute). Don't duplicate their contents in the prompt.
--file <path> - — Resume a previous session for multi-turn conversation.
--session <id> - — Override model (default: uses Codex config).
--model <name> - — Reasoning effort:
--reasoning <level>,low,medium(default:high). Usemediumfor code review, debugging, complex refactoring, or root cause analysis.high - — Override sandbox policy (default: workspace-write via full-auto).
--sandbox <mode> - — Read-only mode for pure discussion/analysis, no file changes.
--read-only
- — 目标工作区目录(默认为当前目录)。
--workspace <path> - — 为CodeX指定关键入口文件(可重复使用,支持工作区相对路径或绝对路径)。不要在提示中重复文件内容。
--file <path> - — 恢复之前的会话以进行多轮对话。
--session <id> - — 覆盖默认模型(默认使用Codex配置的模型)。
--model <name> - — 推理强度:
--reasoning <level>、low、medium(默认为high)。在代码审查、调试、复杂重构或根本原因分析时使用medium。high - — 覆盖沙箱策略(默认为全自动工作区写入)。
--sandbox <mode> - — 只读模式,仅用于纯讨论/分析,不修改文件。
--read-only