codex-review by benedictking/codex-review
npx skills add https://github.com/benedictking/codex-review --skill codex-review当用户输入包含以下内容时触发:
单独运行 codex review --uncommitted 只向 AI 展示了“做了什么(实现)”。先记录意图则告诉 AI“你原本想做什么(意图)”。
“代码变更 + 意图描述”作为组合输入是提高 AI 代码审查质量最有效的方式。
本技能分两个阶段运行:
git diff --name-only && git status --short
根据输出决定审查模式:
codex review --commit HEAD广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在任何审查之前,必须检查 CHANGELOG.md 是否包含当前变更的描述。
# 检查 CHANGELOG.md 是否在未提交的更改中
git diff --name-only | grep -E "(CHANGELOG|changelog)"
如果 CHANGELOG 未更新,你必须自动执行以下操作(不要要求用户手动操作):
git diff --stat 和 git diff 以获取完整的变更信息[Unreleased] 部分的顶部自动生成的 CHANGELOG 条目格式:
## [Unreleased]
### Added / Changed / Fixed
- 功能描述:解决了什么问题或实现了什么功能
- 影响文件:主要修改的文件/模块
示例 - 自动生成流程:
1. 检测到 CHANGELOG 未更新
2. 运行 git diff --stat,发现 handlers/responses.go 被修改(+88 行)
3. 运行 git diff 分析详情:添加了 CompactHandler 函数
4. 自动生成条目:
### Added
- 添加了 `/v1/responses/compact` 端点用于对话上下文压缩
- 支持多通道故障转移和请求体大小限制
5. 使用 Edit 工具写入 CHANGELOG.md
6. 继续执行 lint 和 codex review
在调用 codex review 之前,必须将所有新文件(未跟踪的文件)添加到 git 暂存区,否则 codex 将报告 P1 错误。
# 检查新文件
git status --short | grep "^??"
如果存在新文件,自动执行:
# 安全地暂存所有新文件(处理空列表和特殊文件名)
git ls-files --others --exclude-standard -z | while IFS= read -r -d '' f; do git add -- "$f"; done
解释:
-z 使用空字符分隔文件名,正确处理包含空格/换行符的文件名while IFS= read -r -d '' 逐个读取文件名git add -- "$f" 使用 -- 分隔符,正确处理以 - 开头的文件名统计变更规模:
# 获取所有变更(已暂存 + 未暂存)的摘要行
# 重要:必须使用 'HEAD' 作为基准以包含已暂存和未暂存的变更
git diff --stat HEAD | tail -1
为什么使用 git diff --stat HEAD:
git diff --stat 只显示未暂存的变更git diff --cached --stat 只显示已暂存的变更git diff --stat HEAD 显示已暂存和未暂存的变更总和tail -1)是包含总文件数和行变更的摘要行难度评估标准:
模型 + 推理努力组合:
| 组合 | 质量 | 时间 | 超时 | 推荐用于 |
|---|---|---|---|---|
model=gpt-5.2 model_reasoning_effort=xhigh | 最佳 | ~15-20 分钟 | 40 分钟 | 关键代码、架构变更 |
model=gpt-5.3-codex model_reasoning_effort=xhigh | 高 | ~8-9 分钟 | 15 分钟 | 困难任务(默认) |
model=gpt-5.2 model_reasoning_effort=high | 高 | ~8-9 分钟 | 15 分钟 | 困难任务的替代方案 |
model=gpt-5.3-codex model_reasoning_effort=high | 良好 | ~5-6 分钟 | 10 分钟 | 普通任务(默认) |
关键任务(满足任一条件,使用最佳质量模型):
--config model=gpt-5.2 --config model_reasoning_effort=xhigh,超时 40 分钟困难任务(满足任一条件):
--config model=gpt-5.3-codex --config model_reasoning_effort=xhigh,超时 15 分钟普通任务(其他情况):
--config model=gpt-5.3-codex --config model_reasoning_effort=high,超时 10 分钟评估方法:
你必须正确解析 git diff --stat HEAD 的输出以确定难度:
# 获取摘要行(git diff --stat HEAD 的最后一行)
git diff --stat HEAD | tail -1
# 示例输出:
# "20 files changed, 342 insertions(+), 985 deletions(-)"
# "1 file changed, 50 insertions(+)" # 无删除
# "3 files changed, 120 deletions(-)" # 无新增
关键:为什么摘要行很重要:
file.go | 171 ++++++++++++++++++++-6 files changed, 1341 insertions(+), 18 deletions(-)tail -1 提取最后一行以获得准确的总数解析规则:
重要边界情况:
"1 file changed"(单数形式)"insertions(+)" → 视为 0"deletions(-)" → 视为 0"0 insertions(+), 0 deletions(-)" 或两者都省略决策逻辑(按顺序检查,首次匹配生效):
示例案例:
model=gpt-5.2 model_reasoning_effort=xhigh,超时 40 分钟(核心架构变更)model=gpt-5.3-codex model_reasoning_effort=xhigh,超时 15 分钟model=gpt-5.3-codex model_reasoning_effort=xhigh,超时 15 分钟model=gpt-5.3-codex model_reasoning_effort=high,超时 10 分钟model=gpt-5.3-codex model_reasoning_effort=high,超时 10 分钟调用 codex-runner 子任务:
使用 Task 工具调用 codex-runner,传递完整的命令(包括 Lint + codex review):
Task parameters:
- subagent_type: Bash
- description: "执行 Lint 和 codex review"
- timeout: 900000(困难任务 15 分钟)或 600000(普通任务 10 分钟)
- prompt: 根据项目类型和难度选择相应的命令
Go 项目 - 困难任务:
go fmt ./... && go vet ./... && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(超时:900000)
Go 项目 - 普通任务:
go fmt ./... && go vet ./... && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(超时:600000)
Node 项目 - 困难任务:
npm run lint:fix && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(超时:900000)
Node 项目 - 普通任务:
npm run lint:fix && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(超时:600000)
Python 项目 - 困难任务:
black . && ruff check --fix . && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(超时:900000)
Python 项目 - 普通任务:
black . && ruff check --fix . && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(超时:600000)
干净工作目录:
codex review --commit HEAD --config model=gpt-5.3-codex --config model_reasoning_effort=high
(超时:600000)
如果 Codex 发现 Changelog 描述与代码逻辑不一致:
codex review [OPTIONS] [PROMPT]
注意:[PROMPT] 参数不能与 --uncommitted、--base 或 --commit 一起使用。
| 选项 | 描述 | 示例 |
|---|---|---|
--uncommitted | 审查工作目录中所有未提交的更改(已暂存 + 未暂存 + 未跟踪) | codex review --uncommitted |
--base <BRANCH> | 审查相对于指定基础分支的更改 | codex review --base main |
--commit <SHA> | 审查指定提交引入的更改 | codex review --commit HEAD |
--title <TITLE> | 可选的提交标题,显示在审查摘要中 | codex review --uncommitted --title "feat: add JSON parser" |
-c, --config <key=value> | 覆盖配置值 | codex review --uncommitted -c model="o3" |
# 1. 审查所有未提交的更改(最常见)
codex review --uncommitted
# 2. 审查最新提交
codex review --commit HEAD
# 3. 审查特定提交
codex review --commit abc1234
# 4. 审查当前分支相对于 main 的所有更改
codex review --base main
# 5. 审查当前分支相对于 develop 的所有更改
codex review --base develop
# 6. 附带标题进行审查(标题显示在审查摘要中)
codex review --uncommitted --title "fix: resolve JSON parsing errors"
# 7. 使用特定模型进行审查
codex review --uncommitted -c model="o3"
--uncommitted、--base、--commit 互斥,不能一起使用[PROMPT] 参数与上述三个选项互斥timeout: 900000)timeout: 600000)为什么分离上下文?
每周安装数
292
仓库
GitHub 星标数
8
首次出现
2026 年 1 月 19 日
安全审计
安装于
codex264
opencode247
gemini-cli243
claude-code221
github-copilot164
cursor158
Triggered when user input contains:
Running codex review --uncommitted alone only shows AI "what was done (Implementation)". Recording intention first tells AI "what you wanted to do (Intention)".
"Code changes + intention description" as combined input is the most effective way to improve AI code review quality.
This skill operates in two phases:
git diff --name-only && git status --short
Decide review mode based on output:
codex review --commit HEADBefore any review, must check if CHANGELOG.md contains description of current changes.
# Check if CHANGELOG.md is in uncommitted changes
git diff --name-only | grep -E "(CHANGELOG|changelog)"
If CHANGELOG is not updated, you must automatically perform the following (don't ask user to do it manually):
git diff --stat and git diff to get complete changes[Unreleased] sectionAuto-generated CHANGELOG entry format:
## [Unreleased]
### Added / Changed / Fixed
- Feature description: what problem was solved or what functionality was implemented
- Affected files: main modified files/modules
Example - Auto-generation Flow:
1. Detected CHANGELOG not updated
2. Run git diff --stat, found handlers/responses.go modified (+88 lines)
3. Run git diff to analyze details: added CompactHandler function
4. Auto-generate entry:
### Added
- Added `/v1/responses/compact` endpoint for conversation context compression
- Supports multi-channel failover and request body size limits
5. Use Edit tool to write to CHANGELOG.md
6. Continue with lint and codex review
Before invoking codex review, must add all new files (untracked files) to git staging area, otherwise codex will report P1 error.
# Check for new files
git status --short | grep "^??"
If there are new files, automatically execute:
# Safely stage all new files (handles empty list and special filenames)
git ls-files --others --exclude-standard -z | while IFS= read -r -d '' f; do git add -- "$f"; done
Explanation:
-z uses null character to separate filenames, correctly handles filenames with spaces/newlineswhile IFS= read -r -d '' reads filenames one by onegit add -- "$f" uses -- separator, correctly handles filenames starting with -Count change scale:
# Get summary line for ALL changes (staged + unstaged)
# IMPORTANT: Must use 'HEAD' as base to include both staged and unstaged changes
git diff --stat HEAD | tail -1
Why usegit diff --stat HEAD:
git diff --stat only shows unstaged changesgit diff --cached --stat only shows staged changesgit diff --stat HEAD shows BOTH staged and unstaged changes combinedtail -1) is the summary line with total file count and line changesDifficulty Assessment Criteria:
Model + Reasoning Effort Combinations:
| Combination | Quality | Time | Timeout | Recommended For |
|---|---|---|---|---|
model=gpt-5.2 model_reasoning_effort=xhigh | Best | ~15-20 min | 40 min | Critical code, architecture changes |
model=gpt-5.3-codex model_reasoning_effort=xhigh | High | ~8-9 min | 15 min | Difficult tasks (default) |
model=gpt-5.2 model_reasoning_effort=high | High | ~8-9 min | 15 min | Alternative for difficult tasks |
Critical Tasks (meets any condition, use best quality model):
--config model=gpt-5.2 --config model_reasoning_effort=xhigh, timeout 40 minutesDifficult Tasks (meets any condition):
--config model=gpt-5.3-codex --config model_reasoning_effort=xhigh, timeout 15 minutesNormal Tasks (other cases):
--config model=gpt-5.3-codex --config model_reasoning_effort=high, timeout 10 minutesEvaluation Method:
You MUST parse the git diff --stat HEAD output correctly to determine difficulty:
# Get the summary line (last line of git diff --stat HEAD)
git diff --stat HEAD | tail -1
# Example outputs:
# "20 files changed, 342 insertions(+), 985 deletions(-)"
# "1 file changed, 50 insertions(+)" # No deletions
# "3 files changed, 120 deletions(-)" # No insertions
Critical: Why the summary line matters:
file.go | 171 ++++++++++++++++++++-6 files changed, 1341 insertions(+), 18 deletions(-)tail -1 to get accurate totalsParsing Rules:
Important Edge Cases:
"1 file changed" (singular form)"insertions(+)" entirely → treat as 0"deletions(-)" entirely → treat as 0"0 insertions(+), 0 deletions(-)" or omit bothDecision Logic (check in order, first match wins):
Example Cases:
model=gpt-5.2 model_reasoning_effort=xhigh,超时 40 分钟(核心架构变更)model=gpt-5.3-codex model_reasoning_effort=xhigh,超时 15 分钟model=gpt-5.3-codex model_reasoning_effort=xhigh,超时 15 分钟model=gpt-5.3-codex model_reasoning_effort=high,超时 10 分钟model=gpt-5.3-codex model_reasoning_effort=high,超时 10 分钟Invoke codex-runner Subtask:
Use Task tool to invoke codex-runner, passing complete command (including Lint + codex review):
Task parameters:
- subagent_type: Bash
- description: "Execute Lint and codex review"
- timeout: 900000 (15 minutes for difficult tasks) or 600000 (10 minutes for normal tasks)
- prompt: Choose corresponding command based on project type and difficulty
Go project - Difficult task:
go fmt ./... && go vet ./... && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 900000)
Go project - Normal task:
go fmt ./... && go vet ./... && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(timeout: 600000)
Node project - Difficult task:
npm run lint:fix && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 900000)
Node project - Normal task:
npm run lint:fix && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(timeout: 600000)
Python project - Difficult task:
black . && ruff check --fix . && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 900000)
Python project - Normal task:
black . && ruff check --fix . && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=high
(timeout: 600000)
Clean working directory:
codex review --commit HEAD --config model=gpt-5.3-codex --config model_reasoning_effort=high
(timeout: 600000)
If Codex finds Changelog description inconsistent with code logic:
codex review [OPTIONS] [PROMPT]
Note : [PROMPT] parameter cannot be used with --uncommitted, --base, or --commit.
| Option | Description | Example |
|---|---|---|
--uncommitted | Review all uncommitted changes in working directory (staged + unstaged + untracked) | codex review --uncommitted |
--base <BRANCH> | Review changes relative to specified base branch | codex review --base main |
--commit <SHA> | Review changes introduced by specified commit | codex review --commit HEAD |
# 1. Review all uncommitted changes (most common)
codex review --uncommitted
# 2. Review latest commit
codex review --commit HEAD
# 3. Review specific commit
codex review --commit abc1234
# 4. Review all changes in current branch relative to main
codex review --base main
# 5. Review changes in current branch relative to develop
codex review --base develop
# 6. Review with title (title shown in review summary)
codex review --uncommitted --title "fix: resolve JSON parsing errors"
# 7. Review using specific model
codex review --uncommitted -c model="o3"
--uncommitted, --base, --commit are mutually exclusive, cannot be used together[PROMPT] parameter is mutually exclusive with the above three optionstimeout: 900000)timeout: 600000)Why separate contexts?
Weekly Installs
292
Repository
GitHub Stars
8
First Seen
Jan 19, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykPass
Installed on
codex264
opencode247
gemini-cli243
claude-code221
github-copilot164
cursor158
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
model=gpt-5.3-codex model_reasoning_effort=high| Good |
| ~5-6 min |
| 10 min |
| Normal tasks (default) |
--title <TITLE> |
| Optional commit title, displayed in review summary |
codex review --uncommitted --title "feat: add JSON parser" |
-c, --config <key=value> | Override configuration values | codex review --uncommitted -c model="o3" |