codex

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CodeX — 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
    codex
    CLI directly.
  • 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.
    --file "src/app/[locale]/page.tsx"
    ). Unquoted
    [...]
    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
    --file
    to point CodeX to key files — it reads them directly. Duplicating file contents in the prompt wastes tokens and adds no value.
  • 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交互。切勿直接调用
    codex
    CLI。
  • 每个任务仅运行一次脚本。如果执行成功(退出码0),请读取输出文件并继续操作。不要重新运行或重试。
  • 不要读取或查看脚本源代码。将其视为黑盒。
  • 当向脚本传递包含括号、空格或特殊字符的文件路径时,务必添加引号(例如
    --file "src/app/[locale]/page.tsx"
    )。未加引号的
    [...]
    会触发zsh通配符扩展。
  • 保持任务提示聚焦。目标是控制在约500字以内。说明要做什么以及关键约束,而非一步步的实现步骤。CodeX是拥有完整工作区访问权限的自主Agent——它会自行读取文件、探索代码并确定实现细节。
  • 切勿在提示中粘贴文件内容。使用
    --file
    参数为CodeX指定关键文件——它会直接读取这些文件。在提示中重复文件内容会浪费token且毫无价值。
  • 不要在提示中提及或描述SKILL.md本身。CodeX无需了解该技能的配置信息。

How to call the script

如何调用脚本

The script path is:
~/.claude/skills/codex/scripts/ask_codex.sh
Minimal 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.tsx
Multi-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
output_path
to get CodeX's response. Save
session_id
if you plan follow-up calls.
脚本路径为:
~/.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文件路径>
读取
output_path
指向的文件以获取CodeX的响应。如果计划进行后续调用,请保存
session_id

Decision 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

工作流程

  1. Design the solution and identify the key files involved.
  2. 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
    .
  3. Pass relevant files with
    --file
    (2-6 high-signal entry points; CodeX has full workspace access and will discover related files on its own).
  4. Read the output — CodeX executes changes and reports what it did.
  5. Review the changes in your workspace.
For multi-step projects, use
--session <id>
to continue with full conversation history. For independent parallel tasks, use the Task tool with
run_in_background: true
.
  1. 设计解决方案并确定涉及的关键文件。
  2. 使用清晰、简洁的任务描述运行脚本。告知CodeX目标和约束,而非一步步的实现细节——它会自行处理这些。如果是讨论需求,请使用面向问题的任务描述并添加
    --read-only
    参数。
  3. 使用
    --file
    参数传递相关文件(2-6个高信号入口点;CodeX拥有完整工作区访问权限,会自行发现相关文件)。
  4. 读取输出内容——CodeX会执行修改并报告操作内容。
  5. 在你的工作区中审查修改内容。
对于多步骤项目,使用
--session <id>
参数恢复会话,以保留完整对话历史。对于独立的并行任务,请使用Task工具并设置
run_in_background: true

Options

可选参数

  • --workspace <path>
    — Target workspace directory (defaults to current directory).
  • --file <path>
    — Point CodeX to key entry-point files (repeatable, workspace-relative or absolute). Don't duplicate their contents in the prompt.
  • --session <id>
    — Resume a previous session for multi-turn conversation.
  • --model <name>
    — Override model (default: uses Codex config).
  • --reasoning <level>
    — Reasoning effort:
    low
    ,
    medium
    ,
    high
    (default:
    medium
    ). Use
    high
    for code review, debugging, complex refactoring, or root cause analysis.
  • --sandbox <mode>
    — Override sandbox policy (default: workspace-write via full-auto).
  • --read-only
    — Read-only mode for pure discussion/analysis, no file changes.
  • --workspace <path>
    — 目标工作区目录(默认为当前目录)。
  • --file <path>
    — 为CodeX指定关键入口文件(可重复使用,支持工作区相对路径或绝对路径)。不要在提示中重复文件内容。
  • --session <id>
    — 恢复之前的会话以进行多轮对话。
  • --model <name>
    — 覆盖默认模型(默认使用Codex配置的模型)。
  • --reasoning <level>
    — 推理强度:
    low
    medium
    high
    (默认为
    medium
    )。在代码审查、调试、复杂重构或根本原因分析时使用
    high
  • --sandbox <mode>
    — 覆盖沙箱策略(默认为全自动工作区写入)。
  • --read-only
    — 只读模式,仅用于纯讨论/分析,不修改文件。