From codex-review
Performs code reviews on uncommitted git changes or latest commits, auto-generates and inserts CHANGELOG entries if missing, runs lints, and proactively fixes P0-P1-P2 issues.
npx claudepluginhub benedictking/codex-reviewThis skill is limited to using the following tools:
Triggered when user input contains:
Reviews code changes before commit or PR with configurable tone (harsh/constructive), Technical.md standards, architectural context, categorized issues with actionable fixes, todo tracking, and optional auto-commit.
Performs professional code reviews with automatic CHANGELOG generation using Codex AI. Useful for pre-commit reviews, changelog updates, and large-scale refactoring analysis.
Reviews git-tracked code changes for high-impact defects, security issues, regressions, and test gaps with evidence-based findings. Supports auto-fixing.
Share bugs, ideas, or general feedback.
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 use git 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:
Only recommend gpt-5.3-codex; choose model_reasoning_effort and timeout based on task complexity.
| Combination | Quality | Time | Timeout | Recommended For |
|---|---|---|---|---|
model=gpt-5.3-codex model_reasoning_effort=xhigh | High | ~8-20 min | 15-40 min | Difficult tasks, critical code, architecture changes |
model=gpt-5.3-codex model_reasoning_effort=high | Good | ~5-6 min | 10 min | Normal tasks (default) |
Critical Tasks (meets any condition, use highest reasoning effort):
--config model=gpt-5.3-codex --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.3-codex 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: 2400000 (40 minutes for critical tasks) / 900000 (15 minutes for difficult tasks) / 600000 (10 minutes for normal tasks)
- prompt: Choose corresponding command based on project type and difficulty
Go project - Critical task:
go fmt ./... && go vet ./... && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 2400000)
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 - Critical task:
npm run lint:fix && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 2400000)
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 - Critical task:
black . && ruff check --fix . && codex review --uncommitted --config model=gpt-5.3-codex --config model_reasoning_effort=xhigh
(timeout: 2400000)
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:
If Codex reports P0 / P1 / P2 issues, you must proactively fix them immediately instead of stopping at reporting.
Required behavior:
Fix priority:
Constraints:
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 |
--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="gpt-5.3-codex" |
# 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 the recommended model
codex review --uncommitted -c model="gpt-5.3-codex"
--uncommitted, --base, --commit are mutually exclusive, cannot be used together[PROMPT] parameter is mutually exclusive with the above three optionstimeout: 2400000)timeout: 900000)timeout: 600000)Why separate contexts?