codex CLI 代码审查
codex-review
使用本地 OpenAI `codex` CLI 运行代码审查。仅在用户明确提到 codex 时使用 —— "codex review"、"run codex on this branch"、"what does codex say"。不要用于"review my changes"或"look for bugs"这类通用审查请求;那些属于 /code-review,它保持在本地运行。本技能会将 diff 上传到 OpenAI。
- License 许可
- MIT
- 所属仓库
- gurdiga/dotfiles
- 最近更新
- 2026-10-10
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- codex-review
- description
- Run a code review using the local OpenAI `codex` CLI. Use ONLY when the user names codex explicitly — "codex review", "run codex on this branch", "what does codex say". Do NOT use for generic review requests like "review my changes" or "look for bugs"; those belong to /code-review, which stays local. This one uploads the diff to OpenAI.
02 资源文件 1
- 参考文档big.txt293.0 KB
03 SKILL.md 正文
Codex Review
codex is OpenAI's review CLI, run locally against a diff in the current repo. It uploads that diff to OpenAI, so it runs only when the user has asked for it by name. Offering it is fine where the model-routing rules call for a second opinion, but an offer isn't a request: say that it uploads the diff, and wait for the user to name Codex. Never reach for it as a general-purpose reviewer, and never run it on a repo the user hasn't pointed you at.
If codex isn't on PATH, say so and stop — don't offer to install it.
Pick the scope
Three mutually exclusive modes:
| Flag | Reviews |
|---|---|
--base <BRANCH> |
This branch against a base — the usual case |
--uncommitted |
Staged, unstaged, and untracked changes |
--commit <SHA> |
One commit's changes |
Match the flag to what the user actually wants reviewed. "Review my branch" is --base; "review my uncommitted changes" is --uncommitted. There is no staged-only mode: --uncommitted also uploads unstaged and untracked files, so when the user asks for only what's staged, say that and ask before running it.
Every scope flag conflicts with [PROMPT]
The usage line reads codex review [OPTIONS] [PROMPT], which suggests you can pass custom instructions alongside a scope. You can't — all three scope flags are mutually exclusive with the positional prompt:
error: the argument '--base <BRANCH>' cannot be used with '[PROMPT]'
Verified through codex-cli 0.147.0. Take the scope flag: reviewing the correct diff matters more than steering the review. A bare codex review "instructions" is the only way to get custom instructions, and it gives up scope control to do it.
Get the base branch right
Two ways to end up reviewing already-merged code, both of which waste a full run:
- Local branch refs go stale. Use the remote ref (
origin/main), never the local one (main) — local branches only move when you pull them. - The remote ref is stale too, until you fetch. Run
git fetch originfirst, every time.
Squash merges sharpen this: when a branch is cut from another branch that later gets squash-merged, the merged work reappears as unmerged commits in the diff, and the review fills up with findings about code that already landed.
git fetch origin
BASE=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo origin/main)
If origin/HEAD isn't set — common in clones that never ran git remote set-head — that fallback is a guess. Confirm the real default branch with the user rather than reviewing against the wrong one.
Run it in the background
It streams to stdout and runs for several minutes — well past the default Bash timeout — so run it with run_in_background: true rather than waiting on it. You'll be re-invoked when it exits, so there's no need to poll.
Redirect both streams into a file in your scratchpad directory so the transcript survives the wait:
codex review --base "$BASE" > "$OUT" 2>&1
Set OUT to a path under your scratchpad directory. Tell the user it's running before you go quiet — a silent multi-minute gap reads as a hang.
Triage before relaying
Codex output is a starting point, not a verdict to pass through. Three things to check:
- The
execblocks in the transcript are codex's own tool calls, not findings. The actual verdict is at the end of the file. - Check the head it reviewed against current HEAD. It reports what it reviewed. If commits landed after the run started, findings may already be fixed — this has produced a confident P1 about code that had been corrected two commits earlier.
- Verify load-bearing claims against the tree yourself. Observed failure mode: a type narrowing (
Array.isArrayon a union) reported as dead code when the TypeScript compiler actually requires it. Codex reads the diff, not the whole type graph.
Relay what survives that check, and say which findings you verified versus which you're passing along unchecked.
04 同仓库更多 Skills
Claude Code 技能编写
write-skill
创建或改进 Claude Code Agent Skill(SKILL.md)。当用户要求将某个工作流沉淀为技能、创建可重用技能,或将我们刚一起完成的工作变成技能时使用。
SSH 持久连接复用
ssh-controlmaster
当对同一远程主机运行多个命令时,通过 ControlMaster 使用持久 SSH 连接,以避免重复的认证开销。在要对一台主机连续运行多个 ssh 命令时使用。
会话复盘与 CLAUDE.md 优化
reflect
分析当前项目最近的会话记录,并提出 CLAUDE.md 改进建议。每月手动调用一次,或在完成大量工作后调用。
方案质询与决策压力测试
grill-me
就某个计划或设计对用户进行不懈的追问,直到达成共识,解决决策树的每个分支。当用户想要对计划进行压力测试、接受对其设计的质询,或提到 "grill me" 时使用。
Git 提交信息与 PR 描述规范
git-message-style
Vlad 个人编写提交信息和 PR 描述的约定——主题格式、正文规则、词汇用法和 PR 正文结构。在 Vlad 的个人仓库(而非有自身约定的团队仓库)中编写提交信息或 PR 描述时使用。
Ruby Gem 安全漏洞修复
gem-security-update
修复 Ruby gems 的 Dependabot 安全告警。当用户分享 GitHub Dependabot URL、要求修复 gem 漏洞,或提到需要版本升级的 gem CVE 时使用。