原文核对:2026-10-13 · 中文正文 · 英文提示词与演示
场景定位
在 GitHub 中使用 Codex code review,直接在 PR 上自动指出回归问题、缺少的测试和文档问题。
- 难度
- 入门
- 时间跨度
- 5 秒
适合用于
- 希望在人类批准合并前增加一项审查信号的团队。
- 运行于生产环境的大型代码库。
相关工具
重点检查密钥、身份验证和依赖变更等高风险部分。
Security Best Practices ↗起步提示词
英文原文 · 可复制后按实际材料修改
@codex review for security regressions, missing tests, and risky behavior changes.使用方法
首先为 GitHub 组织或仓库启用 Codex code review。具体设置请参阅 Codex code review in GitHub。
可以让 Codex 自动审查每个 PR,也可以在 PR 评论中输入 @codex review 请求审查。
如果 Codex 指出了回归或潜在问题,可以继续在 PR 中评论,例如 @codex fix it,让它修复。
这会启动一个新的云端对话,修复问题并更新该 PR。
定义审查规则
要自定义 Codex 的审查内容,在最接近相关代码的 AGENTS.md 中添加 ## Code Review Rules 小节。例如:
## Code Review Rules
### Experiment cohorts
- Do not filter treatment comparisons on post-exposure behavior, including conversion or retention.
Safe path: build cohorts from assignment or exposure; report conversion as an outcome.仓库通用规则放在根目录 AGENTS.md 中,服务专属规则放在相应子目录文件中。保持规则简洁,描述需要指出的行为及安全做法或例外,把格式和 lint 检查交给 CI。设置和规则编写方式请参阅 Customize what Codex reviews。
展开英文原文对照
Use Codex code review in GitHub to automatically surface regressions, missing tests, and documentation issues directly on a pull request.
How to use
Start by adding Codex code review to your GitHub organization or repository. See Codex code review in GitHub for more details.
You can set up Codex to automatically review every pull request, or you can request a review with @codex review in a pull request comment.
If Codex flags a regression or potential issue, you can ask it to fix it by commenting on the pull request with a follow-up prompt like @codex fix it.
This will start a new cloud chat that will fix the issue and update the pull request.
Define review guidance
To customize what Codex reviews, add a ## Code Review Rules section to the AGENTS.md closest to the code the rules govern. For example:
## Code Review Rules
### Experiment cohorts
- Do not filter treatment comparisons on post-exposure behavior, including conversion or retention.
Safe path: build cohorts from assignment or exposure; report conversion as an outcome.Put repository-wide rules in the root AGENTS.md and service-specific rules in a nested file. Keep rules concise, describe the behavior to flag and any safe path or exception, and leave formatting and lint checks in CI. See Customize what Codex reviews for setup and rule-writing guidance.